From bd40b3cdd5e54eb03c88cec9651d1e33263ba208 Mon Sep 17 00:00:00 2001 From: Joachim Nielandt Date: Thu, 18 May 2023 11:45:28 +0200 Subject: [PATCH] Added resize mode --- dot_config/sway/config | 43 +++++++++++++----------- dot_config/sway/keybinding.conf | 14 ++++++++ dot_config/sway/modes.conf | 39 ++++++++++++++++++++++ dot_config/sway/variables.conf | 59 +++++++++++++++++++++------------ 4 files changed, 113 insertions(+), 42 deletions(-) create mode 100644 dot_config/sway/modes.conf diff --git a/dot_config/sway/config b/dot_config/sway/config index 1d3709d..6a0b930 100644 --- a/dot_config/sway/config +++ b/dot_config/sway/config @@ -45,8 +45,11 @@ input "1267:12590:ELAN0755:00_04F3:312E_Touchpad" { # Disallow endless looping of focus: extreme right is extreme right, don't flip to extreme left whenever you want... focus_wrapping no +# include the modes - to be mapped in keybinding.conf +include $swayconfig/modes.conf + # include all the keybindings -include $HOME/.config/sway/keybinding.conf +include $swayconfig/keybinding.conf ########## # PROGRAMS @@ -57,25 +60,25 @@ assign [class="Thunderbird"] $ws2 ###################### # MODES ###################### -mode "resize" { - # left will shrink the containers width - # right will grow the containers width - # up will shrink the containers height - # down will grow the containers height - bindsym $left resize shrink width 10px - bindsym $down resize grow height 10px - bindsym $up resize shrink height 10px - bindsym $right resize grow width 10px - # Ditto, with arrow keys - bindsym $left_alt resize shrink width 10px - bindsym $down_alt resize grow height 10px - bindsym $up_alt resize shrink height 10px - bindsym $right_alt resize grow width 10px - # Return to default mode - bindsym Return mode "default" - bindsym Escape mode "default" -} -bindsym $mod+r mode "resize" +#mode "resize" { +# # left will shrink the containers width +# # right will grow the containers width +# # up will shrink the containers height +# # down will grow the containers height +# bindsym $left resize shrink width 10px +# bindsym $down resize grow height 10px +# bindsym $up resize shrink height 10px +# bindsym $right resize grow width 10px +# # Ditto, with arrow keys +# bindsym $left_alt resize shrink width 10px +# bindsym $down_alt resize grow height 10px +# bindsym $up_alt resize shrink height 10px +# bindsym Right resize grow width 10px +# # Return to default mode +# bindsym Return mode "default" +# bindsym Escape mode "default" +#} +# bindsym $mod+r mode "resize" # lock / logout / sleep / hibernate / restart / poweroff # TODO convert this to swaylock diff --git a/dot_config/sway/keybinding.conf b/dot_config/sway/keybinding.conf index ace6352..ad3366a 100644 --- a/dot_config/sway/keybinding.conf +++ b/dot_config/sway/keybinding.conf @@ -134,3 +134,17 @@ $bindsym $mod+question exec $help # allow to kill focused floating shell windows using Esc (manjaro) $bindsym --release Escape [app_id="floating_shell" con_id=__focused__] kill + +# manjaro copy +$bindsym --locked XF86MonBrightnessUp exec $brightness_up +$bindsym --locked $mod+Shift+b exec $brightness_up +$bindsym --locked XF86MonBrightnessDown exec $brightness_down + +# --locked flags allow the buttons to be used whilst the screen is locked. +$bindsym --locked XF86AudioRaiseVolume exec $volume_up +$bindsym --locked XF86AudioLowerVolume exec $volume_down +$bindsym --locked XF86AudioMute exec $volume_mute + +# modes +## Launch // Resize Mode ## +$bindsym $mod+r mode $mode_resize diff --git a/dot_config/sway/modes.conf b/dot_config/sway/modes.conf new file mode 100644 index 0000000..0642025 --- /dev/null +++ b/dot_config/sway/modes.conf @@ -0,0 +1,39 @@ +# RESIZE +set $mode_resize " \ +Resize (↑ ↓ ← →) \ +Increase Gaps (+) \ +Decrease Gaps (-)" + +mode --pango_markup $mode_resize { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + $bindsym $left resize shrink width 10px + $bindsym $down resize grow height 10px + $bindsym $up resize shrink height 10px + $bindsym $right resize grow width 10px + + $bindsym $left_alt resize shrink width 10px + $bindsym $down_alt resize grow height 10px + $bindsym $up_alt resize shrink height 10px + $bindsym $right_alt resize grow width 10px + + $bindsym Shift+$left resize shrink width 50px + $bindsym Shift+$down resize grow height 50px + $bindsym Shift+$up resize shrink height 50px + $bindsym Shift+$right resize grow width 50px + + $bindsym Shift+$left_alt resize shrink width 50px + $bindsym Shift+$down_alt resize grow height 50px + $bindsym Shift+$up_alt resize shrink height 50px + $bindsym Shift+$right_alt resize grow width 50px + + ## Resize // Window Gaps // + - ## + $bindsym minus gaps inner current minus 5px + $bindsym plus gaps inner current plus 5px + + # Return to default mode + $bindsym Return mode "default" + $bindsym Escape mode "default" +} diff --git a/dot_config/sway/variables.conf b/dot_config/sway/variables.conf index ebad554..fcf489b 100644 --- a/dot_config/sway/variables.conf +++ b/dot_config/sway/variables.conf @@ -5,33 +5,17 @@ set $unbindsym unbindsym --to-code # background set $background $HOME/pictures/wallpapers/iceland.jpg + +# directories +set $swayconfig $HOME/.config/sway +set $swayscripts $swayconfig/scripts + + ### ### Variables # Logo key. Use Mod1 for Alt. set $mod Mod4 -# Direction keys -set $left Left -set $down Down -set $up Up -set $right Right -# Alternative direction keys -set $left_alt h -set $down_alt j -set $up_alt k -set $right_alt l - -# Your preferred terminal emulator -set $term $HOME/.config/sway/scripts/foot.sh -set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)" -set $term_float footclient -a floating_shell - -# Your preferred application launcher -# Note: pass the final command to swaymsg so that the resulting window can be opened -# on the original workspace that the command was run on. -# -# this is the default search menu -# set $menu dmenu_path | dmenu | xargs swaymsg exec -- # Gruvbox Colors set $dark0_hard #1d2021 set $dark0_hard_t #1d2021e6 @@ -74,6 +58,37 @@ set $faded_aqua #427b58 set $faded_orange #af3a03 set $transparent #ffffff00 +# Direction keys +set $left Left +set $down Down +set $up Up +set $right Right +# Alternative direction keys +set $left_alt h +set $down_alt j +set $up_alt k +set $right_alt l + +# Your preferred terminal emulator +set $term $HOME/.config/sway/scripts/foot.sh +set $term_cwd $term -D "$(swaycwd 2>/dev/null || echo $HOME)" +set $term_float footclient -a floating_shell + +# onscreen bar +set $onscreen_bar $HOME/.config/sway/scripts/wob.sh "$bright_green" "$dark0_hard" + +# brightness control +set $brightness $HOME/.config/sway/scripts/brightness.sh +set $brightness_up $brightness up | $onscreen_bar +set $brightness_down $brightness down | $onscreen_bar + +# Your preferred application launcher +# Note: pass the final command to swaymsg so that the resulting window can be opened +# on the original workspace that the command was run on. +# +# this is the default search menu +# set $menu dmenu_path | dmenu | xargs swaymsg exec -- + # Layout # window color class border backgr. text indicator child_border client.focused $bright_green $dark0_t $light0_hard $bright_orange $bright_green