Skip to content

Sway Dispatcher

Almarhoon Ibraheem edited this page Jan 28, 2025 · 8 revisions

The swayipc dispatcher module offers a range of functions designed for sending commands to Sway. This module leverages the Sway IPC protocol to facilitate tasks such as focusing workspaces, switching active outputs, updating monitors, and performing other operations.

Note: Ensure that you open a sway socket connection before sending any queries or commands to sway by calling the function sway-connect-sockets! immediately after the imports so the socket becomes available to the rest of expressions.

(use-modules (oop goops)
             (srfi srfi-18)
             (guile-swayer modules workspace-groups)
             (guile-swayer modules workspace-grid)
             (ice-9 pretty-print)
             (guile-swayer swayipc connection)
             (guile-swayer swayipc records)
             (guile-swayer swayipc info)
             (guile-swayer swayipc events)
             (guile-swayer swayipc dispatcher))

  (sway-connect-sockets!)

  ;; your code here
  (sway-default-orientation SWAY-ORIENTATION-HORIZONTAL)

sway-default-orientation

  • Description: Sets the default container layout for tiled containers.
  • Parameters:
    • orientation: SWAY-ORIENTATION-HORIZONTAL, SWAY-ORIENTATION-VERTICAL, SWAY-ORIENTATION-AUTO
  • Example
(sway-default-orientation SWAY-ORIENTATION-HORIZONTAL)

sway-include

  • Description: Includes another configuration file from path (not scheme file).
  • Parameters:
    • file-path: string
  • Example
(sway-include "/path/to/config/file.conf")

sway-swaybg-command

  • Description: Executes custom background command. Default is swaybg.
  • Parameters:
    • command: string
  • Example
(sway-swaybg-command "custom_bg_command")

sway-swaynag-command

  • Description: Executes custom command for swaynag. Default is swaynag.
  • Parameters:
    • command: string
  • Example
(sway-swaynag-command "custom_nag_command")

sway-workspace-layout

  • Description: Specifies the initial layout for new containers in an empty workspace.
  • Parameters:
    • layout: SWAY-LAYOUT-DEFAULT, SWAY-LAYOUT-STACKING, SWAY-LAYOUT-TABBED
  • Example
(sway-workspace-layout SWAY-LAYOUT-TABBED)

sway-xwayland

  • Description: Enables or disables Xwayland support, which allows X11 applications to be used.
  • Parameters:
    • option: SWAY-XWAYLAND-ENABLE, SWAY-XWAYLAND-DISABLE, SWAY-XWAYLAND-FORCE
  • Example
(sway-xwayland SWAY-XWAYLAND-ENABLE)

sway-border

  • Description: Enables or disables Xwayland support, which allows X11 applications to be used.
  • Parameters:
    • option: SWAY-BORDER-NONE, SWAY-BORDER-NORMAL, SWAY-BORDER-CSD, SWAY-BORDER-PIXEL
    • thickness: int
  • Example
(sway-border SWAY-BORDER-NORMAL 2)

sway-border-toggle

  • Description: Cycles through the available border styles.
  • Example
(sway-border-toggle)

sway-exit

  • Description: Exit sway and end your Wayland session.
  • Example
(sway-exit)

sway-floating

  • Description: Make focused view floating, non-floating, or the opposite of what it is now.
  • Parameters:
    • layout: SWAY-FLOATING-ENABLED, SWAY-FLOATING-DISABLED, SWAY-FLOATING-TOGGLE
  • Example
(sway-floating SWAY-FLOATING-ENABLED)

sway-focus-container-criteria

  • Description: Moves focus to the container that matches the specified criteria.
  • Parameters:
    • criteria: A criteria string, use (sway-criteria) to build one.
  • Example
(sway-focus-container-criteria (sway-criteria #:title "Firefox"))

sway-focus-container

  • Description: Moves focus to the next container in the specified direction.
  • Parameters:
    • direction: SWAY-DIRECTION-UP, SWAY-DIRECTION-RIGHT, SWAY-DIRECTION-DOWN, SWAY-DIRECTION-LEFT
  • Example
(sway-focus-container SWAY-DIRECTION-RIGHT)

sway-focus-container-sibling

  • Description: Moves focus to the previous or next container in the current layout.
  • Parameters:
    • sibling: SWAY-SIBLING-NEXT, SWAY-SIBLING-PREV
  • Example
(sway-focus-container-sibling SWAY-SIBLING-NEXT)

sway-focus-container-child

  • Description: Moves focus to the last-focused child of the focused container.
  • Example
(sway-focus-container-child)

sway-focus-container-parent

  • Description: Moves focus to the last-focused parent of the focused container.
  • Example
(sway-focus-container-parent)

sway-focus-output-direction

  • Description: Moves focus to the next output in the specified direction.
  • Parameters:
    • direction: SWAY-DIRECTION-UP, SWAY-DIRECTION-RIGHT, SWAY-DIRECTION-DOWN, SWAY-DIRECTION-LEFT
  • Example
(sway-focus-output-direction SWAY-DIRECTION-UP)

sway-focus-output-name

  • Description: Moves focus to the named output.
  • Parameters:
    • name: string, output name
  • Example
(sway-focus-output-name "HDMI-A-1")

sway-focus-container-tiling

  • Description: Sets focus to the last focused tiling container.
  • Example
(sway-focus-container-tiling)

sway-focus-container-floating

  • Description: Sets focus to the last focused floating container.
  • Example
(sway-focus-container-floating)

sway-fullscreen

  • Description: Makes focused view fullscreen, non-fullscreen, or the opposite of current.
  • Parameters:
    • option: SWAY-FULLSCREEN-ENABLED, SWAY-FULLSCREEN-DISABLED, SWAY-FULLSCREEN-TOGGLE
    • global: #t, #f
  • Example
(sway-fullscreen SWAY-FULLSCREEN-TOGGLE #:global #t)

sway-gaps

  • Description: Changes the inner or outer gaps for either all workspaces or the current workspace.
  • Parameters:
    • option: SWAY-GAPS-OPTION-INNER, SWAY-GAPS-OPTION-OUTER, SWAY-GAPS-OPTION-HORIZONTAL, SWAY-GAPS-OPTION-VERTICAL, SWAY-GAPS-OPTION-TOP, SWAY-GAPS-OPTION-RIGHT, SWAY-GAPS-OPTION-BOTTOM, SWAY-GAPS-OPTION-LEFT
    • workspace: SWAY-GAPS-WORKSPACE-ALL, SWAY-GAPS-WORKSPACE-CURRENT,
    • type: SWAY-GAPS-TYPE-SET, SWAY-GAPS-TYPE-PLUS, SWAY-GAPS-TYPE-MINUS, SWAY-GAPS-TYPE-TOGGLE
    • amount: amount of gap (number)
  • Example
(sway-gaps SWAY-GAPS-OPTION-INNER SWAY-GAPS-WORKSPACE-ALL SWAY-GAPS-TYPE-SET 10)

sway-inhibit-idle

  • Description: Set/unset an idle inhibitor for the view.
  • Parameters:
    • option: SWAY-INHIBIT-IDLE-FOCUS, SWAY-INHIBIT-IDLE-FULLSCREEN, SWAY-INHIBIT-IDLE-OPEN, SWAY-INHIBIT-IDLE-NONE, SWAY-INHIBIT-IDLE-VISIBLE
  • Example
(sway-inhibit-idle SWAY-INHIBIT-IDLE-FOCUS)

sway-layout

  • Description: Set/unset an idle inhibitor for the view.
  • Parameters:
    • option: SWAY-LAYOUT-DEFAULT, SWAY-LAYOUT-SPLITH, SWAY-LAYOUT-SPLITV, SWAY-LAYOUT-STACKING, SWAY-LAYOUT-TABBED
  • Example
(sway-layout SWAY-LAYOUT-SPLITH)

sway-layout-toggle

  • Description: Cycles the layout mode of the focused container though a preset list of layouts.
  • Parameters:
    • option: SWAY-LAYOUT-TOGGLE-ALL, SWAY-LAYOUT-TOGGLE-SPLIT
  • Example
(sway-layout-toggle #:option SWAY-LAYOUT-TOGGLE-ALL)

sway-move-container

  • Description: Moves the focused container in the direction specified.
  • Parameters:
    • direction: SWAY-DIRECTION-UP, SWAY-DIRECTION-RIGHT, SWAY-DIRECTION-DOWN, SWAY-DIRECTION-LEFT
    • amount: int
  • Example
(sway-move-container SWAY-DIRECTION-RIGHT #:amount 50)

sway-move-container-absolute-position

  • Description: Moves the focused container to the specified position in the workspace.
  • Parameters:
    • x: int
    • y: int
  • Example
(sway-move-container-absolute-position 100 100)

sway-move-container-absolute-center

  • Description: Moves the focused container to be centered on the workspace.
  • Example
(sway-move-container-absolute-center)

sway-move-container-cursor

  • Description: Moves the focused container to be centered on the cursor.
  • Example
(sway-move-container-cursor)

sway-move-container-to-mark

  • Description: Moves the focused container to the specified mark.
  • Parameters:
    • mark: string
  • Example
(sway-move-container-to-mark "my_mark")

sway-move-container-to-workspace

  • Description: Moves the focused container to the workspace name
  • Parameters:
    • workspace: workspace name, SWAY-WORKSPACE-PREVIOUS, SWAY-WORKSPACE-NEXT
  • Example
(sway-move-container-to-workspace SWAY-WORKSPACE-PREVIOUS)

sway-move-container-to-output

  • Description: Moves the focused container to the output in the specified direction.
  • Parameters:
    • direction: SWAY-DIRECTION-UP, SWAY-DIRECTION-RIGHT, SWAY-DIRECTION-DOWN, SWAY-DIRECTION-LEFT
  • Example
(sway-move-container-to-output SWAY-DIRECTION-UP)

sway-move-container-to-scratchpad

  • Description: Moves the focused container to the scratchpad.
  • Parameters: None
  • Example
(sway-move-container-to-scratchpad)

sway-move-workspace-to-output

  • Description: Moves the focused workspace to the specified output id|name|direction.
  • Parameters:
    • output: Output name, output id, SWAY-OUTPUT-CURRENT, SWAY-OUTPUT-UP, SWAY-OUTPUT-RIGHT, SWAY-OUTPUT-DOWN, SWAY-OUTPUT-LEFT.
  • Example
(sway-move-workspace-to-output "HDMI-1")

sway-nop

  • Description: A no operation command that can be used to override default behavior.
  • Parameters:
    • comment: Optional comment argument, ignored but logged for debugging purposes.
  • Example
(sway-nop #:comment "This does nothing")

sway-reload

  • Description: Reloads the sway config file and applies any changes.
  • Parameters: None
  • Example
(sway-reload)

sway-rename-workspace

  • Description: Renames a workspace from old-name to new-name.
  • Parameters:
    • old-name: Old workspace name (string).
    • new-name: New workspace name (string).
  • Example
(sway-rename-workspace "1" "Development")

sway-rename-current-workspace

  • Description: Renames the current workspace to new-name.
  • Parameters:
    • new-name: New workspace name (string).
  • Example
(sway-rename-current-workspace "Development")

sway-resize

  • Description: Resizes the currently focused container by amount, specified in pixels or percentage points.
  • Parameters:
    • type: SWAY-RESIZE-TYPE-SHRINK, SWAY-RESIZE-TYPE-GROW
    • direction: SWAY-RESIZE-DIRECTION-HEIGHT, SWAY-RESIZE-DIRECTION-WIDTH
    • amount: Number.
    • unit: SWAY-SIZE-UNIT-PX, SWAY-SIZE-UNIT-PPT (optional).
  • Example
(sway-resize SWAY-RESIZE-TYPE-SHRINK SWAY-RESIZE-DIRECTION-WIDTH 50 #:unit SWAY-SIZE-UNIT-PX)

sway-resize-height

  • Description: Sets the height of the container to height, specified in pixels or percentage points.
  • Parameters:
    • amount: Number.
    • unit: SWAY-SIZE-UNIT-PX, SWAY-SIZE-UNIT-PPT (optional).
  • Example
(sway-resize-height 20 #:unit SWAY-SIZE-UNIT-PX)

sway-resize-width

  • Description: Sets the width of the container to width, specified in pixels or percentage points.
  • Parameters:
    • amount: Number.
    • unit: SWAY-SIZE-UNIT-PX, SWAY-SIZE-UNIT-PPT (optional).
  • Example
(sway-resize-width 30 #:unit SWAY-SIZE-UNIT-PX)

sway-show-scratchpad

  • Description: Shows a window from the scratchpad.
  • Parameters: None
  • Example
(sway-show-scratchpad)

sway-shortcuts-inhibitor

  • Description: Enables or disables the ability of clients to inhibit keyboard shortcuts for a view.
  • Parameters:
    • flag: Boolean (#t for enable, #f for disable).
  • Example
(sway-shortcuts-inhibitor #t)

sway-split-container

  • Description: Splits the current container vertically or horizontally. When none is specified, the effect of a previous split is undone.
  • Parameters:
    • option: SWAY-SPLIT-VERTICAL, SWAY-SPLIT-HORIZONTAL, SWAY-SPLIT-NONE, SWAY-SPLIT-TOGGLE.
  • Example
(sway-split-container SWAY-SPLIT-VERTICAL)

sway-sticky

  • Description: Sticks a floating window to the current output so that it shows up on all workspaces.
  • Parameters:
    • flag: SWAY-STICKY-ENABLE, SWAY-STICKY-DISABLE, SWAY-STICKY-TOGGLE.
  • Example
(sway-sticky SWAY-STICKY-TOGGLE)

sway-swap-container

  • Description: Swaps the position, geometry, and fullscreen status of focused container with another target container.
  • Parameters:
    • type: SWAY-SWAY-CONTAINER-TYPE-ID, SWAY-SWAY-CONTAINER-TYPE-CONTAINER-ID, SWAY-SWAY-CONTAINER-TYPE-MARK.
    • arg: Argument passed (based on selected type).
  • Example
(sway-swap-container SWAY-SWAY-CONTAINER-TYPE-ID 123)

sway-title-format

  • Description: Sets the format of window titles.
  • Parameters:
    • format: A string that can use some placeholders to display windows title format:
      • %title: The title supplied by the window.
      • %app_id: The wayland app ID (applicable to wayland windows only).
      • %class: The X11 classname (applicable to xwayland windows only).
      • %instance: The X11 instance (applicable to xwayland windows only).
      • %shell: The protocol the window is using (typically xwayland or xdg_shell).
  • Example
(sway-title-format "%title - %app_id")

sway-assign-to-workspace

  • Description: Assigns views matching criteria to workspace.
  • Parameters:
    • criteria: A criteria string, use (sway-criteria) to build one.
    • workspace: Workspace name.
  • Example
(sway-assign-to-workspace (sway-criteria #:title "Firefox") "2")

sway-assign-to-output

  • Description: Assigns views matching criteria to output.
  • Parameters:
    • criteria: A criteria string, use (sway-criteria) to build one.
    • output: Output name.
  • Example
(sway-assign-to-output (sway-criteria #:title "Firefox") "HDMI-1")

sway-bindsym

  • Description: Binds key combo to execute the sway command when pressed.
  • Parameters:
    • key: A string that represents the key to bind.
    • command: A string sway command to execute option receiving the key.
    • whole-window: Affect the region in which the mouse bindings can be triggered (optional).
    • border: Affect the region in which the mouse bindings can be triggered (optional).
    • exclude-titlebar: Affect the region in which the mouse bindings can be triggered (optional).
    • release: Command is executed when the key combo is released (optional).
    • locked: Run command also when screen locking program is active (optional).
    • to-code: The keysyms will be translated into the corresponding keycodes, making them layout independent (optional).
    • input-device: The binding will only be executed for specified input device (optional).
    • no-warn: Silence sway warning when overriding a keybinding (optional).
    • no-repeat: The command will not be run repeatedly when the key is held (optional).
    • inhibited: Keyboard shortcuts run also when inhibitor is active for the currently focused window (optional).
    • group: Binding will only be available for specified group (optional).
  • Example
(sway-bindsym "Mod4+Return" "exec alacritty" #:no-warn #t)

sway-bindcode

  • Description: For binding with key/button codes instead of key/button names.
  • Parameters:
    • code: A string that represents the code to bind.
    • command: A string sway command to execute option receiving the key.
    • whole-window: Affect the region in which the mouse bindings can be triggered (optional).
    • border: Affect the region in which the mouse bindings can be triggered (optional).
    • exclude-titlebar: Affect the region in which the mouse bindings can be triggered (optional).
    • release: Command is executed when the key combo is released (optional).
    • locked: Run command also when screen locking program is active (optional).
    • input-device: The binding will only be executed for specified input device (optional).
    • no-warn: Silence sway warning when overriding a keybinding (optional).
    • no-repeat: The command will not be run repeatedly when the key is held (optional).
    • inhibited: Keyboard shortcuts run also when inhibitor is active for the currently focused window (optional).
    • group: Binding will only be available for specified group (optional).
  • Example
(sway-bindcode "38" "exec alacritty" #:no-warn #t)

sway-bindswitch

  • Description: Binds switch to execute the sway command on state changes.
  • Parameters:
    • switch: Supported switches are lid (laptop lid) and tablet (tablet mode) switches.
    • state: Valid values are on, off, and toggle.
    • command: A string sway command to execute option receiving the key.
    • locked: Run command also when screen locking program is active (optional).
    • no-warn: Silence sway warning when overriding a keybinding (optional).
  • Example
(sway-bindswitch "tablet:on" "exec echo 'tablet mode enabled'")

sway-unbindswitch

  • Description: Removes a binding for when <switch> changes to <state>.
  • Parameters:
    • switch: Supported switches are lid (laptop lid) and tablet (tablet mode) switches.
    • state: Valid values are on, off, and toggle.
  • Example
(sway-unbindswitch "lid" "on")

sway-unbindsym

  • Description: Removes the binding for key combo that was previously bound with the given flags.
  • Parameters:
    • key: A string that represents the key to bind
    • whole-window: Affect the region in which the mouse bindings can be triggered (optional).
    • border: Affect the region in which the mouse bindings can be triggered (optional).
    • exclude-titlebar: Affect the region in which the mouse bindings can be triggered (optional).
    • release: Command is executed when the key combo is released (optional).
    • locked: Run command also when screen locking program is active (optional).
    • to-code: The keysyms will be translated into the corresponding keycodes (optional).
    • input-device: The binding will only be executed for specified input device (optional).
  • Example
(sway-unbindsym "Mod4+Return" #:release #t)

sway-unbindcode

  • Description: Removes the binding for code that was previously bound with the given flags.
  • Parameters:
    • code: A string that represents the code to bind
    • whole-window: Affect the region in which the mouse bindings can be triggered (optional).
    • border: Affect the region in which the mouse bindings can be triggered (optional).
    • exclude-titlebar: Affect the region in which the mouse bindings can be triggered (optional).
    • release: Command is executed when the key combo is released (optional).
    • locked: Run command also when screen locking program is active (optional).
    • input-device: The binding will only be executed for specified input device (optional).
  • Example
(sway-unbindcode "38" #:release #t)

sway-unmark

  • Description: Remove identifier from the list of current marks on a window.
  • Parameters:
    • identifier: String mark.
  • Example
(sway-unmark "my_mark")

sway-urgent

  • Description: Using enable or disable manually sets or unsets the window’s urgent state.
  • Parameters:
    • flag: SWAY-URGENT-ENABLE, SWAY-URGENT-DISABLE, SWAY-URGENT-ALLOW, SWAY-URGENT-DENY.
  • Example
(sway-urgent SWAY-URGENT-ENABLE)

sway-client-background

  • Description: This command is ignored and is only present for i3 compatibility.
  • Parameters:
    • color: Color code to be used (string).
  • Example
(sway-client-background "#000000")

sway-client-focused-color

  • Description: Configures the color of window borders and title bars of the window that has focus.
  • Parameters:
    • border-color: Color code to be used for border (string).
    • background-color: Color code to be used for background (string).
    • text-color: Color code to be used for text (string).
    • indictor-color: Color code to be used for indicator (string, optional).
    • child-border-color: Color code to be used for child border (string, optional).
  • Example
(sway-client-focused-color "#ff0000" "#00ff00" "#0000ff" #:indictor-color "#ffff00")

sway-client-focused-inactive-color

  • Description: Configures the color of window borders and title bars of the most recently focused view within a container which is not focused.
  • Parameters:
    • border-color: Color code to be used for border (string).
    • background-color: Color code to be used for background (string).
    • text-color: Color code to be used for text (string).
    • indictor-color: Color code to be used for indicator (string, optional).
    • child-border-color: Color code to be used for child border (string, optional).
  • Example
(sway-client-focused-inactive-color "#ff0000" "#00ff00" "#0000ff" #:indictor-color "#ffff00")

sway-client-focused-tab-title-color

  • Description: Configures the color of window borders and title bars of a view that has focused descendant container.
  • Parameters:
    • border-color: Color code to be used for border (string).
    • background-color: Color code to be used for background (string).
    • text-color: Color code to be used for text (string).
  • Example
(sway-client-focused-tab-title-color "#ff0000" "#00ff00" "#0000ff")

sway-client-placeholder-color

  • Description: Ignored (present for i3 compatibility).
  • Parameters:
    • border-color: Color code to be used for border (string).
    • background-color: Color code to be used for background (string).
    • text-color: Color code to be used for text (string).
    • indictor-color: Color code to be used for indicator (string, optional).
    • child-border-color: Color code to be used for child border (string, optional).
  • Example
(sway-client-placeholder-color "#ff0000" "#00ff00" "#0000ff" #:indictor-color "#ffff00")

sway-client-unfocused-color

  • Description: Configures the color of window borders and title bars of a view that does not have focus.
  • Parameters:
    • border-color: Color code to be used for border (string).
    • background-color: Color code to be used for background (string).
    • text-color: Color code to be used for text (string).
    • indictor-color: Color code to be used for indicator (string, optional).
    • child-border-color: Color code to be used for child border (string, optional).
  • Example
(sway-client-unfocused-color "#ff0000" "#00ff00" "#0000ff" #:indictor-color "#ffff00")

sway-client-urgent-color

  • Description: Configures the color of window borders and title bars of a view with an urgency hint.
  • Parameters:
    • border-color: Color code to be used for border (string).
    • background-color: Color code to be used for background (string).
    • text-color: Color code to be used for text (string).
    • indictor-color: Color code to be used for indicator (string, optional).
    • child-border-color: Color code to be used for child border (string, optional).
  • Example
(sway-client-urgent-color "#ff0000" "#00ff00" "#0000ff" #:indictor-color "#ffff00")

sway-default-border-style

  • Description: Set default border style for new tiled windows.
  • Parameters:
    • type: SWAY-BORDER-STYLE-NONE, SWAY-BORDER-STYLE-NORMAL, SWAY-BORDER-STYLE-PIXEL
    • n: Units in case pixel is chosen (number, optional).
  • Example
(sway-default-border-style SWAY-BORDER-STYLE-PIXEL #:n 2)

sway-default-floating-border-style

  • Description: Set default border style for new floating windows.
  • Parameters:
    • type: Border style (string).
    • n: Units in case pixel is chosen (number, optional).
  • Example
(sway-default-floating-border-style SWAY-BORDER-STYLE-PIXEL #:n 2)

sway-exec

  • Description: Executes shell command with sh.
  • Parameters:
    • command: Command to be executed (string).
  • Example
(sway-exec "echo 'Hello, world!'")

sway-exec-always

  • Description: Like exec, but the shell command will be executed again after reload.
  • Parameters:
    • command: Command to be executed (string).
  • Example
(sway-exec-always "echo 'Hello, world!'")

sway-floating-maximum-size

  • Description: Specifies the maximum size of floating windows.
  • Parameters:
    • width: Target size width (number).
    • height: Target size height (number).
  • Example
(sway-floating-maximum-size 800 600)

sway-floating-minimum-size

  • Description: Specifies the minimum size of floating windows.
  • Parameters:
    • width: Target size width (number).
    • height: Target size height (number).
  • Example
(sway-floating-minimum-size 200 150)

sway-floating-modifier

  • Description: When the modifier key is held down, you may hold left click to move windows, and right click to resize them.
  • Parameters:
    • modifier: The modifier key (string).
    • type: SWAY-FLOATING-MODIFIER-TYPE-NORMAL, SWAY-FLOATING-MODIFIER-TYPE-INVERSE.
  • Example
(sway-floating-modifier "Mod4" SWAY-FLOATING-MODIFIER-TYPE-NORMAL)

sway-focus-follow-mouse

  • Description: If set to yes, moving your mouse over a window will focus that window. If set to always, the window under the cursor will always be focused, even after switching between workspaces.
  • Parameters:
    • flag: SWAY-FOCUS-FOLLOW-MOUSE-FLAG-YES, SWAY-FOCUS-FOLLOW-MOUSE-FLAG-NO, SWAY-FOCUS-FOLLOW-MOUSE-FLAG-ALWAYS
  • Example
(sway-focus-follow-mouse SWAY-FOCUS-FOLLOW-MOUSE-FLAG-YES)

sway-focus-on-window-activation

  • Description: This option determines what to do when a client requests window activation.
  • Parameters:
    • flag: SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-SMART, SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-URGENT, SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-FOCUS, SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-NONE
  • Example
(sway-focus-on-window-activation SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-FOCUS)

sway-focus-wrapping

  • Description: Determines what to do when a client requests window activation.
  • Parameters:
    • flag: SWAY-FOCUS-WRAPPING-FLAG-YES, SWAY-FOCUS-WRAPPING-FLAG-NO, SWAY-FOCUS-WRAPPING-FLAG-FORCE, SWAY-FOCUS-WRAPPING-FLAG-WORKSPACE
  • Example
(sway-focus-wrapping SWAY-FOCUS-WRAPPING-FLAG-FORCE)

sway-font

  • Description: Sets font to use for the title bars. To enable support for pango markup, preface the font name with pango:
  • Parameters:
    • font: font name (str)
    • pango: whether to use pango or not (boolean)
  • Example
(sway-font "Iosevka ss14" #:pango #t)

sway-force-display-urgency-hint

  • Description: If an application on another workspace sets an urgency hint.
  • Parameters:
    • timeout: urgency timeout (number)
  • Example
(sway-force-display-urgency-hint 5)

sway-titlebar-border-thickness

  • Description: Thickness of the titlebar border in pixels.
  • Parameters:
    • thickness: thickness of border (number)
  • Example
(sway-titlebar-border-thickness 2)

sway-titlebar-padding

  • Description: Padding of the text in the titlebar.
  • Parameters:
    • horizontal: horizontal padding (number)
    • vertical: vertical padding (number)
  • Example
(sway-titlebar-padding 5 10)

sway-for-window

  • Description: Whenever a window that matches criteria appears, run list of commands.
  • Parameters:
    • criteria: a criteria string, use (sway-criteria) to build one
    • command: list of commands to execute (string)
  • Example
(sway-for-window (sway-criteria #:title "Firefox") "focus")

sway-default-gaps

  • Description: Sets default amount of pixels of inner or outer gap.
  • Parameters:
    • option: SWAY-GAPS-OPTION-INNER, SWAY-GAPS-OPTION-OUTER, SWAY-GAPS-OPTION-HORIZONTAL, SWAY-GAPS-OPTION-VERTICAL, SWAY-GAPS-OPTION-TOP, SWAY-GAPS-OPTION-RIGHT, SWAY-GAPS-OPTION-BOTTOM, SWAY-GAPS-OPTION-LEFT
    • amount: amount of gap (number)
  • Example
(sway-default-gaps SWAY-GAPS-OPTION-INNER 10)

sway-hide-edge-borders

  • Description: Hides window borders adjacent to the screen edges.
  • Parameters:
    • type: SWAY-EDGE-BORDER-TYPE-NONE, SWAY-EDGE-BORDER-TYPE-VERTICAL, SWAY-EDGE-BORDER-TYPE-HORIZONTAL, SWAY-EDGE-BORDER-TYPE-BOTH, SWAY-EDGE-BORDER-TYPE-SMART, SWAY-EDGE-BORDER-TYPE-SMART-NO-GAPS
    • i3: enables i3-compatible behavior to hide the title bar on tabbed and stacked containers with one child
  • Example
(sway-hide-edge-borders SWAY-EDGE-BORDER-TYPE-NONE #:i3 #t)

sway-input

  • Description: For details on input subcommands, see sway-input(5).
  • Parameters:
    • device: the name of the target device
    • subcommands: list of commands to execute (string)
  • Example
(sway-input "pointer-1" "map_to_output eDP-1")

sway-seat

  • Description: For details on input subcommands, see sway-input(5).
  • Parameters:
    • seat: the name of the seat device
    • subcommands: list of commands to execute (string)
  • Example
(sway-seat "seat0" "focus_follows_mouse yes")

sway-kill

  • Description: Kills (closes) the currently focused container and all of its children.
  • Parameters: None
  • Example
(sway-kill)

sway-smart-borders

  • Description: If smart_borders are on, borders will only be enabled if the workspace has more than one visible child.
  • Parameters:
    • flag: SWAY-SMART-BORDERS-ON, SWAY-SMART-BORDERS-OFF, SWAY-SMART-BORDERS-NO-GAPS
  • Example
(sway-smart-borders SWAY-SMART-BORDERS-ON)

sway-smart-gaps

  • Description: If smart_gaps are on, gaps will only be enabled if a workspace has more than one child.
  • Parameters:
    • flag: SWAY-SMART-GAPS-ON, SWAY-SMART-GAPS-OFF, SWAY-SMART-GAPS-TOGGLE, SWAY-SMART-GAPS-INVERSE-OUTER
  • Example
(sway-smart-gaps SWAY-SMART-GAPS-TOGGLE)

sway-mode

  • Description: Switches to the specified mode. The default mode is default.
  • Parameters:
    • mode: name of the mode (str)
  • Example
(sway-mode "resize")

sway-mode-subcommand

  • Description: The only valid mode-subcommands are bindsym, bindcode, bindswitch, and set.
  • Parameters:
    • mode: name of the mode (str)
    • subcommand: list of subcommands (str)
  • Example
(sway-mode-subcommand "resize" "bindsym --release Return exec terminal")

sway-mouse-warping

  • Description: If output is specified, the mouse will be moved to new outputs as you move focus between them. If container is specified, the mouse will be moved to the middle of the container on switch.
  • Parameters:
    • mode: SWAY-MOUSE-WARPING-OUTPUT, SWAY-MOUSE-WARPING-CONTAINER, SWAY-MOUSE-WARPING-NONE
  • Example
(sway-mouse-warping SWAY-MOUSE-WARPING-CONTAINER)

sway-no-focus

  • Description: Prevents windows matching <criteria> from being focused automatically when they’re created.
  • Parameters:
    • criteria: a criteria string, use (sway-criteria) to build one
  • Example
(sway-no-focus (sway-criteria #:title "Firefox"))

sway-output

  • Description: For details on output subcommands, see sway-output(5).
  • Parameters:
    • output: name of the output (str)
    • subcommand: list of subcommands (str)
  • Example
(sway-output "HDMI-A-1" "command")

sway-popup-during-fullscreen

  • Description: Determines what to do when a fullscreen view opens a dialog.
  • Parameters:
    • type: SWAY-POPUP-TYPE-OUTPUTSMART, SWAY-POPUP-TYPE-IGNORE, SWAY-POPUP-TYPE-LEAVE-FULLSCREEN
  • Example
(sway-popup-during-fullscreen SWAY-POPUP-TYPE-IGNORE)

*

sway-primary-selection

  • Description: Enable or disable the primary selection clipboard. May only be configured at launch. Default is enabled.
  • Parameters:
    • type: SWAY-PRIMARY-SELECTION-ENABLED, SWAY-PRIMARY-SELECTION-DISABLED
  • Example
(sway-primary-selection SWAY-PRIMARY-SELECTION-ENABLED)

sway-show-marks

  • Description: If show_marks is yes, marks will be displayed in the window borders.
  • Parameters: flag: SWAY-SHOW-MARKS-YES, SWAY-SHOW-MARKS-NO
  • Example
(sway-show-marks SWAY-SHOW-MARKS-YES)

sway-opacity

  • Description: Adjusts the opacity of the window between 0 (completely transparent) and 1 (completely opaque).
  • Parameters:
    • type: SWAY-OPACITY-SET, SWAY-OPACITY-PLUS, SWAY-OPACITY-MINUS
    • value: opacity value (number) should be between 0 and 1
  • Example
(sway-opacity SWAY-OPACITY-SET 0.8)

sway-tiling-drag

  • Description: Sets whether or not tiling containers can be dragged with the mouse.
  • Parameters:
    • flag: SWAY-TILING-DRAG-ENABLE, SWAY-TILING-DRAG-DISABLE, SWAY-TILING-DRAG-TOGGLE
  • Example
(sway-tiling-drag SWAY-TILING-DRAG-ENABLE)

sway-tiling-drag-threshold

  • Description: Sets the threshold value for tiling container dragging.
  • Parameters:
    • threshold: threshold value (number)
  • Example
(sway-tiling-drag-threshold 10)

sway-tiling-align

  • Description: Sets the title alignment.
  • Parameters:
    • type: SWAY-TILING-ALIGN-LEFT, SWAY-TILING-ALIGN-CENTER, SWAY-TILING-ALIGN-RIGHT
  • Example
(sway-tiling-align SWAY-TILING-ALIGN-CENTER)

sway-switch-workspace-id

  • Description: Switches to the workspace with the provided ID.
  • Parameters:
    • id: workspace id (number)
    • auto-back-and-forth: enable/disable auto back and forth (optional)
  • Example
(sway-switch-workspace-id 2 #:auto-back-and-forth #t)

sway-switch-workspace

  • Description: Switches to the workspace with the provided name.
  • Parameters:
    • workspace: workspace name (string)
    • auto-back-and-forth: enable/disable auto back and forth (optional)
  • Example
(sway-switch-workspace "Development" #:auto-back-and-forth #f)

sway-switch-workspace-on-output

  • Description: Assigns a workspace to a specific output.
  • Parameters:
    • workspace: workspace name (string)
    • output: output name (string)
  • Example
(sway-switch-workspace-on-output "Development" "HDMI-1")

sway-workspace-auto-back-and-forth

  • Description: Enables or disables auto back and forth between workspaces.
  • Parameters:
    • option: SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES, SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-NO
  • Example
(sway-workspace-auto-back-and-forth SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES)

sway-workspace-gaps

  • Description: Specifies the gap settings for a workspace when it is created.
  • Parameters:
    • workspace: workspace name (string)
    • option: SWAY-GAPS-OPTION-INNER, SWAY-GAPS-OPTION-OUTER, SWAY-GAPS-OPTION-HORIZONTAL, SWAY-GAPS-OPTION-VERTICAL, SWAY-GAPS-OPTION-TOP, SWAY-GAPS-OPTION-RIGHT, SWAY-GAPS-OPTION-BOTTOM, SWAY-GAPS-OPTION-LEFT
    • amount: gap amount (number)
  • Example
(sway-workspace-gaps "workspace_name" SWAY-GAPS-OPTION-INNER 10)

sway-criteria

  • Description: Generates a string with attribute/value pairs for criteria.
  • Parameters:
    • app-id, class, con-id, con-mark, floating, id, instance, pid, shell, tiling, title, urgent, window-role, window-type, workspace
  • Example
(sway-criteria #:app-id "myApp" #:class "myClass")
Clone this wiki locally