summaryrefslogtreecommitdiffstats
path: root/wal/postrun
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
commitaf120ab348f2e1a5a39dec035ed9dcf84189a64e (patch)
tree2a3aadd7ce1b7b771dfe3fe7c983569726c8d7ed /wal/postrun
downloaddotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.gz
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.bz2
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.zip
dotfiles
Diffstat (limited to 'wal/postrun')
-rwxr-xr-xwal/postrun32
1 files changed, 32 insertions, 0 deletions
diff --git a/wal/postrun b/wal/postrun
new file mode 100755
index 0000000..61d8a41
--- /dev/null
+++ b/wal/postrun
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
+zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
+
+source "${XDG_CACHE_HOME:-$HOME/.cache}/wal/colors.sh"
+
+mkdir -p "${dunstconf%/*}" "${zathuraconf%/*}"
+
+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"
+
+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}")"
+
+ 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
+}
+
+fix_sequences <"${XDG_CACHE_HOME:-$HOME/.cache}/wal/sequences"
+
+pkill dunst; setsid -f dunst