From 99ed9a2ea95d1c0c9c66af6943566a464c03c3e5 Mon Sep 17 00:00:00 2001
From: katherine <shmibs@shmibbles.me>
Date: Sun, 15 Oct 2017 10:18:28 -0700
Subject: first steps away from mate backend

---
 .config/herbstluftwm/autostart |  5 +++++
 .config/herbstluftwm/panel.sh  |  2 +-
 .config/herbstluftwm/pvol.sh   | 20 ++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100755 .config/herbstluftwm/pvol.sh

(limited to '.config/herbstluftwm')

diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart
index 8e86ccc..d3b2746 100755
--- a/.config/herbstluftwm/autostart
+++ b/.config/herbstluftwm/autostart
@@ -172,6 +172,11 @@ hc keybind Mod4-r spawn dmenu_run -fn "${bfont}:size=${bfont_size}" \
 hc keybind Mod4-g spawn ~/.config/herbstluftwm/switcher.sh
 # hc keybind Mod4-8 spawn ~/.config/herbstluftwm/calc.sh
 
+hc keybind XF86AudioLowerVolume spawn ~/.config/herbstluftwm/pvol.sh down
+hc keybind XF86AudioRaiseVolume spawn ~/.config/herbstluftwm/pvol.sh up
+hc keybind XF86AudioMute spawn ~/.config/herbstluftwm/pvol.sh mute
+hc keybind XF86AudioMicMute spawn ~/.config/herbstluftwm/pvol.sh
+
 # tunes
 hc keybind Mod4-Up spawn ~/.config/herbstluftwm/mpc-status.sh
 hc keybind Mod4-Down spawn mpc toggle
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh
index 285270e..057245a 100755
--- a/.config/herbstluftwm/panel.sh
+++ b/.config/herbstluftwm/panel.sh
@@ -300,7 +300,7 @@ event_when() {
 	# pass the events into bar
 } 2> /dev/null | lemonbar -f "$ifont" -o "$ifont_off" \
 	-f "${bfont}:size=${bfont_size}" -o "$bfont_off" \
-	-f "${jfont}:size=${jfont_size}" -o "$jfont_off" \
+	-f "${bjfont}:size=${bjfont_size}" -o "$bjfont_off" \
 	-g${width}x${bheight}+${xpos}+${ypos} \
 	-B ${bg_normal} -F ${fg_normal} | \
 {
diff --git a/.config/herbstluftwm/pvol.sh b/.config/herbstluftwm/pvol.sh
new file mode 100755
index 0000000..5c7b351
--- /dev/null
+++ b/.config/herbstluftwm/pvol.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# i patched dunst to clear all on SIGUSR1
+killall -SIGUSR1 dunst
+
+# race condition, obvs, but this is hopefully time enough
+case "$1" in
+	down)
+		pavolume voldown --quiet 2
+		;;
+	up)
+		pavolume volup --quiet 2
+		;;
+	mute)
+		pavolume mutetoggle --quiet
+		;;
+	*)
+		pavolume show
+		;;
+esac
-- 
cgit v1.2.3


From 5d57322f71a9f3193133c1be1d5fe938b5cb6e56 Mon Sep 17 00:00:00 2001
From: katherine <shmibs@shmibbles.me>
Date: Wed, 8 Nov 2017 01:47:34 -0700
Subject: add pass and maim support to herbstluftwm

---
 .config/herbstluftwm/autostart   | 20 ++++++++++------
 .config/herbstluftwm/maim.sh     | 52 ++++++++++++++++++++++++++++++++++++++++
 .config/herbstluftwm/pass.sh     | 25 +++++++++++++++++++
 .config/herbstluftwm/switcher.sh |  4 ++--
 4 files changed, 92 insertions(+), 9 deletions(-)
 create mode 100755 .config/herbstluftwm/maim.sh
 create mode 100755 .config/herbstluftwm/pass.sh

(limited to '.config/herbstluftwm')

diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart
index d3b2746..4cf40b0 100755
--- a/.config/herbstluftwm/autostart
+++ b/.config/herbstluftwm/autostart
@@ -120,10 +120,18 @@ hc keybind Mod4-i jumpto urgent
 
 # tegaki
 hc keybind Mod4-r spawn tegaki-recognize
-# mate
-hc keybind XF86PowerOff spawn mate-session-save --shutdown-dialog
-hc keybind Mod1-XF86PowerOff spawn mate-session-save --shutdown-dialog
-hc keybind Print        spawn mate-screenshot
+
+#pass
+hc keybind Mod4-x spawn ~/.config/herbstluftwm/pass.sh
+hc keybind Mod4-Shift-x spawn ~/.config/herbstluftwm/pass.sh -f
+
+#scrot-ing
+hc keybind Print               spawn ~/.config/herbstluftwm/maim.sh
+hc keybind Shift-Print         spawn ~/.config/herbstluftwm/maim.sh -s
+hc keybind Control-Print       spawn ~/.config/herbstluftwm/maim.sh -m clipboard
+hc keybind Shift-Control-Print spawn ~/.config/herbstluftwm/maim.sh -s -m clipboard
+hc keybind Mod4-Print          spawn ~/.config/herbstluftwm/maim.sh -m send
+hc keybind Mod4-Shift-Print    spawn ~/.config/herbstluftwm/maim.sh -s -m send
 
 # ranger
 hc keybind Mod4-Shift-Control-Return spawn urxvt -name "ranger" -e ranger ~
@@ -150,7 +158,6 @@ hc keybind Mod4-w spawn xdotool click 1
 # spawn
 hc keybind Mod4-Return  spawn urxvt
 hc keybind Mod4-Shift-b spawn primusrun VBoxSDL --startvm arch
-hc keybind Mod4-Shift-c spawn cvlc v4l2://
 hc keybind Mod4-Shift-d spawn ~/games/desura/desura
 hc keybind Mod4-Shift-f spawn firejail --netfilter=/etc/firejail/nolocal.net firefox
 hc keybind Mod4-Shift-g spawn gwaei
@@ -159,7 +166,6 @@ hc keybind Mod4-Shift-m spawn mathematica
 hc keybind Mod4-Shift-n spawn urxvt -name "notes" -e $EDITOR ~/notes
 hc keybind Mod4-Shift-o spawn ~/stuffs/tor/start-tor-browser
 hc keybind Mod4-Shift-p spawn urxvt -e pms
-hc keybind Mod4-Shift-s spawn scrot
 hc keybind Mod4-Shift-t spawn transmission-gtk
 hc keybind Mod4-Shift-v spawn urxvt -name "$EDITOR" -e $EDITOR
 hc keybind Mod4-Shift-w spawn urxvt -name "weechat" -e weechat
@@ -196,7 +202,7 @@ hc rule focus=on
 hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off
 # set apppropriate things to pseudotile
 hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on focus=on
-hc rule class~'(VBoxSDL|SleepIsDeathApp|freeciv-sdl|FTL)' pseudotile=on focus=on
+hc rule class~'(VBoxSDL|SleepIsDeathApp|freeciv-sdl|FTL|pinentry)' pseudotile=on focus=on
 hc rule class~'(Tegaki-recognize|PlayOnLinux|PCSX2|Tilem2|Wine|explorer.exe)' pseudotile=on focus=on
 hc rule class~'(mednafen)' pseudotile=on focus=on
 
diff --git a/.config/herbstluftwm/maim.sh b/.config/herbstluftwm/maim.sh
new file mode 100755
index 0000000..a569460
--- /dev/null
+++ b/.config/herbstluftwm/maim.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env zsh
+
+local mpat='^(send|clipboard|normal)$'
+
+local mode='normal'
+local selection
+
+local args
+zparseopts -D -E -M -A args \
+	m:	-mode=m \
+	s	-selection=s
+
+local optarg
+for opt in ${(@k)args}; do
+	unset optarg
+	[[ -z $args[$opt] ]] || optarg=$args[$opt]
+	case $opt in
+		-m)
+			[[ ! $(echo $optarg | grep -oE "$mpat") ]] \
+				&& echo "err: bad mode" && exit
+			mode=$optarg
+			;;
+
+		-s) selection=s ;;
+	esac
+done
+
+[[ ${#@} -gt 0 ]] && echo "err: unrecognised arguments" && exit
+
+local year
+local stamp
+date +%Y | read year
+date +%s | read stamp
+
+local fname="$HOME/images/scrot/$year/${year}-${stamp}.png"
+
+mkdir -p $HOME/images/scrot/$year
+
+if [[ $mode == clipboard ]]; then
+	maim -u${selection} | xclip -selection clipboard -t image/png
+	exit
+fi
+
+maim -u${selection} $fname
+
+if [[ $mode == send ]]; then
+	[[ -f $fname ]] \
+		&& optipng $fname \
+		&& send $fname \
+		&& notify-send "maim: sent ${fname:t} to /tmp/" \
+		|| notify-send "maim: send to /tmp/ failed"
+fi
diff --git a/.config/herbstluftwm/pass.sh b/.config/herbstluftwm/pass.sh
new file mode 100755
index 0000000..32a7b2d
--- /dev/null
+++ b/.config/herbstluftwm/pass.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env zsh
+
+source ~/.config/init/vars
+
+zparseopts -M -E -A args \
+	f	-firefox=f
+
+local password_files
+
+password_files=( ~/.password-store/**/*.gpg )
+password_files=( ${password_files:t:r} )
+
+printf "%s\n" $password_files | dmenu -fn "${bfont}:size=${bfont_size}" -i \
+		-h "$bheight" -nb "$bar_bg" -nf "$bar_fg" \
+		-sb "$bg_focus" -sf "$fg_focus" \
+		-p "Pass:"  | cut -d ')' -f 1 | read choice
+
+[[ -n $choice ]] || exit
+
+pass show $choice | sed -n -e 's/^login: //p' | xclip -selection clipboard
+
+pass show $choice | sed -n -e 's/^url: //p' | read url
+[[ ${(@k)args[-f]} ]] && firefox --new-tab "$url"
+
+pass show -c $choice
diff --git a/.config/herbstluftwm/switcher.sh b/.config/herbstluftwm/switcher.sh
index e076eb3..2558303 100755
--- a/.config/herbstluftwm/switcher.sh
+++ b/.config/herbstluftwm/switcher.sh
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/usr/bin/env zsh
 
 source ~/.config/init/vars
 
@@ -16,6 +16,6 @@ done < <(wmctrl -l)
 
 echo -e "$lines" | nl -w 2 -s ") " | dmenu -fn "${bfont}:size=${bfont_size}" -i -h "$bheight" \
 		-nb "$bar_bg" -nf "$bar_fg" -sb "$bg_focus" -sf "$fg_focus" \
-		-p "Select:" -l 40 | cut -d ')' -f 1 | {read choice}
+		-p "Select:" -l 40 | cut -d ')' -f 1 | read choice
 
 herbstclient jumpto "${nums[$choice]}"
-- 
cgit v1.2.3