summary refs log tree commit diff
path: root/.config/sway/config.d/binds.conf
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2023-01-19 18:45:46 +0100
committerRobert Günzler <r@gnzler.io>2023-03-21 12:35:42 +0100
commit75d666322acfb6d8a58cbb4bf6a95782fe14b124 (patch)
treec2df99bc6372b7ba28558261911336e4e797ebdf /.config/sway/config.d/binds.conf
parent3d594f8a0da0e4e297df7ea1652048a80f7c8a96 (diff)
sway: make most of config auto-loading
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '.config/sway/config.d/binds.conf')
-rw-r--r--.config/sway/config.d/binds.conf304
1 files changed, 304 insertions, 0 deletions
diff --git a/.config/sway/config.d/binds.conf b/.config/sway/config.d/binds.conf
new file mode 100644
index 0000000..1e7c066
--- /dev/null
+++ b/.config/sway/config.d/binds.conf
@@ -0,0 +1,304 @@
+# vim: ft=i3config
+
+# Basics {{{
+bindsym --no-repeat {
+  $mod+Return exec $term
+  $mod+Shift+Return exec $floating_term
+  $mod+b exec pkill -USR1 waybar
+
+  # bindsym $mod+w exec $firefox
+  # $mod+w exec firefox --private-window
+
+  # start launcher
+  $mod+d exec menu -run
+}
+
+# kill focused window
+bindsym $mod+Shift+q kill
+
+# Drag floating windows by holding down $mod and left mouse button.
+# Resize them with right mouse button + $mod.
+# Despite the name, also works for non-floating windows.
+# Change normal to inverse to use left mouse button for resizing and right
+# mouse button for dragging.
+floating_modifier $mod normal
+
+# reload the configuration file
+bindsym $mod+Shift+c reload
+
+# exit sway (logs you out of your wayland session)
+bindsym $mod+Shift+e exec swaynag \
+    -t warning \
+    -m 'exit: what now?' \
+    -b 'exit' 'swaymsg exec -- doas s6-rc -d change desktop' \
+    -b 'restart' 'swaymsg exec -- doas s6-rc -d change desktop && sleep 0.5 && doas s6-rc -u change desktop' \
+    -b 'poweroff' 'swaymsg exec -- doas poweroff' \
+    -b 'reboot' 'swaymsg exec -- doas reboot'
+
+bindsym $mod+Shift+backspace exec lock
+
+bindsym $mod+Shift+b border toggle
+
+# rotate the screen 90 degress to read books/manga
+bindsym $mod+Shift+r mode "read"; output - transform 90 clockwise
+mode "read" {
+  bindsym Escape mode "default"; output - transform 90 anticlockwise
+  bindsym Return mode "default"; output - transform 90 anticlockwise
+}
+
+# }}}
+
+bindsym --no-repeat Print exec grimshot copy output
+bindsym $mod+Shift+s mode "screengrab"
+# {{{
+mode "screengrab" {
+  bindsym a exec grimshot save screen; mode "default"
+  bindsym o exec grimshot save output; mode "default"
+  bindsym s exec grimshot save area; mode "default"
+  bindsym w exec grimshot save win; mode "default"
+  bindsym c exec grimshot copy area; mode "default"
+  bindsym p exec colorpick; mode "default"
+
+  bindsym r exec grimshot rec win; mode "default"
+  bindsym q exec pkill -INT wf-recorder; mode "default"
+
+  bindsym m exec grimocr -m mangaocr; mode "default"
+  bindsym Shift+m exec grimocr -m tesseract; mode "default"
+
+  bindsym Escape mode "default"
+  bindsym Return mode "default"
+}
+# }}}
+
+# Move your focus around
+bindsym $mod+$left focus left
+bindsym $mod+$down focus down
+bindsym $mod+$up focus up
+bindsym $mod+$right focus right
+# or use $mod+[up|down|left|right]
+
+# _move_ the focused window with the same, but add Shift
+bindsym $mod+Shift+$left move left
+bindsym $mod+Shift+$down move down
+bindsym $mod+Shift+$up move up
+bindsym $mod+Shift+$right move right
+
+bindsym $mod+Next focus child
+bindsym $mod+Prior focus parent
+
+bindsym $mod+Delete [urgent="latest"] focus
+
+# for_window [app_id="^firefox" title="^MAIN/main"] mark browser_main
+# for_window [app_id="^firefox" title="^WORK/main"] mark browser_work
+# bindsym $mod+Semicolon [con_mark="browser_main"] focus
+# bindsym $mod+Apostrophe [con_mark="browser_work"] focus
+bindsym $mod+Semicolon [app_id="^firefox" title="^MAIN/main"] focus
+bindsym $mod+Apostrophe [app_id="^firefox" title="^WORK/main"] focus
+
+# Workspaces {{{
+# Note: workspaces can have any name you want, not just numbers.
+# We just use 1-10 as the default.
+bindsym $mod+Shift+n workspace next
+bindsym $mod+Shift+p workspace prev
+
+# switch to workspace
+bindsym $mod+1 workspace $ws1
+bindsym $mod+2 workspace $ws2
+bindsym $mod+3 workspace $ws3
+bindsym $mod+4 workspace $ws4
+bindsym $mod+5 workspace $ws5
+bindsym $mod+6 workspace $ws6
+bindsym $mod+7 workspace $ws7
+bindsym $mod+8 workspace $ws8
+bindsym $mod+9 workspace $ws9
+bindsym $mod+0 workspace $ws0
+
+bindsym $mod+Ctrl+m workspace $wsMusic
+bindsym $mod+Ctrl+v workspace $wsVideo
+bindsym $mod+Ctrl+g workspace $wsGame
+bindsym $mod+Tab workspace back_and_forth
+
+# move focused container to workspace
+bindsym $mod+Shift+1 move container to workspace $ws1
+bindsym $mod+Shift+2 move container to workspace $ws2
+bindsym $mod+Shift+3 move container to workspace $ws3
+bindsym $mod+Shift+4 move container to workspace $ws4
+bindsym $mod+Shift+5 move container to workspace $ws5
+bindsym $mod+Shift+6 move container to workspace $ws6
+bindsym $mod+Shift+7 move container to workspace $ws7
+bindsym $mod+Shift+8 move container to workspace $ws8
+bindsym $mod+Shift+9 move container to workspace $ws9
+bindsym $mod+Shift+0 move container to workspace $ws0
+
+# move focused workspce to output
+bindsym $mod+Ctrl+$left move workspace to output left
+bindsym $mod+Ctrl+$down move workspace to output down
+bindsym $mod+Ctrl+$up move workspace to output up
+bindsym $mod+Ctrl+$right move workspace to output right
+
+bindsym $mod+g mode "go"
+mode "go" {
+  bindsym 1 workspace $ws1; mode "default"
+  bindsym 2 workspace $ws2; mode "default"
+  bindsym 3 workspace $ws3; mode "default"
+  bindsym 4 workspace $ws4; mode "default"
+  bindsym 5 workspace $ws5; mode "default"
+  bindsym 6 workspace $ws6; mode "default"
+  bindsym 7 workspace $ws7; mode "default"
+  bindsym 8 workspace $ws8; mode "default"
+  bindsym 9 workspace $ws9; mode "default"
+  bindsym 0 workspace $ws0; mode "default"
+
+  bindsym m workspace $wsMusic; mode "default"
+  bindsym g workspace $wsGame; mode "default"
+  bindsym v workspace $wsVideo; mode "default"
+
+  # return to default mode
+  bindsym Return mode "default"
+  bindsym Escape mode "default"
+}
+
+# }}}
+
+bindsym $mod+Minus splitv
+bindsym $mod+Equal splith
+bindsym $mod+Shift+y layout toggle split
+
+bindsym $mod+f fullscreen
+bindsym $mod+Shift+f fullscreen global
+bindsym $mod+Shift+t bar mode toggle topbar; default_border pixel
+
+bindsym $mod+space focus mode_toggle
+bindsym $mod+Ctrl+space floating toggle
+
+bindsym $mod+y mode "layout"
+# {{{
+mode "layout" {
+    # Switch the current container between different layout styles
+    bindsym s layout stacking; mode "default"
+    bindsym w layout tabbed; mode "default"
+    bindsym e layout splitv; mode "default"
+
+    # move focus to the parent container
+    bindsym p focus parent
+    bindsym Shift+p focus child
+
+    # make a sticky container
+    bindsym t sticky toggle; mode "default"; exec notify-send sway "container pinned"
+    bindsym Shift+t \
+        floating enable; \
+        sticky enable; \
+        exec sh -c 'centercon -w 0.3 tr && swaymsg move left 10px && swaymsg move down 10px && swaymsg focus mode_toggle'; \
+        mode "default"
+
+    # return to default mode
+    bindsym Return mode "default"
+    bindsym Escape mode "default"
+}
+# }}}
+
+bindsym $mod+Ctrl+backspace move scratchpad
+bindsym $mod+backspace scratchpad show
+
+bindsym $mod+r mode "resize"
+# {{{
+mode "resize" {
+    set $rate 25
+    bindsym $left resize shrink width $rate
+    bindsym $down resize shrink height $rate
+    bindsym $up resize grow height $rate
+    bindsym $right resize grow width $rate
+
+    bindsym Shift+$down resize shrink width $rate; resize shrink height $rate
+    bindsym Shift+$up resize grow width $rate; resize grow height $rate
+
+    # make a centered container
+    bindsym c exec centercon -w 0.6; mode "default"
+    bindsym Shift+c exec centercon -w 1.0; mode "default"
+
+    # return to default mode
+    bindsym Return mode "default"
+    bindsym Escape mode "default"
+}
+# }}}
+
+bindsym $mod+Shift+g mode "gaps"
+# {{{
+mode "gaps" {
+    set $gapDefault 4
+    bindsym g gaps inner all toggle $gapDefault
+    bindsym t gaps inner all toggle $gapDefault
+    bindsym r gaps outer all set 0; gaps inner all set 0
+
+    set $gapRate 2
+    bindsym $up gaps inner all plus $gapRate
+    bindsym $down gaps inner all minus $gapRate
+
+    # return to default mode
+    bindsym Return mode "default"
+    bindsym Escape mode "default"
+}
+# }}}
+
+bindsym $mod+m mode "menu"
+# {{{
+mode "menu" {
+  bindsym a exec soundswitch; mode "default"
+  bindsym m exec mnts; mode "default"
+  bindsym n exec notifmenu; mode "default"
+  bindsym p exec secretmenu; mode "default"
+  bindsym r exec rcmenu; mode "default"
+  bindsym c exec connmenu; mode "default"
+  # bindsym x exec menu -drun; mode "default"
+  bindsym d exec swdo; mode "default"
+
+  bindsym Return mode "default"
+  bindsym Escape mode "default"
+  bindsym q mode "default"
+}
+# }}}
+
+# Misc {{{
+bindsym $mod+Shift+i exec anthywl-toggle
+# bindsym $mod+Shift+x mark --toggle "x"
+# bindsym $mod+x [con_mark="x"] focus
+# bindsym $mod+Ctrl+x swap container with mark "x"
+
+# https://whynothugo.nl/journal/2022/11/04/copying-with-super-c/
+bindsym $mod+x exec wtype -P XF86Cut
+bindsym $mod+c exec wtype -P XF86Copy
+bindsym $mod+v exec wtype -P XF86Paste
+
+# Media volume controls
+bindsym XF86AudioMute exec soundswitch -m
+#bindsym XF86AudioMicMute exec soundswitch -M
+bindsym XF86AudioLowerVolume exec soundswitch -v
+bindsym XF86AudioRaiseVolume exec soundswitch -V
+
+# Sreen brightness controls
+bindsym XF86MonBrightnessDown exec light -U 10
+bindsym XF86MonBrightnessUp exec light -A 10
+
+# Media player controls
+bindsym XF86AudioPrev exec playerctl -p playerctld previous
+bindsym XF86AudioPlay exec playerctl -p playerctld play-pause
+bindsym XF86AudioNext exec playerctl -p playerctld next
+
+# fn + f10
+bindsym XF86RFKill exec notify-send "hello from rfkill"
+# fn + f12
+bindsym XF86AudioMedia exec notify-send "hello from audio media"
+
+#bindsym XF86WakeUp exec true
+#bindsym XF86Display output eDP-1 power off; output eDP-1 power on; exec kanshictl reload
+#bindsym XF86Tools output eDP-1 power toggle
+#bindsym XF86Keyboard exec true
+#bindsym XF86Favorites exec s6-svc -r $HOME/.local/share/s6/wlsunset
+
+bindsym $mod+F1 exec notify-send "hello from F1"
+bindsym $mod+F2 exec notify-send "hello from F2"
+bindsym $mod+F3 exec notify-send "hello from F3"
+# }}}
+
+# go to sleep when lid is closed
+bindswitch --reload lid:on exec r2mem