sway-docs/docs/index.md
2025-02-24 15:23:59 -05:00

8.4 KiB
Raw Permalink Blame History

Sway Keyboard Shortcuts

This document outlines the keyboard shortcuts configured for my Sway window manager setup, as defined in ~/.config/sway/config. Sway is a tiling Wayland compositor, and this configuration uses the Windows (Super) key as the primary modifier ($mod set to Mod4). The shortcuts are tailored to my workflow, with custom bindings for navigation, window management, and system controls.

The configuration uses Vim-inspired home row keys (h, j, k, l) for movement, and includes unique bindings like $mod+Shift+x for forcefully killing a focused process. See the sections below for details.

Key Bindings

Below is a comprehensive list of keyboard shortcuts. The Super key (referred to as $mod) is the primary modifier unless otherwise noted.

Shortcut Action Notes
Super + Return Open terminal (kitty) Launches my preferred terminal emulator.
Super + Shift + q Kill focused window Closes the currently focused window.
Super + d Open application launcher (wofi) Displays a minimal launcher with 5 lines.
Super + Shift + c Reload Sway configuration Reloads the config file without restarting Sway.
Super + Shift + e Exit Sway with confirmation Prompts to confirm logout of the Wayland session.
Super + h/j/k/l Focus left/down/up/right Vim-inspired navigation for moving focus between windows.
Super + Left/Down/Up/Right Focus left/down/up/right Alternative arrow key bindings for focus movement.
Super + Shift + h/j/k/l Move window left/down/up/right Moves the focused window in the specified direction.
Super + Shift + Left/Down/Up/Right Move window left/down/up/right Arrow key alternative for window movement.
Super + 1-0 Switch to workspace 1-10 Number keys select workspaces.
Super + Shift + 1-0 Move container to workspace 1-10 Moves the focused window to the specified workspace.
Super + b Split container horizontally Also bound to Super + h for convenience.
Super + v Split container vertically Creates a vertical split for the focused container.
Super + s Set layout to stacking Switches to stacking layout mode.
Super + w Set layout to tabbed Switches to tabbed layout mode (default for new workspaces).
Super + e Toggle split layout Toggles between horizontal and vertical split layouts.
Super + f Toggle fullscreen Makes the focused window fullscreen.
Super + Shift + Space Toggle floating mode Switches the focused window between tiling and floating.
Super + Space Swap focus between tiling/floating Toggles focus between tiling and floating areas.
Super + a Focus parent container Moves focus to the parent container of the current window.
Super + Shift + minus Move window to scratchpad Sends the focused window to the scratchpad.
Super + minus Show/hide scratchpad window Cycles through scratchpad windows or hides the current one.
Super + Shift + s Toggle sticky mode Makes the focused window sticky (stays visible across workspaces).
Super + Shift + x Force kill focused process (kill -9) Custom binding to terminate the focused windows process forcefully.
Super + Shift + p Suspend system Puts the system into suspend mode (locked).
Super + Shift + u Move workspace to DP-3 output Moves the current workspace to the DP-3 display.
Super + Shift + o Lock screen (run_swaylock) Runs a custom lock script located at ~/bin/run_swaylock.
Super + Shift + r Turn all outputs on (DPMS on) Forces all displays to wake up.
Super + Shift + f Turn all outputs off (DPMS off) Turns off all displays (power saving).
Super + c Open Qalculate calculator Launches the qalculate-gtk application (floating).
Super + p Open Pavucontrol Launches the pavucontrol audio mixer (floating).
Super + r Enter resize mode Activates resize mode (see below for controls).
XF86AudioRaiseVolume Increase volume (+10%) Adjusts volume and displays it via wob.
XF86AudioLowerVolume Decrease volume (-10%) Adjusts volume and displays it via wob.
XF86AudioMute Toggle mute Mutes/unmutes the default sink, updates wob.
XF86AudioMicMute Toggle microphone mute Mutes/unmutes the default audio source.
XF86MonBrightnessUp Increase brightness (+5%) Adjusts screen brightness and shows level via wob.
XF86MonBrightnessDown Decrease brightness (-5%) Adjusts screen brightness and shows level via wob.
XF86Display Toggle display configuration Runs a custom script (~/src/screen-change/toggle.py).

Resize Mode

When in resize mode (Super + r), the following bindings are active:

Shortcut Action
h / Left Shrink width by 10px
j / Down Grow height by 10px
k / Up Shrink height by 10px
l / Right Grow width by 10px
Return Exit resize mode
Escape Exit resize mode

Custom Configuration Highlights

  • Modifier Key: The $mod key is set to Mod4 (Super/Windows key), aligning with a modern workflow.
  • Vim-Inspired Navigation: Movement keys (h, j, k, l) replace traditional arrow keys for focus and window movement, reflecting my preference for Vim-style controls.
  • Force Kill Binding: Super + Shift + x is a standout custom binding that uses swaymsg and jq to identify and terminate the focused windows process with kill -9. This is particularly useful for unresponsive applications.
  • Display and Power Management: Shortcuts like Super + Shift + r (DPMS on) and Super + Shift + f (DPMS off) provide quick control over display power states.
  • Audio and Brightness: Media keys integrate with pactl and brightnessctl, piping feedback to wob for an on-screen overlay, enhancing usability.
  • Workspace Layout: The default workspace layout is tabbed, which differs from Sways typical tiling default, reflecting my preference for tabbed browsing-like behavior.

Additional Notes

  • Floating Windows: Specific applications (e.g., pavucontrol, qalculate-gtk) are set to float by default with a 4px border for better usability.
  • Idle Behavior: After 300 seconds of inactivity, the screen locks with run_swaylock. After 600 seconds, displays turn off (DPMS off), resuming when activity is detected.
  • Font: The UI uses DejaVu Sans Mono 11 for a clean, monospaced look.

For further details, refer to the full configuration file at ~/.config/sway/config.