From 64f31bf86c9a96394194f54da77e9ae153b92dcb Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Thu, 14 Oct 2021 20:44:40 +0200 Subject: [PATCH 1/5] Add some variables --- .config/wal/postrun | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.config/wal/postrun b/.config/wal/postrun index 85d9e3f..d9a9161 100755 --- a/.config/wal/postrun +++ b/.config/wal/postrun @@ -1,13 +1,16 @@ #!/bin/bash +dunstconf="${HOME}/.config/dunst/dunstrc" +zathuraconf="${HOME}/.config/zathura/zathurarc" + source "${HOME}/.cache/wal/colors.sh" -mkdir -p "${HOME}/.config/dunst" -mkdir -p "${HOME}/.config/zathura" -mv -n "${HOME}/.config/dunst/dunstrc" "${HOME}/.config/dunst/dunstrc.bak" -mv -n "${HOME}/.config/zathura/zathurarc" "${HOME}/.config/zathura/zathurarc.bak" -ln -sf "${HOME}/.cache/wal/dunstrc" "${HOME}/.config/dunst/dunstrc" -ln -sf "${HOME}/.cache/wal/zathurarc" "${HOME}/.config/zathura/zathurarc" +mkdir -p "$dunstconf" +mkdir -p "$zathuraconf" +mv -n "$dunstconf" "$dunstconf.bak" +mv -n "$zathuraconf" "$zathuraconf.bak" +ln -sf "${HOME}/.cache/wal/dunstrc" "$dunstconf" +ln -sf "${HOME}/.cache/wal/zathurarc" "$zathuraconf" fix_sequences() { e=$'\e' From 6faae93d1598e988c75086a36cc99c0eed834f2d Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Thu, 14 Oct 2021 20:46:07 +0200 Subject: [PATCH 2/5] Replicate tail functionality in awk --- .local/bin/displayselect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/displayselect b/.local/bin/displayselect index f9e8062..0b33f7b 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -14,9 +14,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens. internal=$(echo "$screens" | grep -v "$external") res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \ - tail -n 1 | awk '{print $1}') + awk 'END {print $1}') res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ - tail -n 1 | awk '{print $1}') + awk 'END {print $1}') res_ext_x=$(echo "$res_external" | sed 's/x.*//') res_ext_y=$(echo "$res_external" | sed 's/.*x//') From 40af3ab99263ebbf6790659414d2db3771fc0ac4 Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Thu, 14 Oct 2021 20:47:33 +0200 Subject: [PATCH 3/5] Use setsid --- .local/bin/samedir | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.local/bin/samedir b/.local/bin/samedir index 73facfd..82397d3 100755 --- a/.local/bin/samedir +++ b/.local/bin/samedir @@ -2,7 +2,4 @@ # Open a terminal window in the same directory as the currently active window. -PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3) -PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')" -cd "$(readlink /proc/"$PID"/cwd)" || return 1 -"$TERMINAL" +setsid -f $TERMINAL >/dev/null 2>&1 From 7dbc757a64d8d21db29b208a22b6165e32719fab Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Thu, 14 Oct 2021 20:50:00 +0200 Subject: [PATCH 4/5] Add some conf file variables --- .local/bin/setbg | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.local/bin/setbg b/.local/bin/setbg index 7f997b7..b0938fd 100755 --- a/.local/bin/setbg +++ b/.local/bin/setbg @@ -9,6 +9,10 @@ # Location of link to wallpaper link. bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg" +# Configuration files of applications that have their themes changed by pywal. +dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" +zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" + trueloc="$(readlink -f "$1")" && case "$(file --mime-type -b "$trueloc")" in image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;; @@ -18,12 +22,12 @@ esac # If pywal is installed, use it. if command -v wal >/dev/null 2>&1 ; then - wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 && - pidof dwm >/dev/null && xdotool key super+F12 + wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 && + pidof dwm >/dev/null && xdotool key super+F12 # If pywal is removed, return config files to normal. else - [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" - [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" + [ -f "$dunstconf.bak" ] && unlink "$dunstconf" && mv "$dunstconf.bak" "$dunstconf" + [ -f "$zathuraconf.bak" ] && unlink "$zathuraconf" && mv "$zathuraconf.bak" "$zathuraconf" fi xwallpaper --zoom "$bgloc" From 56caae7b0316eab26392090a62eb2bf4cd4887d5 Mon Sep 17 00:00:00 2001 From: krisdoodle45 <86745210+krisdoodle45@users.noreply.github.com> Date: Tue, 19 Oct 2021 16:53:06 +0200 Subject: [PATCH 5/5] Revert changes to displayselect (already best performance) --- .local/bin/displayselect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 0b33f7b..f9e8062 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -14,9 +14,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens. internal=$(echo "$screens" | grep -v "$external") res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \ - awk 'END {print $1}') + tail -n 1 | awk '{print $1}') res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ - awk 'END {print $1}') + tail -n 1 | awk '{print $1}') res_ext_x=$(echo "$res_external" | sed 's/x.*//') res_ext_y=$(echo "$res_external" | sed 's/.*x//')