From 1352dfdece5b2f05e0595adc73f7677331163a2e Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 22 Apr 2024 07:32:56 +0100 Subject: tidy up .config/sway/config --- .config/sway/config | 449 ++++++++++++++++++++++------------------------------ 1 file changed, 190 insertions(+), 259 deletions(-) diff --git a/.config/sway/config b/.config/sway/config index dbd62231..819a5c3b 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -11,10 +11,16 @@ client.placeholder #000000 #000000 #FFFFF6 #AA9E9F #AA9E9F client.background #FFFFF6 -# Use Mouse+Mod4 to drag floating windows to their wanted position floating_modifier Mod4 - mouse_warping output +focus_wrapping no +popup_during_fullscreen leave_fullscreen + +input type:keyboard repeat_rate 25 +input type:keyboard repeat_delay 380 +seat * hide_cursor 5000 + +output * bg ~/src/dotfiles/lib-src/img/green_gobbler.png tile # Key binding strategy: # @@ -32,228 +38,179 @@ mouse_warping output # than one keypress with the other hand, which is worth avoiding. mode "C-i-" { - # make a fresh Emacs frame -- typically this gets invoked only on - # empty workspaces, as otherwise I use commands under `C-x 5` to get - # more Emacs frames bindsym e exec emacsclient -ncw15, mode "default" + bindsym BackSpace exec foot, mode "default" + bindsym b exec firefox -new-window, mode "default" # override the script's usual logic to start a fresh, non-debug daemon bindsym Ctrl+Mod1+e exec emacsclient -ncw8 --spw/installed, \ mode "default" - # special daemon instance for debugging primary instance & Gnus + # special daemon instance for debugging primary instance and for Gnus bindsym r exec emacsclient -ncw8 -sgdbmacs, mode "default" # Fresh Emacs frame and get a shell in HOME. Without this it's - # C-i e M-& which is too many keys esp. compared to C-i DEL - bindsym Return exec emacsclient -ncw15 -e \ + # C-i e M-& which is too many keys esp. compared to C-i DEL. + bindsym Return exec emacsclient -ncw15 -e \ "(let ((default-directory (expand-file-name "'"'~/'"'")) \ - (display-buffer-overriding-action \ - '(display-buffer-same-window \ - . ((inhibit-same-window . nil))))) \ - (transient-cycles-cmd-spw/eshell-jump-from-here))", \ + (display-buffer-overriding-action \ + '(display-buffer-same-window \ + . ((inhibit-same-window . nil))))) \ + (transient-cycles-cmd-spw/eshell-jump-from-here))", \ mode "default" - # start a terminal emulator - bindsym BackSpace exec foot, mode "default" - - # make a fresh browser window - bindsym b exec firefox -new-window, mode "default" - - # lock screen -- relies on swayidle - # note that this won't lock other VTs (lock-session*s* - # requires root password) - bindsym l exec loginctl lock-session, mode "default" - - # go to sleep -- swayidle will lock screen - bindsym --locked Ctrl+l exec systemctl suspend, mode "default" - - # kill focused window - bindsym k kill, mode "default" - - # sway sample config says to pipe dmenu into `xargs swaymsg exec --` - # but doesn't seem necessary with wofi - - bindsym p exec wofi --show=drun -i, mode "default" - - bindsym Ctrl+p exec wofi --show=run -i, mode "default" + # lock screen, go to sleep -- these rely on swayidle + # note that this won't lock other VTs (lock-sessions requires root pw) + bindsym l exec loginctl lock-session, mode "default" + bindsym --locked Ctrl+l exec systemctl suspend, mode "default" + bindsym p exec wofi --show=drun -i, mode "default" bindsym s exec ~/src/dotfiles/scripts/desktop/wofi_ssh, mode "default" - bindsym Mod1+g exec makoctl dismiss --all, mode "default" - # enter fullscreen mode for the focused container - bindsym f fullscreen toggle, mode "default" - - # toggle tiling / floating - bindsym t floating toggle, mode "default" - - # change focus between tiling / floating windows - bindsym Tab focus mode_toggle, mode "default" - - # # when screen is divided into two containers where at least one might - # # have several tabs, as I usually have it, this works well to go back - # # and forth - # bindsym o focus_wrapping workspace, focus parent, focus right, \ - # focus_wrapping yes, mode "default" + bindsym t floating toggle, mode "default" + bindsym Tab focus mode_toggle, mode "default" bindsym o exec papersway-msg other column, mode "default" - - # switch to workspace - bindsym 1 workspace 1, mode "default" - bindsym 2 workspace 2, mode "default" - bindsym 3 workspace 3, mode "default" - bindsym 4 workspace 4, mode "default" - bindsym 5 workspace 5, mode "default" - bindsym 6 workspace 6, mode "default" - bindsym 7 workspace 7, mode "default" - bindsym 8 workspace 8, mode "default" - bindsym 9 workspace 9, mode "default" - bindsym 0 workspace 10, mode "default" - bindsym F1 workspace 11:F1, mode "default" - bindsym F2 workspace 12:F2, mode "default" - bindsym F3 workspace 13:F3, mode "default" - bindsym F4 workspace 14:F4, mode "default" - bindsym F5 workspace 15:F5, mode "default" - bindsym F6 workspace 16:F6, mode "default" - bindsym F7 workspace 17:F7, mode "default" - bindsym F8 workspace 18:F8, mode "default" - bindsym F9 workspace 19:F9, mode "default" - bindsym F10 workspace 20:F10, mode "default" - bindsym F11 workspace 21:F11, mode "default" - bindsym F12 workspace 22:F12, mode "default" - bindsym semicolon workspace back_and_forth, mode "default" - - # move focused container to workspace - bindsym Mod1+1 move container to workspace 1, mode "default" - bindsym Mod1+2 move container to workspace 2, mode "default" - bindsym Mod1+3 move container to workspace 3, mode "default" - bindsym Mod1+4 move container to workspace 4, mode "default" - bindsym Mod1+5 move container to workspace 5, mode "default" - bindsym Mod1+6 move container to workspace 6, mode "default" - bindsym Mod1+7 move container to workspace 7, mode "default" - bindsym Mod1+8 move container to workspace 8, mode "default" - bindsym Mod1+9 move container to workspace 9, mode "default" - bindsym Mod1+0 move container to workspace 10, mode "default" - bindsym Mod1+F1 move container to workspace 11:F1, mode "default" - bindsym Mod1+F2 move container to workspace 12:F2, mode "default" - bindsym Mod1+F3 move container to workspace 13:F3, mode "default" - bindsym Mod1+F4 move container to workspace 14:F4, mode "default" - bindsym Mod1+F5 move container to workspace 15:F5, mode "default" - bindsym Mod1+F6 move container to workspace 16:F6, mode "default" - bindsym Mod1+F7 move container to workspace 17:F7, mode "default" - bindsym Mod1+F8 move container to workspace 18:F8, mode "default" - bindsym Mod1+F9 move container to workspace 19:F9, mode "default" - bindsym Mod1+F10 move container to workspace 20:F10, mode "default" - bindsym Mod1+F11 move container to workspace 21:F11, mode "default" - bindsym Mod1+F12 move container to workspace 22:F12, mode "default" - bindsym Mod1+semicolon move container to workspace back_and_forth, \ - mode "default" - bindsym Mod1+Ctrl+semicolon move container to workspace back_and_forth, \ - workspace back_and_forth, mode "default" - - # next unused workspace - bindsym j exec papersway-msg fresh-workspace, mode "default" - # sends window to next unused but doesn't change view - bindsym Mod1+j exec papersway-msg fresh-workspace send, mode "default" - # sends window to next unused and changes view - bindsym Mod1+Ctrl+j exec \ - papersway-msg fresh-workspace take, mode "default" + # Pre-papersway version: was useful as I'd typically have two columns + # with at least one containing several tabs. + # bindsym o focus_wrapping workspace, focus parent, focus right, \ + # focus_wrapping yes, mode "default" + + bindsym 1 workspace 1, mode "default" + bindsym 2 workspace 2, mode "default" + bindsym 3 workspace 3, mode "default" + bindsym 4 workspace 4, mode "default" + bindsym 5 workspace 5, mode "default" + bindsym 6 workspace 6, mode "default" + bindsym 7 workspace 7, mode "default" + bindsym 8 workspace 8, mode "default" + bindsym 9 workspace 9, mode "default" + bindsym 0 workspace 10, mode "default" + bindsym F1 workspace 11:F1, mode "default" + bindsym F2 workspace 12:F2, mode "default" + bindsym F3 workspace 13:F3, mode "default" + bindsym F4 workspace 14:F4, mode "default" + bindsym F5 workspace 15:F5, mode "default" + bindsym F6 workspace 16:F6, mode "default" + bindsym F7 workspace 17:F7, mode "default" + bindsym F8 workspace 18:F8, mode "default" + bindsym F9 workspace 19:F9, mode "default" + bindsym F10 workspace 20:F10, mode "default" + bindsym F11 workspace 21:F11, mode "default" + bindsym F12 workspace 22:F12, mode "default" + bindsym semicolon workspace back_and_forth, mode "default" + + bindsym Mod1+1 move container to workspace 1, mode "default" + bindsym Mod1+2 move container to workspace 2, mode "default" + bindsym Mod1+3 move container to workspace 3, mode "default" + bindsym Mod1+4 move container to workspace 4, mode "default" + bindsym Mod1+5 move container to workspace 5, mode "default" + bindsym Mod1+6 move container to workspace 6, mode "default" + bindsym Mod1+7 move container to workspace 7, mode "default" + bindsym Mod1+8 move container to workspace 8, mode "default" + bindsym Mod1+9 move container to workspace 9, mode "default" + bindsym Mod1+0 move container to workspace 10, mode "default" + bindsym Mod1+F1 move container to workspace 11:F1, mode "default" + bindsym Mod1+F2 move container to workspace 12:F2, mode "default" + bindsym Mod1+F3 move container to workspace 13:F3, mode "default" + bindsym Mod1+F4 move container to workspace 14:F4, mode "default" + bindsym Mod1+F5 move container to workspace 15:F5, mode "default" + bindsym Mod1+F6 move container to workspace 16:F6, mode "default" + bindsym Mod1+F7 move container to workspace 17:F7, mode "default" + bindsym Mod1+F8 move container to workspace 18:F8, mode "default" + bindsym Mod1+F9 move container to workspace 19:F9, mode "default" + bindsym Mod1+F10 move container to workspace 20:F10, mode "default" + bindsym Mod1+F11 move container to workspace 21:F11, mode "default" + bindsym Mod1+F12 move container to workspace 22:F12, mode "default" + bindsym Mod1+semicolon \ + move container to workspace back_and_forth, mode "default" + bindsym Mod1+Ctrl+semicolon \ + move container to workspace back_and_forth, \ + workspace back_and_forth, mode "default" + + bindsym j exec papersway-msg fresh-workspace, mode "default" + bindsym Mod1+j exec papersway-msg fresh-workspace send, mode "default" + bindsym Mod1+Ctrl+j \ + exec papersway-msg fresh-workspace take, mode "default" bindsym comma exec papersway-msg absorb_expel left, mode "default" bindsym period exec papersway-msg absorb_expel right, mode "default" - # reload the configuration file - bindsym Ctrl+Mod1+c reload, mode "default" - # exit i3 (logs you out of your X session) - bindsym Ctrl+Mod1+Shift+e exit - - bindsym g mode "C-i g-" - - # bindsym bracketleft exec debian-ftp-master-cut-note, mode "default" - # bindsym Ctrl+bracketleft exec xdo-evince-highlight, mode "default" - - # Workspaces do not ever get assigned to particular purposes / windows - # don't get assigned to particular workspaces. If I can't find where - # I was working on something, there's my bindings to `workspace - # {next,prev}_on_output`. Long-running processes like builds, for - # example, stay in the workspace(s) where I'm working on that - # task/project - # - # Previously I thought that instead of having them on a dedicated - # workspace, windows that are almost always open should be put on the - # scratcpad: - # - # Note that we have to move to scratchpad at startup ('move to - # scratchpad' below), or the toggle key won't work. - # - # Once every so often I'll have to launch the program, and then - # immediately use the toggle key to make it visible. This is a - # bit inelegant, but much more reliable than binding the key to a - # script which starts the program if it's not around and otherwise - # toggles + bindsym Ctrl+Mod1+c reload, mode "default" + bindsym Ctrl+Mod1+Shift+e exit + + # Workspaces do not ever get assigned to particular purposes / windows + # don't get assigned to particular workspaces. If I can't find where + # I was working on something, there's my bindings to `workspace + # {next,prev}_on_output`. Long-running processes like builds, for + # example, stay in the workspace(s) where I'm working on that + # task/project + # + # Previously I thought that instead of having them on a dedicated + # workspace, windows that are almost always open should be put on the + # scratcpad: + # + # Note that we have to move to scratchpad at startup ('move to + # scratchpad' below), or the toggle key won't work. + # + # Once every so often I'll have to launch the program, and then + # immediately use the toggle key to make it visible. This is a + # bit inelegant, but much more reliable than binding the key to a + # script which starts the program if it's not around and otherwise + # toggles # # However, I now think that scratchpad windows are unwieldy for # various reasons, so just having them as regular windows with - # shortcuts to get back to them is better. - - bindsym n exec swaymsg '[title="\[mosh\] tmux default on athena"]' focus \ - || foot ssh-and-tmux athena.silentflame.com, mode "default" + # shortcuts to get back to them [all gone since papersway] is better. bindsym c [con_mark=caffeinated] inhibit_idle none; \ - inhibit_idle open, mark caffeinated; mode "default" + inhibit_idle open, mark caffeinated; mode "default" bindsym Ctrl+c [con_mark=caffeinated] inhibit_idle none, \ mark --toggle caffeinated; mode "default" - # # The two % values are for melete. Cf. `spw/maybe-scale-basic-faces'. - # # - # # This says: shrink such that an Emacs frame taking up the rest of the - # # width can fit two 80-column windows, with Debian's fonts-hack at - # # height 105. So should be <33. Sometimes we'll be able to fit an - # # 80-column frame in the smaller part of the split, but usually we - # # won't: the point is to ensure we can use Emacs with two 80-column - # # windows, as is usual, while also displaying something narrower. + # The two % values are for melete. Cf. `spw/maybe-scale-basic-faces'. + + # This says: shrink such that an Emacs frame taking up the rest of the + # width can fit two 80-column windows, with Debian's fonts-hack at + # height 105. So should be <33. Sometimes we'll be able to fit an + # 80-column frame in the smaller part of the split, but usually we + # won't: the point is to ensure we can use Emacs with two 80-column + # windows, as is usual, while also displaying something narrower. # bindsym minus resize set width 31 ppt, mode "default" - # # And this says: ensure that the current window can be an Emacs frame - # # with at least 80 columns. Based on Debian's fonts-hack scaled up to - # # height 120 by `spw/maybe-scale-basic-faces'. + + # And this says: ensure that the current window can be an Emacs frame + # with at least 80 columns. Based on Debian's fonts-hack scaled up to + # height 120 by `spw/maybe-scale-basic-faces'. # bindsym equal resize set width 43 ppt, mode "default" bindsym minus exec papersway-msg cols decr, mode "default" bindsym equal exec papersway-msg cols incr, mode "default" - bindsym Ctrl+y exec ~/src/dotfiles/scripts/desktop/sway-ftp-master-cut-note , mode "default" + bindsym Ctrl+y exec \ + ~/src/dotfiles/scripts/desktop/sway-ftp-master-cut-note, \ + mode "default" - bindsym --locked Ctrl+g mode "default" + bindsym g mode "C-i g-" + bindsym --locked Ctrl+g mode "default" } bindsym --locked Ctrl+i mode "C-i-" -for_window [con_mark=caffeinated] inhibit_idle open - -for_window [title="ftp-master GNU mc session"] mark mc -for_window [title="ftp-master dak command session"] mark dak - -focus_wrapping no - -# change focus -bindsym Ctrl+7 exec papersway-msg focus left \ - || swaymsg focus left -bindsym Ctrl+0 exec papersway-msg focus right \ - || swaymsg focus right -bindsym Ctrl+8 focus down -bindsym Ctrl+9 focus up - -# move focused window -bindsym Mod1+Ctrl+7 exec papersway-msg move left || swaymsg move left -bindsym Mod1+Ctrl+0 exec papersway-msg move right || swaymsg move right -bindsym Mod1+Ctrl+8 move down -bindsym Mod1+Ctrl+9 move up - -bindsym Ctrl+5 kill -bindsym Ctrl+6 exec papersway-msg monocle toggle +# launchers +mode "C-i g-" { + bindsym g exec thunar, mode "default" + bindsym y exec foot yapet, mode "default" + bindsym w exec \ + ~/src/dotfiles/scripts/desktop/whitenoise , mode "default" + bindsym f exec \ + ~/src/dotfiles/scripts/desktop/sway-ftp-master, mode "default" + bindsym s mode "default", \ + exec grim -c ~/tmp/$(hostname -s)_$(date +%F_%H.%M.%S).png + bindsym x exec wdisplays, mode "default" -# bindsym Ctrl+apostrophe layout toggle splith splitv tabbed + bindsym Ctrl+g mode "default" +} # Cycle through all workspaces. # Warp the cursor to a point on the screen which is hopefully a titlebar. @@ -261,107 +218,81 @@ bindsym Ctrl+6 exec papersway-msg monocle toggle # e.g., a VNC client has grabbed the keyboard upon entry to the workspace. bindsym Ctrl+1 seat - cursor set 0 0, exec papersway-msg workspace prev bindsym Ctrl+4 seat - cursor set 0 0, exec papersway-msg workspace next -bindsym Mod1+Ctrl+1 seat - cursor set 0 0, exec \ - papersway-msg move_workspace prev -bindsym Mod1+Ctrl+4 seat - cursor set 0 0, exec \ - papersway-msg move_workspace next +bindsym Mod1+Ctrl+1 seat - cursor set 0 0, \ + exec papersway-msg move_workspace prev +bindsym Mod1+Ctrl+4 seat - cursor set 0 0, \ + exec papersway-msg move_workspace next bindsym Ctrl+2 focus output left bindsym Mod1+Ctrl+2 move workspace to output left bindsym Ctrl+3 focus output right bindsym Mod1+Ctrl+3 move workspace to output right -# Start swaybar to display a workspace bar (plus the system information -# i3status finds out, if available) -bar { - # i3status is designed to be highly performant so it continues - # to be refreshed when the system is under load; we're giving - # up some of that with papersway, but let's see if it - # actually matters - status_command papersway --i3status - - # default behaviour is to cycle through workspaces when scroll - # wheel is used on the bar. However, don't think I've ever - # used this deliberately, and often I do it by mistake, so - # let's disable it - bindsym button4 nop - bindsym button5 nop - - colors { - background #E5E5E5 - focused_background #FFFFF6 - statusline #000000 - separator #000000 - - focused_workspace #000000 #B4EEB4 #000000 - active_workspace #000000 #FFFFF6 #000000 - inactive_workspace #000000 #E5E5E5 #000000 - urgent_workspace #000000 #702020 #FFFFF6 - binding_mode #000000 #EECD82 #000000 - } - - # Leave papersway to disable the workspace buttons once it has started - # handling workspaces. - - position bottom - strip_workspace_numbers yes - status_edge_padding 11 - tray_padding 0 - - workspace_min_width 50 -} +bindsym Ctrl+5 kill +bindsym Ctrl+6 exec papersway-msg monocle toggle -# single key launching -mode "C-i g-" { - # start a graphical file manager - bindsym g exec thunar , mode "default" +bindsym Ctrl+7 exec papersway-msg focus left +bindsym Ctrl+8 focus down +bindsym Ctrl+9 focus up +bindsym Ctrl+0 exec papersway-msg focus right - # open virt-viewer pointed at develacc - bindsym d exec develacc-please , mode "default" +bindsym Mod1+Ctrl+7 exec papersway-msg move left +bindsym Mod1+Ctrl+8 move down +bindsym Mod1+Ctrl+9 move up +bindsym Mod1+Ctrl+0 exec papersway-msg move right - bindsym y exec foot yapet , mode "default" - bindsym w exec ~/src/dotfiles/scripts/desktop/whitenoise , mode "default" +bindsym --locked XF86AudioRaiseVolume \ + exec pactl set-sink-volume @DEFAULT_SINK@ +5% +bindsym --locked XF86AudioLowerVolume \ + exec pactl set-sink-volume @DEFAULT_SINK@ -5% +bindsym --locked XF86AudioMute \ + exec pactl set-sink-mute @DEFAULT_SINK@ toggle - # connect to Debian's ftp-master server for ftpteam work - bindsym f exec ~/src/dotfiles/scripts/desktop/sway-ftp-master , mode "default" +bindsym --locked XF86MonBrightnessUp exec brightnessctl set +10% +bindsym --locked XF86MonBrightnessDown exec brightnessctl set 10%- - bindsym s mode "default", \ - exec grim -c ~/tmp/$(hostname -s)_$(date +%F_%H.%M.%S).png +bar { + status_command papersway --i3status - bindsym x exec wdisplays , mode "default" + # Avoid accidentally scrolling through workspaces. + bindsym button4 nop + bindsym button5 nop - bindsym Ctrl+g mode "default" + colors { + background #E5E5E5 + focused_background #FFFFF6 + statusline #000000 + separator #000000 + + focused_workspace #000000 #B4EEB4 #000000 + active_workspace #000000 #FFFFF6 #000000 + inactive_workspace #000000 #E5E5E5 #000000 + urgent_workspace #000000 #702020 #FFFFF6 + binding_mode #000000 #EECD82 #000000 + } + + # Leave papersway to disable the ws buttons once it has started. + position bottom + strip_workspace_numbers yes + status_edge_padding 11 + tray_padding 0 + workspace_min_width 50 } -bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% -bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% -bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle - -bindsym --locked XF86MonBrightnessUp exec brightnessctl set +10% -bindsym --locked XF86MonBrightnessDown exec brightnessctl set 10%- - -popup_during_fullscreen leave_fullscreen - -# windows that should always float for_window [title="^Ediff"] floating enable no_focus [title="Firefox . Sharing Indicator"] -for_window [title="Firefox . Sharing Indicator"] floating enable, \ - move position 0 0 - -input type:keyboard repeat_rate 25 -input type:keyboard repeat_delay 380 - -seat * hide_cursor 5000 +for_window [title="Firefox . Sharing Indicator"] \ + floating enable, move position 0 0 +for_window [con_mark=caffeinated] inhibit_idle open +for_window [title="ftp-master GNU mc session"] mark mc +for_window [title="ftp-master dak command session"] mark dak exec mako exec swayidle -w exec emacsclient --spw/update-environment exec emacsclient -sgdbmacs --spw/no-start --spw/update-environment - exec_always fcitx5 -d --replace exec blueman-applet exec nm-applet --indicator -output * bg ~/src/dotfiles/lib-src/img/green_gobbler.png tile - include ~/.config/sway/$(hostname)/* -- cgit v1.2.3