voidrice/.config/wal/postrun

33 lines
1.3 KiB
Text
Raw Permalink Normal View History

2020-02-08 04:07:05 +00:00
#!/bin/bash
2021-11-11 17:47:17 +00:00
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
2021-10-14 18:44:40 +00:00
2021-11-11 17:47:17 +00:00
source "${XDG_CACHE_HOME:-$HOME/.cache}/wal/colors.sh"
2020-02-08 04:07:05 +00:00
2021-11-11 17:49:57 +00:00
mkdir -p "${dunstconf%/*}" "${zathuraconf%/*}"
2021-11-11 17:47:17 +00:00
mv -n "$dunstconf" "$dunstconf.bak"
mv -n "$zathuraconf" "$zathuraconf.bak"
ln -sf "${XDG_CACHE_HOME:-$HOME/.cache}/wal/dunstrc" "$dunstconf"
ln -sf "${XDG_CACHE_HOME:-$HOME/.cache}/wal/zathurarc" "$zathuraconf"
2020-02-08 04:07:05 +00:00
fix_sequences() {
e=$'\e'
sequences=$(cat)
foreground_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]10[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")"
background_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]11[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")"
cursor_color="$(echo -e "${sequences}\c" | grep --color=never -Eo "${e}]12[^${e}\\\\]*?${e}\\\\" | grep --color=never -Eo "#[0-9A-Fa-f]{6}")"
2021-11-11 17:47:17 +00:00
for term in /dev/pts/{0..9}*; do
echo -e "\e]4;256;${cursor_color}\a\c" > "${term}" 2>/dev/null
echo -e "\e]4;258;${background_color}\a\c" > "${term}" 2>/dev/null
echo -e "\e]4;259;${foreground_color}\a\c" > "${term}" 2>/dev/null
done
2020-02-08 04:07:05 +00:00
}
2021-11-11 17:47:17 +00:00
fix_sequences <"${XDG_CACHE_HOME:-$HOME/.cache}/wal/sequences"
2020-02-08 04:07:05 +00:00
2021-11-11 17:47:17 +00:00
pkill dunst; setsid -f dunst