summaryrefslogtreecommitdiff
path: root/bin/zathura
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2024-10-24 21:22:29 +0900
committerA Farzat <a@farzat.xyz>2024-11-04 21:22:29 +0900
commit6043242b6e13eab21c5ac7f39993bb6c1950f170 (patch)
tree1b043ed5720c457e17502e4772a8ca299d6e6620 /bin/zathura
parent8c6b098c2b47ad70d3b161b3e16f1709038a0404 (diff)
downloaddotfiles-6043242b6e13eab21c5ac7f39993bb6c1950f170.tar.gz
dotfiles-6043242b6e13eab21c5ac7f39993bb6c1950f170.zip
Add custom zathura scripts
Diffstat (limited to 'bin/zathura')
-rwxr-xr-xbin/zathura/gen_zathura_wal_config39
-rwxr-xr-xbin/zathura/zathura_attach23
-rwxr-xr-xbin/zathura/zathura_tabbed5
3 files changed, 67 insertions, 0 deletions
diff --git a/bin/zathura/gen_zathura_wal_config b/bin/zathura/gen_zathura_wal_config
new file mode 100755
index 0000000..25c9012
--- /dev/null
+++ b/bin/zathura/gen_zathura_wal_config
@@ -0,0 +1,39 @@
+#!/usr/bin/env sh
+
+. "${XDG_CACHE_HOME:-"$HOME/.cache"}/wal/colors.sh"
+
+cat <<CONF > "${XDG_CONFIG_HOME:-"$HOME/.config"}/zathura/wal"
+set recolor "true"
+
+set completion-bg "$background"
+set completion-fg "$foreground"
+set completion-group-bg "$background"
+set completion-group-fg "$color2"
+set completion-highlight-bg "$foreground"
+set completion-highlight-fg "$background"
+
+set recolor-lightcolor "$background"
+set recolor-darkcolor "$foreground"
+set default-bg "$background"
+
+set inputbar-bg "$background"
+set inputbar-fg "$foreground"
+set notification-bg "$background"
+set notification-fg "$foreground"
+set notification-error-bg "$color1"
+set notification-error-fg "$foreground"
+set notification-warning-bg "$color1"
+set notification-warning-fg "$foreground"
+set statusbar-bg "$background"
+set statusbar-fg "$foreground"
+set index-bg "$background"
+set index-fg "$foreground"
+set index-active-bg "$foreground"
+set index-active-fg "$background"
+set render-loading-bg "$background"
+set render-loading-fg "$foreground"
+
+set window-title-home-tilde true
+set statusbar-basename true
+set selection-clipboard clipboard
+CONF
diff --git a/bin/zathura/zathura_attach b/bin/zathura/zathura_attach
new file mode 100755
index 0000000..f9061d8
--- /dev/null
+++ b/bin/zathura/zathura_attach
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+
+# Attach zathura to a running tabbed instance.
+
+# Keep in mind that one could also reattach windows through
+# xdotool windowreparent <source_id> <destination_id>
+# The source_id and destination_id can be obtained using
+# xwininfo -tree and looking at "Window id:"
+
+xids="$(xdotool search --class tabbed)"
+
+# If none are running, execute zathura_tabbed instead.
+[ -z "$xids" ] && exec zathura_tabbed "$@"
+
+# If only one is running, just attach to that.
+# Otherwise, filter to only one.
+if [ "$(printf "%s\n" "$xids" | wc -l)" -gt 1 ]
+then
+ xid="$(printf "%s" "$xids" | dmenu -p "Choose tabbed window to attach to:")"
+ [ -z "$xid" ] && { echo "No instance was chosen."; exit 1; } || xids="$xid"
+fi
+
+exec zathura -e "$xids" "$@"
diff --git a/bin/zathura/zathura_tabbed b/bin/zathura/zathura_tabbed
new file mode 100755
index 0000000..d2ad293
--- /dev/null
+++ b/bin/zathura/zathura_tabbed
@@ -0,0 +1,5 @@
+#!/usr/bin/env sh
+
+# Make a new tabbed instance and attach zathura to it.
+xid="$(setsid -f tabbed -scd zathura -e)"
+exec zathura -e "$xid" "$@"