From d79f3465511b30683fa1374edecd8c8767df6b80 Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Wed, 10 Aug 2022 12:50:12 -0500 Subject: [PATCH] added keystroke to toggle xnots on and off --- bin/xnots-toggle | 22 ++++++++++++++++++++++ herbstluftwm/autostart | 7 ++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100755 bin/xnots-toggle diff --git a/bin/xnots-toggle b/bin/xnots-toggle new file mode 100755 index 0000000..8d5dde0 --- /dev/null +++ b/bin/xnots-toggle @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +running=$(pgrep xnots) +curtag=$(herbstclient attr tags.focus.name) + +if [ -z "$running" ]; then + exec xnots +else + visible= + for winid in $(xdotool search --class XNots); do + hcid=$(printf "0x%x" "$winid") + if [ -z "$visible" ]; then + visible=$(herbstclient attr clients."$hcid".visible) + fi + wintag=$(herbstclient attr clients."$hcid".tag) + if [ "$visible" = false ] || [ "$wintag" != "$curtag" ]; then + herbstclient bring "$winid" + else + herbstclient set_attr clients."$hcid".minimized true + fi + done +fi diff --git a/herbstluftwm/autostart b/herbstluftwm/autostart index 058c9b5..77cbe88 100755 --- a/herbstluftwm/autostart +++ b/herbstluftwm/autostart @@ -16,10 +16,6 @@ if hc silent new_attr bool my_picom_is_running; then picom -b fi -if command -v xnots >/dev/null && hc silent new_attr bool my_xnots_is_running; then - xnots & -fi - hc lock xsetroot -solid "#1e1e2e" -cursor_name left_ptr & feh --bg-fill ~/.config/herbstluftwm/wallpaper.png @@ -66,6 +62,7 @@ hc keybind $Mod-Control-r reload hc keybind $Mod-Shift-c close hc keybind $Mod-Return spawn st hc keybind $Mod-grave spawn $HOME/skynet/bin/quake-term +hc keybind $Mod-Control-grave spawn $HOME/skynet/bin/xnots-toggle hc keybind $Mod-Alt-Return spawn ~/skynet/bin/zenvim hc keybind $Mod-Control-Return spawn firefox hc keybind Print spawn flameshot gui @@ -159,7 +156,7 @@ hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off hc rule class='nvim-zen' fullscreen=on hc rule class='mpv' floating=on hc rule class='sim_arduboy' floating=on -hc rule class='XNots' floating=on tag=8 +hc rule class='XNots' floating=on hc set tree_style '╾│ ├└╼─┐'