From d1ef6584f10ae56b4d2c2d7b5e4dd65b842d339d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 13 Jun 2024 16:32:15 +0200 Subject: [PATCH] river: Refactor layout engine definition Since we can dynamically define and spawn layout engines this commit changes the riverwm config file setup in a way that makes it possible to change the layout engine with a single variable instead of all throughout the file (variable extraction). --- desktop/.config/river/init | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/desktop/.config/river/init b/desktop/.config/river/init index 080296f..efa977a 100755 --- a/desktop/.config/river/init +++ b/desktop/.config/river/init @@ -3,6 +3,7 @@ mod="Mod4" modemod="Mod1" term=${TERMINAL:-foot} +layout="rivercarro" time_to_lockscreen=300 time_to_screendim=600 time_to_suspend=900 @@ -109,10 +110,10 @@ riverctl map normal $mod+Shift K swap previous riverctl map normal $mod+Shift Return zoom # change layout orientation -riverctl map normal $mod Up send-layout-cmd rivercarro "main-location top" -riverctl map normal $mod Right send-layout-cmd rivercarro "main-location right" -riverctl map normal $mod Down send-layout-cmd rivercarro "main-location bottom" -riverctl map normal $mod Left send-layout-cmd rivercarro "main-location left" +riverctl map normal $mod Up send-layout-cmd $layout "main-location top" +riverctl map normal $mod Right send-layout-cmd $layout "main-location right" +riverctl map normal $mod Down send-layout-cmd $layout "main-location bottom" +riverctl map normal $mod Left send-layout-cmd $layout "main-location left" # snap views to screen edges riverctl map normal $mod+Control H snap left @@ -127,8 +128,8 @@ riverctl map normal $mod F toggle-fullscreen # Make all connected outputs show the desktop and no windows at all riverctl map normal $mod+Shift M spawn 'for i in $(wlopm | wc -l); do riverctl set-focused-tags $((1 << 10)); riverctl focus-output next; done; riverctl set-focused-tags $((1 << 10)); riverctl focus-output next' -riverctl map normal $mod+Shift F10 spawn 'riverctl send-layout-cmd rivercarro "gaps 0"' -riverctl map normal $mod F10 spawn 'riverctl send-layout-cmd rivercarro "gaps 6"' +riverctl map normal $mod+Shift F10 spawn 'riverctl send-layout-cmd $layout "gaps 0"' +riverctl map normal $mod F10 spawn 'riverctl send-layout-cmd $layout "gaps 6"' # toggle float riverctl map normal $mod+Shift v toggle-float @@ -152,11 +153,11 @@ riverctl map interact_float $mod+Shift J move down 100 riverctl map interact_float $mod+Shift K move up 100 riverctl map interact_float $mod+Shift L move right 100 # decrease/increase the main ratio of layout -riverctl map interact_float None H send-layout-cmd rivercarro "main-ratio -0.05" -riverctl map interact_float None L send-layout-cmd rivercarro "main-ratio +0.05" +riverctl map interact_float None H send-layout-cmd $layout "main-ratio -0.05" +riverctl map interact_float None L send-layout-cmd $layout "main-ratio +0.05" # increment/decrement the main layout -riverctl map interact_float None J send-layout-cmd rivercarro "main-count +1" -riverctl map interact_float None K send-layout-cmd rivercarro "main-count -1" +riverctl map interact_float None J send-layout-cmd $layout "main-count +1" +riverctl map interact_float None K send-layout-cmd $layout "main-count -1" ### End resize and moving mode # focus the next/previous output @@ -289,9 +290,9 @@ riverctl spawn "wl-paste -t text --watch clipman store" # killall polkit-gnome-authentication-agent-1 # /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & # start layouting engine -killall rivercarro -riverctl spawn "rivercarro -main-ratio 0.65" +killall $layout +riverctl spawn "$layout -main-ratio 0.65" # River will send the process group of the init executable SIGTERM on exit. -riverctl default-layout rivercarro -# exec rivercarro -main-ratio 0.65 -view-padding 6 -outer-padding 6 & # -> does not work with current rivercarro version (0.1.4) +riverctl default-layout $layout +# exec $layout -main-ratio 0.65 -view-padding 6 -outer-padding 6 & # -> does not work with current rivercarro version (0.1.4) brightnessctl set 70%