From 21bdc757b8a16397532b79d916674a383a9f2bce Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 18 Nov 2022 13:53:14 +0100 Subject: [PATCH] Switch to using libspeedwm --- README.md | 4 ++- src/speedwm-utils | 77 +++++++++++++++++++++++----------------------- src/speedwm-winnav | 2 +- 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index d709ee3..4d23a7d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # speedwm-extras -Extra scripts for speedwm \ No newline at end of file +Extra scripts for speedwm. + +NOTE: Requires libspeedwm, which can be found here: https://codeberg.org/speedie/libspeedwm. diff --git a/src/speedwm-utils b/src/speedwm-utils index e89a333..cd4b139 100755 --- a/src/speedwm-utils +++ b/src/speedwm-utils @@ -30,27 +30,26 @@ VARS() { VARS GENERAL() { -GENERALOPTS=$(printf "mfact +\nmfact -\nToggle Sticky\nToggle Bar\nToggle Fullscreen\nReset Layout/mfact\nReorganize Tags" | $RUNLAUNCHER -l 20 -p 'What do you want to do?') -case "$GENERALOPTS" in -"mfact +") speedwm -s "#cmd:18" ;; -"mfact -") speedwm -s "#cmd:19" ;; -"Toggle Sticky") speedwm -s "#cmd:20" ;; -"Toggle Bar") speedwm -s "#cmd:21" ;; -"Toggle Fullscreen") speedwm -s "#cmd:22" ;; -"Reorganize Tags") speedwm -s "#cmd:25" ;; -"Reset Layout/mfact") speedwm -s "#cmd:59" ;; -esac + case "$(printf "mfact +\nmfact -\nToggle Sticky\nToggle Bar\nToggle Fullscreen\nReset Layout/mfact\nReorganize Tags" | $RUNLAUNCHER -l 20 -p 'What do you want to do?')" in + "mfact +") libspeedwm --perform tiling_mfact_inc ;; + "mfact -") libspeedwm --perform tiling_mfact_dec ;; + "Toggle Sticky") libspeedwm --perform toggle_client_sticky ;; + "Toggle Bar") libspeedwm --perform toggle_bar ;; + "Toggle Fullscreen") libspeedwm --perform toggle_client_fullscr ;; + "Reorganize Tags") libspeedwm --perform tags_reorganize ;; + "Reset Layout/mfact") libspeedwm --perform reset_mfact && libspeedwm --perform reset_layout ;; + esac } OPT() { -MENUOPTS=$(printf "Layout\nReload .Xresources\nGeneral\nExit" | $RUNLAUNCHER -l 20 -p 'What do you want to do?') - -case "$MENUOPTS" in -"Layout") ${0} layout $2 && exit 0 ;; -"Reload .Xresources") ${0} reloadcolors && exit 0 ;; -"General") ${0} -general $2 && exit 0 ;; -"Exit") exit 0 ;; -esac + MENUOPTS=$(printf "Layout\nReload .Xresources\nGeneral\nExit" | $RUNLAUNCHER -l 20 -p 'What do you want to do?') + + case "$MENUOPTS" in + "Layout") ${0} layout $2 && exit 0 ;; + "Reload .Xresources") ${0} reloadcolors && exit 0 ;; + "General") ${0} general $2 && exit 0 ;; + "Exit") exit 0 ;; + esac } HELP() { @@ -80,14 +79,14 @@ L15="$(printf "L15: Empty\n")" case "$1" in "layout") SEL_LAYOUT=$(printf "${L1}\n${L2}\n${L3}\n${L4}\n${L5}\n${L6}\n${L7}\n${L8}\n${L9}\n${L10}\n${L11}\n${L12}\n${L13}\n${L14}\n${L15}\nPrevious Layout\nNext Layout\nEnter S expression" | $RUNLAUNCHER -l 21 -p "Pick a layout: ") ;; -"reloadcolors") speedwm -s "#cmd:65" ;; -"list") sed 's|speedwm -s "#cmd:||g; s|"||g; s| - ||g; s@|@-@g' /usr/share/speedwm/example.signal | head -n "$(expr "$(cat /usr/share/speedwm/example.signal | wc -l)" - 1)" ;; +"reloadcolors") libspeedwm --perform core_wm_reload ;; +"list") head -n "$(expr "$(cat /usr/share/speedwm/example.signal | wc -l)" - 1)" /usr/share/speedwm/example.signal ;; "help") HELP ;; "exec") if [ "$2" = "" ]; then exit 0 else - speedwm -s "#cmd:$2" + libspeedwm --rsig $2 fi ;; "h") HELP ;; "general") GENERAL ;; @@ -96,22 +95,22 @@ esac case "$SEL_LAYOUT" in "Exit") exit 0 ;; -"Previous Layout") speedwm -s "#cmd:16" ;; -"Next Layout") speedwm -s "#cmd:17" ;; -"L1: Tiling") speedwm -s "#cmd:1" ;; -"L2: Floating") speedwm -s "#cmd:2" ;; -"L3: Monocle") speedwm -s "#cmd:3" ;; -"L4: Grid") speedwm -s "#cmd:4" ;; -"L5: Deck") speedwm -s "#cmd:5" ;; -"L6: Centered Master") speedwm -s "#cmd:6" ;; -"L7: Tatami") speedwm -s "#cmd:7" ;; -"L8: Dwindle") speedwm -s "#cmd:8" ;; -"L9: Spiral") speedwm -s "#cmd:9" ;; -"L10: Bottom Stack (Vertical)") speedwm -s "#cmd:10" ;; -"L11: Bottom Stack (Horizontal)") speedwm -s "#cmd:11" ;; -"L12: Grid (Horizontal)") speedwm -s "#cmd:12" ;; -"L13: Dynamic Grid") speedwm -s "#cmd:13" ;; -"L14: Custom") speedwm -s "#cmd:1" && speedwm -s "#cmd:17" ;; -"L15: Empty") speedwm -s "#cmd:113" ;; -"Enter S expression") speedwm -s "#cmd:15" ;; +"Previous Layout") libspeedwm --perform layout_cycle_down;; +"Next Layout") libspeedwm --perform layout_cycle_up ;; +"L1: Tiling") libspeedwm --perform layout_setlayout_tile ;; +"L2: Floating") libspeedwm --perform layout_setlayout_float ;; +"L3: Monocle") libspeedwm --perform layout_setlayout_monocle ;; +"L4: Grid") libspeedwm --perform layout_setlayout_grid ;; +"L5: Deck") libspeedwm --perform layout_setlayout_deck ;; +"L6: Centered Master") libspeedwm --perform layout_setlayout_cm ;; +"L7: Tatami") libspeedwm --perform layout_setlayout_tatami ;; +"L8: Dwindle") libspeedwm --perform layout_setlayout_dwindle ;; +"L9: Spiral") libspeedwm --perform layout_setlayout_spiral ;; +"L10: Bottom Stack (Vertical)") libspeedwm --perform layout_setlayout_bs ;; +"L11: Bottom Stack (Horizontal)") libspeedwm --perform layout_setlayout_hbs ;; +"L12: Grid (Horizontal)") libspeedwm --perform layout_setlayout_hgrid ;; +"L13: Dynamic Grid") libspeedwm --perform layout_setlayout_dgrid ;; +"L14: Custom") libspeedwm --perform layout_setlayout_custom ;; +"L15: Empty") libspeedwm --perform layout_setlayout_empty ;; +"Enter S expression") libspeedwm --perform layout_custom_express ;; esac diff --git a/src/speedwm-winnav b/src/speedwm-winnav index b66e311..b1ad6fe 100755 --- a/src/speedwm-winnav +++ b/src/speedwm-winnav @@ -113,6 +113,6 @@ esac wmctrl -a "$target" && echo "Switched focus" # show hidden window -speedwm -s "#cmd:28" +libspeedwm --perform client_visibility_show RESTORE