From c55163d4aeebc1189b1f8c59057034bba5abd0e3 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Jul 2021 21:12:35 +0200 Subject: [PATCH 1/6] Alias j to z (from autojump) --- home/.config/shell/aliases | 1 + 1 file changed, 1 insertion(+) diff --git a/home/.config/shell/aliases b/home/.config/shell/aliases index 6cd5c21..dc0d857 100755 --- a/home/.config/shell/aliases +++ b/home/.config/shell/aliases @@ -18,6 +18,7 @@ alias .3='cd ../../../' alias .4='cd ../../../../' alias .5='cd ../../../../../' # z.lua script +alias j='z' # for the sake of autojump old habits alias zz='z -c' # restrict matches to subdirs of $PWD alias zb='z -b' # restrict matches to parent directories alias zi='z -I' # cd with interactive fzf selection From b1608241e1b6470087a73f79a4eee4f400d043d5 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Jul 2021 21:12:52 +0200 Subject: [PATCH 2/6] Don't source /etc/profile in zshrc --- home/.config/zsh/.zshrc | 2 -- 1 file changed, 2 deletions(-) diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index d1cdf92..167783e 100755 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -1,7 +1,5 @@ #!/usr/bin/zsh -source /etc/profile - # ZSH Options setopt auto_cd # cd by typing directory name if it's not a command setopt auto_list # automatically list choices on ambiguous completion From dbb62c15885c8a9006879981fa4d1f8de93cef9a Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Jul 2021 21:14:54 +0200 Subject: [PATCH 3/6] Add dmenu scripts --- home/.local/bin/scripts/dmenu/displayselect | 82 +++++++++++++ home/.local/bin/scripts/dmenu/dmenumount | 68 +++++++++++ home/.local/bin/scripts/dmenu/dmenupass | 6 + home/.local/bin/scripts/dmenu/dmenurecord | 121 ++++++++++++++++++++ home/.local/bin/scripts/dmenu/dmenuumount | 44 +++++++ 5 files changed, 321 insertions(+) create mode 100755 home/.local/bin/scripts/dmenu/displayselect create mode 100755 home/.local/bin/scripts/dmenu/dmenumount create mode 100755 home/.local/bin/scripts/dmenu/dmenupass create mode 100755 home/.local/bin/scripts/dmenu/dmenurecord create mode 100755 home/.local/bin/scripts/dmenu/dmenuumount diff --git a/home/.local/bin/scripts/dmenu/displayselect b/home/.local/bin/scripts/dmenu/displayselect new file mode 100755 index 0000000..e010764 --- /dev/null +++ b/home/.local/bin/scripts/dmenu/displayselect @@ -0,0 +1,82 @@ + +#!/bin/sh + +# A UI for detecting and selecting all displays. Probes xrandr for connected +# displays and lets user select one to use. User may also select "manual +# selection" which opens arandr. + +twoscreen() { # If multi-monitor is selected and there are two screens. + + mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?") + # Mirror displays using native resolution of external display and a scaled + # version for the internal display + if [ "$mirror" = "yes" ]; then + external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:") + internal=$(echo "$screens" | grep -v "$external") + + res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \ + tail -n 1 | awk '{print $1}') + res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ + tail -n 1 | awk '{print $1}') + + res_ext_x=$(echo "$res_external" | sed 's/x.*//') + res_ext_y=$(echo "$res_external" | sed 's/.*x//') + res_int_x=$(echo "$res_internal" | sed 's/x.*//') + res_int_y=$(echo "$res_internal" | sed 's/.*x//') + + scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l) + scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l) + + xrandr --output "$external" --auto --scale 1.0x1.0 \ + --output "$internal" --auto --same-as "$external" \ + --scale "$scale_x"x"$scale_y" + else + + primary=$(echo "$screens" | dmenu -i -p "Select primary display:") + secondary=$(echo "$screens" | grep -v "$primary") + direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") + xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 + fi + } + +morescreen() { # If multi-monitor is selected and there are more than two screens. + primary=$(echo "$screens" | dmenu -i -p "Select primary display:") + secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") + direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") + tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") + xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto + } + +multimon() { # Multi-monitor handler. + case "$(echo "$screens" | wc -l)" in + 2) twoscreen ;; + *) morescreen ;; + esac ;} + +onescreen() { # If only one output available or chosen. + xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -) + } + +postrun() { # Stuff to run to clean up. + command -v setbg >/dev/null && setbg # Fix background if screen size/arangement has changed. + } + +# Get all possible displays +allposs=$(xrandr -q | grep "connected") + +# Get all connected screens. +screens=$(echo "$allposs" | awk '/ connected/ {print $1}') + +# If there's only one screen +[ "$(echo "$screens" | wc -l)" -lt 2 ] && + { onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;} + +# Get user choice including multi-monitor and manual selection: +chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && +case "$chosen" in + "manual selection") arandr ; exit ;; + "multi-monitor") multimon ;; + *) onescreen "$chosen" ;; +esac + +postrun diff --git a/home/.local/bin/scripts/dmenu/dmenumount b/home/.local/bin/scripts/dmenu/dmenumount new file mode 100755 index 0000000..2793633 --- /dev/null +++ b/home/.local/bin/scripts/dmenu/dmenumount @@ -0,0 +1,68 @@ +#!/bin/sh + +# Gives dmenu prompt to mount unmounted drives and Android phones. +# If they're in /etc/fstab they'll be mounted automatically. +# Otherwise, you'll be prompted to give a mountpoint from already +# existing directories. If you input a novel directory, it will +# prompt you to create that directory. + +getmount() { \ + [ -z "$chosen" ] && exit 1 + # shellcheck disable=SC2086 + mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 + test -z "$mp" && exit 1 + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi + } + +mountusb() { \ + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" + sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; + esac + notify-send "💻 USB mounting" "$chosen mounted to $mp." + } + +mountandroid() { \ + chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 + chosen="$(echo "$chosen" | cut -d : -f 1)" + getmount "$HOME -maxdepth 3 -type d" + simple-mtpfs --device "$chosen" "$mp" + echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 + simple-mtpfs --device "$chosen" "$mp" + notify-send "🤖 Android Mounting" "Android device mounted to $mp." + } + +asktype() { \ + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 + case $choice in + USB) mountusb ;; + Android) mountandroid ;; + esac + } + +anddrives=$(simple-mtpfs -l 2>/dev/null) +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" + +if [ -z "$usbdrives" ]; then + [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit + echo "Android device(s) detected." + mountandroid +else + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + else + echo "Mountable USB drive(s) and Android device(s) detected." + asktype + fi +fi diff --git a/home/.local/bin/scripts/dmenu/dmenupass b/home/.local/bin/scripts/dmenu/dmenupass new file mode 100755 index 0000000..8d5ce30 --- /dev/null +++ b/home/.local/bin/scripts/dmenu/dmenupass @@ -0,0 +1,6 @@ +#!/bin/sh + +# This script is the value for SUDO_ASKPASS variable, +# meaning that it will be used as a password prompt if needed. + +dmenu -P -p "$1" diff --git a/home/.local/bin/scripts/dmenu/dmenurecord b/home/.local/bin/scripts/dmenu/dmenurecord new file mode 100755 index 0000000..60ce8dc --- /dev/null +++ b/home/.local/bin/scripts/dmenu/dmenurecord @@ -0,0 +1,121 @@ + +#!/bin/sh + +# Usage: +# `$0`: Ask for recording type via dmenu +# `$0 screencast`: Record both audio and screen +# `$0 video`: Record only screen +# `$0 audio`: Record only audio +# `$0 kill`: Kill existing recording +# +# If there is already a running instance, user will be prompted to end it. + +screencast() { + ffmpeg -y \ + -f x11grab \ + -framerate 60 \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ + -i "$DISPLAY" \ + -f alsa -i default \ + -r 30 \ + -c:v h264 -crf 0 -preset ultrafast -c:a aac \ + "$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & + echo $! > /tmp/recordingpid +} + +video() { + ffmpeg \ + -f x11grab \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ + -i "$DISPLAY" \ + -c:v libx264 -qp 0 -r 30 \ + "$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid +} + +webcamhidef() { + ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 1920x1080 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid +} + +webcam() { + ffmpeg \ + -f v4l2 \ + -i /dev/video0 \ + -video_size 640x480 \ + "$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid +} + + +audio() { + ffmpeg \ + -f alsa -i default \ + "$HOME/audio-$(date '+%y%m%d-%H%M-%S').mp3" & + echo $! > /tmp/recordingpid +} + +asktoend() { + response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && + [ "$response" = "Yes" ] && killrecording +} + +videoselected() +{ + slop -f "%x %y %w %h" > /tmp/slop + read -r X Y W H < /tmp/slop + rm /tmp/slop + + ffmpeg \ + -f x11grab \ + -framerate 60 \ + -video_size "$W"x"$H" \ + -i :0.0+"$X,$Y" \ + -c:v libx264 -qp 0 -r 30 \ + "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid +} + +killrecording() { + recpid="$(cat /tmp/recordingpid)" + # kill with SIGTERM, allowing finishing touches. + kill -15 "$recpid" 2>/dev/null + rm -f /tmp/recordingpid + # even after SIGTERM, ffmpeg may still run, so SIGKILL it. + sleep 3 + kill -9 "$recpid" 2>/dev/null + exit +} + +askrecording() { \ + choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") + case "$choice" in + screencast) screencast;; + audio) audio;; + video) video;; + *selected) videoselected;; + webcam) webcam;; + "webcam (hi-def)") webcamhidef;; + esac +} + +case "$1" in + screencast) screencast;; + audio) audio;; + video) video;; + *selected) videoselected;; + kill) killrecording;; + *) + if [ -f /tmp/recordingpid ]; then + recpid="$(cat /tmp/recordingpid)" + if ps -p $recpid > /dev/null; then + asktoend + exit + fi + fi + askrecording;; +esac diff --git a/home/.local/bin/scripts/dmenu/dmenuumount b/home/.local/bin/scripts/dmenu/dmenuumount new file mode 100755 index 0000000..26612ef --- /dev/null +++ b/home/.local/bin/scripts/dmenu/dmenuumount @@ -0,0 +1,44 @@ +#!/bin/sh + +# A dmenu prompt to unmount drives. +# Provides you with mounted partitions, select one to unmount. +# Drives mounted at /, /boot and /home will not be options to unmount. + +unmountusb() { + [ -z "$drives" ] && exit + chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" + [ -z "$chosen" ] && exit + sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted." + } + +unmountandroid() { \ + chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1 + [ -z "$chosen" ] && exit + sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted." + } + +asktype() { \ + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1 + case "$choice" in + USB) unmountusb ;; + Android) unmountandroid ;; + esac + } + +drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') + +if ! grep simple-mtpfs /etc/mtab; then + [ -z "$drives" ] && echo "No drives to unmount." && exit + echo "Unmountable USB drive detected." + unmountusb +else + if [ -z "$drives" ] + then + echo "Unmountable Android device detected." + unmountandroid + else + echo "Unmountable USB drive(s) and Android device(s) detected." + asktype + fi +fi From dbd37392b88c6267e82148bf2796b1a8f3aa5243 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Jul 2021 21:56:07 +0200 Subject: [PATCH 4/6] Add dunst for notifications --- home/.config/dunst/dunstrc | 306 ++++++++++++++++++++++++++++++++++ home/.config/xmonad/xmonad.hs | 1 + 2 files changed, 307 insertions(+) create mode 100644 home/.config/dunst/dunstrc diff --git a/home/.config/dunst/dunstrc b/home/.config/dunst/dunstrc new file mode 100644 index 0000000..02f908a --- /dev/null +++ b/home/.config/dunst/dunstrc @@ -0,0 +1,306 @@ +[global] + + ### Display ### + + # Which monitor should the notifications be shown on + monitor = 0 + + # Display notifications on focused monitor. Possible modes: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # keyboard needs a WM that exports _NET_ACTIVE_WINDOW propery! + # if this option isn't none, monitor option will be ignored. + follow = mouse + + # Notification window size: + # [{width}]x{height}[+/-{x}+/-{y}] + # height is measured in number of notifications, everything + # else is in pixels + # + # if width is omitted (geometry = "x2", message window expands + # over the whole screen (dmenu-like). + # if width is 0, message window expands to fit the message. + # positive x is measured from the left, negative from right + # Y is measured from the top and bottom respectively. + # width can be negative, making it the screen width - width + geometry = "300x5-30+30" + + # Show how many messages are currently hidden (because of geometry) + indicate_hidden = yes + + # Shrink window if it's smaller than the width. ignored when width = 0 + shrink = no + + # Transparency of the window. Range: [0-100] + # only works with composing WM (e.g. xcompdir, compiz, ...) + transparency = 20 + + # The height of the entire notification. If the height is smaller + # than the font height and padding combined, it will be raised to + # the font height and padding. + notification_height = 0 + + # Draw a line of "separator_height" pixel height between notifications + separator_height = 2 + + # Padding between text and separator + padding = 8 + + # Horizontal padding + horizontal_padding = 8 + + # Width in pixels of frame around the notification window + # disabled if set to 0 + frame_width = 3 + + # Defines color of the frame around the notification window + frame_color = "#aaaaaa" + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Sort messages by urgency. + sort = yes + + # Don't remove messages if the user is idle (no mouse/keyboard input) + # for longer than idle_threshold seconds (0 to disable) + idle_threshold = 120 + + ### Text ### + + font = Monospace 14 + + # The spacing between the lines. If the height is smaller than the + # font height, it will get raised to the font height. + line_height = 0 + + # Possible values are: + # full: Allow a small subset of html markup in notifications: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # + # strip: This setting is provided for compatibility with some broken + # clients that send markup even though it's not enabled on the + # server. Dunst will try to strip the markup but the parsing is + # simplistic so using this option outside of matching rules for + # specific applications *IS GREATLY DISCOURAGED*. + # + # no: Disable markup parsing, incoming notifications will be treated as + # plain text. Dunst will not advertise that it has the body-markup + # capability if this is set as a global setting. + # + # It's important to note that markup inside the format option will be parsed + # regardless of what this is set to. + markup = full + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + # Markup is allowed + format = "%s\n%b" + + # Text alignment of the message + # Possible values are "left", "center" and "right". + alignment = left + + # Show age of message if message is older than show_age_threshold seconds + # Set to -1 to disable, 0 to always show. + show_age_threshold = 60 + + # Split notifications into multiple lines if they don't fit into geometry + word_wrap = yes + + # When word_wrap is set to no, specify where to ellipsize long lines. + # Possible values are "start", "middle" and "end" + ellipsize = middle + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + # Merge multiple notifications with the same content + stack_duplicates = true + + # Hide the count of merged notifications with the same content + hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A) + show_indicators = yes + + ### Icons ### + + # Align icons left/right/off + icon_position = left + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 32 + + # Paths to default icons + icon_path = /usr/share/icons/hicolor/16x16/status/:/usr/share/icons/hicolor/16x16/devices/:/usr/share/icons/hicolor/16x16/apps/:/usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/:/usr/share/icons/Adwaita/16x16/apps/ + + ### History ### + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 20 + + ### Misc/Advanced ### + + # dmenu path + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in content menu + browser = /usr/bin/firefox -new-tab + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = true + + # Define the title of the windows spawned by dunst + title = Dunst + + # Define the class of the windows spawned by dunst + class = Dunst + + # Print a notification on startup + # this is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + ### Legacy ### + + # Use the Xinerama extension instead of RandR for multi-monitor support. + # This setting is provided for compatibility with older nVidia drivers that + # do not support RandR and using it on systems that support RandR is highly + # discouraged. + # + # By enabling this setting dunst will not be able to detect when a monitor + # is connected or disconnected which might break follow mode if the screen + # layout changes. + force_xinerama = false + +# Experimental features that may or may not work correctly. Do not expect them +# to have a consistent behaviour across releases. +[experimental] + # Calculate the dpi to use on a per-monitor basis. + # If this setting is enabled the Xft.dpi value will be ignored and instead + # dunst will attempt to calculate an appropriate dpi value for each monitor + # using the resolution and physical size. This might be useful in setups + # where there are multiple screens with very different dpi values. + per_monitor_dpi = false + +[shortcuts] + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are: "ctrl", "mod1" (alt), "mod2", + # "mod3" and "mod4" (win). Xev might be helpful for finding key names + + # Close notification. + close = ctrl+space + # Close all notifications. + close_all = ctrl+shift+space + # Redisplay last message(s) + history = ctrl+grave + # Context menu + context = ctrl+shift+period + +[urgency_low] + background = "#35383b" + foreground = "#fcf7e2" + frame_color = "#27292c" + timeout = 3 + # Icon for notifications with low urgency, uncomment to enable + #icon = /path/to/icon + +[urgency_normal] + background = "#35383b" + foreground = "#dffebe" + frame_color = "#27292c" + timeout = 10 + # Icon for notifications with normal urgency, uncomment to enable + #icon = /path/to/icon + +[urgency_critical] + background = "#35383b" + foreground = "#d27c7b" + frame_color = "#27292c" + timeout = 0 + # Icon for notifications with critical urgency, uncomment to enable + #icon = /path/to/icon + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[history-ignore] +# # This notification will not be saved in history +# summary = "foobar" +# history_ignore = yes + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +# vim: ft=cfg diff --git a/home/.config/xmonad/xmonad.hs b/home/.config/xmonad/xmonad.hs index e98b3c3..04fbed6 100644 --- a/home/.config/xmonad/xmonad.hs +++ b/home/.config/xmonad/xmonad.hs @@ -319,6 +319,7 @@ myStartupHook :: X () myStartupHook = do spawnOnce "setbg &" spawnOnce "nm-applet &" + spawnOnce "dunst &" spawnOnce "trayer-srg --monitor 0 --edge top --align right --widthtype request --padding 0 --transparent true --tint 0x282c34 --alpha 0 --height 23 &" spawnOnce "$HOME/.config/xmonad/scripts/autostart.sh" --spawnOnce "emacs --daemon &" From fe61af8f62554e172e18d462561569c326250206 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Jul 2021 22:20:53 +0200 Subject: [PATCH 5/6] Use xprofile to start necessary init apps --- home/.config/x11/xprofile | 23 ++++++++++++++++++++++- home/.config/xmonad/xmonad.hs | 14 +++++++------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/home/.config/x11/xprofile b/home/.config/x11/xprofile index 85946fc..b9b13cb 100644 --- a/home/.config/x11/xprofile +++ b/home/.config/x11/xprofile @@ -3,4 +3,25 @@ # This file runs when a DM logs you into a graphical session # if you use startx/xinit this file should also be soruced. -xrandr --output eDP-1 --auto --output HDMI-1 --auto --left-of eDP-1 +# Set monitor order +xrandr --output HDMI-1 --auto --output eDP-1 --right-of HDMI-1 --auto + +# Set the background with a custom `setbg` script +setbg & + +# xcompmgr to allow transparency +xcompmgr & + +# Dunst for notifications +dunst & + +# Run network manager applet to show connectivity +nm-applet & + +# Run trayer-srg for systemtray bar +# if installed normally, use `trayer`, not `trayer-srg` command +trayer-srg --monitor 0 --edge top --align right --widthtype request --padding 0 --transparent true --tint 0x282c34 --alpha 0 --height 23 & + +# Enable running applications from chroot +xhost +local: + diff --git a/home/.config/xmonad/xmonad.hs b/home/.config/xmonad/xmonad.hs index 04fbed6..ae706b2 100644 --- a/home/.config/xmonad/xmonad.hs +++ b/home/.config/xmonad/xmonad.hs @@ -314,16 +314,16 @@ myManageHook = composeAll -- Perform an arbitrary action each time xmonad starts or is restarted -- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize -- per-workspace layout choices. +-- +-- I don't really use this because I define these applications +-- in ~/.config/x11/xprofile instead, that way it will apply for +-- all WMs, not just for XMonad myStartupHook :: X () myStartupHook = do - spawnOnce "setbg &" - spawnOnce "nm-applet &" - spawnOnce "dunst &" - spawnOnce "trayer-srg --monitor 0 --edge top --align right --widthtype request --padding 0 --transparent true --tint 0x282c34 --alpha 0 --height 23 &" - spawnOnce "$HOME/.config/xmonad/scripts/autostart.sh" - --spawnOnce "emacs --daemon &" - --spawnOnce "urxvtd -q -o -f &" + -- Automatically run autostart.sh script which will start + -- .desktop applications defined in ~/.config/autostart + spawnOnce "$HOME/.config/xmonad/scripts/autostart.sh &" ------------------------------------------------------------------------------- -- Log hook: this sends info to xmobar process(es) From 4988a0b97067ae91578f46fe0b3b4cb881ef82c6 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 22 Jul 2021 22:21:27 +0200 Subject: [PATCH 6/6] Add autostart script from ~/.config/autostart --- home/.config/xmonad/scripts/autostart.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 home/.config/xmonad/scripts/autostart.sh diff --git a/home/.config/xmonad/scripts/autostart.sh b/home/.config/xmonad/scripts/autostart.sh new file mode 100755 index 0000000..e3c515b --- /dev/null +++ b/home/.config/xmonad/scripts/autostart.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Automatically start the applications in $HOME/.config/autostart + +AUTOSTART_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/autostart" + +find $AUTOSTART_DIR -name '*.desktop' -exec ~/.local/bin/scripts/deskopen {} +