rename dispatch-commands to sway-dispatch-commands

This commit is contained in:
Almarhoon Ibraheem 2024-06-23 21:11:54 +03:00
parent 7cc1b68b4f
commit f7f0b56743
2 changed files with 109 additions and 111 deletions

View file

@ -130,7 +130,7 @@ Parameters:
(hash-set! general-keybindings chord (list key exp wk submap)) (hash-set! general-keybindings chord (list key exp wk submap))
(if (equal? submap "default") (if (equal? submap "default")
(dispatch-command command) (sway-dispatch-command command)
(begin (begin
(sway-mode-subcommand submap command) (sway-mode-subcommand submap command)
(unless (equal? "sway-mode" (symbol->string (car exp))) (unless (equal? "sway-mode" (symbol->string (car exp)))

View file

@ -137,9 +137,8 @@
SWAY-OUTPUT-DOWN SWAY-OUTPUT-DOWN
SWAY-OUTPUT-LEFT SWAY-OUTPUT-LEFT
catch-all sway-dispatch-command
dispatch-command sway-dispatch-commands
dispatch-commands
sway-default-orientation sway-default-orientation
sway-include sway-include
sway-swaybg-command sway-swaybg-command
@ -242,8 +241,7 @@
sway-switch-workspace-on-output sway-switch-workspace-on-output
sway-workspace-auto-back-and-forth sway-workspace-auto-back-and-forth
sway-workspace-gaps sway-workspace-gaps
sway-criteria sway-criteria))
custom-exception-handler))
(define (custom-exception-handler exc) (define (custom-exception-handler exc)
(display "An error occurred while dispatching the command\n")) (display "An error occurred while dispatching the command\n"))
@ -257,16 +255,16 @@
thunk thunk
#:unwind? #t)) #:unwind? #t))
(define (dispatch-command command) (define (sway-dispatch-command command)
"Parses and runs the payload as sway command. "Parses and runs the payload as sway command.
Parameters: Parameters:
- a sway command - a sway command
Response: Response:
An array of objects corresponding to each command that was parsed. Each An array of objects corresponding to each command that was parsed. Each
object has the property success." object has the property success."
(dispatch-commands command)) (sway-dispatch-commands command))
(define (dispatch-commands . commands) (define (sway-dispatch-commands . commands)
"Parses and runs the payload as sway commands "Parses and runs the payload as sway commands
Parameters: Parameters:
- list of sway commands - list of sway commands
@ -299,28 +297,28 @@ Response:
"Sets the default container layout for tiled containers. "Sets the default container layout for tiled containers.
parameters: parameters:
- orientation: `SWAY-ORIENTATION-HORIZONTAL`, `SWAY-ORIENTATION-VERTICAL`, `SWAY-ORIENTATION-AUTO`" - orientation: `SWAY-ORIENTATION-HORIZONTAL`, `SWAY-ORIENTATION-VERTICAL`, `SWAY-ORIENTATION-AUTO`"
(dispatch-command (sway-dispatch-command
(string-append "default_orientation " orientation))) (string-append "default_orientation " orientation)))
(define (sway-include file-path) (define (sway-include file-path)
"Includes another configuration file from path (not scheme file). "Includes another configuration file from path (not scheme file).
parameters: parameters:
- file-path: string" - file-path: string"
(dispatch-command (sway-dispatch-command
(string-append "include " file-path))) (string-append "include " file-path)))
(define (sway-swaybg-command command) (define (sway-swaybg-command command)
"Executes custom background command. Default is swaybg. "Executes custom background command. Default is swaybg.
parameters: parameters:
- command: string" - command: string"
(dispatch-command (sway-dispatch-command
(string-append "swaybg_command " command))) (string-append "swaybg_command " command)))
(define (sway-swaynag-command command) (define (sway-swaynag-command command)
"Executes custom command for swaynag. Default is swaynag. "Executes custom command for swaynag. Default is swaynag.
parameters: parameters:
- command: string" - command: string"
(dispatch-command (sway-dispatch-command
(string-append "swaynag_command " command))) (string-append "swaynag_command " command)))
(define SWAY-LAYOUT-DEFAULT "default") (define SWAY-LAYOUT-DEFAULT "default")
@ -331,7 +329,7 @@ Response:
"Specifies the initial layout for new containers in an empty workspace. "Specifies the initial layout for new containers in an empty workspace.
parameters: parameters:
- layout: `SWAY-LAYOUT-DEFAULT`, `SWAY-LAYOUT-STAKCING`, `SWAY-LAYOUT-TABBED`" - layout: `SWAY-LAYOUT-DEFAULT`, `SWAY-LAYOUT-STAKCING`, `SWAY-LAYOUT-TABBED`"
(dispatch-command (sway-dispatch-command
(string-append "workspace_layout " layout))) (string-append "workspace_layout " layout)))
(define SWAY-XWAYLAND-ENABLE "enable") (define SWAY-XWAYLAND-ENABLE "enable")
@ -342,7 +340,7 @@ Response:
"Enables or disables Xwayland support, which allows X11 applications to be used. "Enables or disables Xwayland support, which allows X11 applications to be used.
parameters: parameters:
- option: `SWAY-XWAYLAND-ENABLE`, `SWAY-XWAYLAND-DISABLE`, `SWAY-XWAYLAND-FORCE`" - option: `SWAY-XWAYLAND-ENABLE`, `SWAY-XWAYLAND-DISABLE`, `SWAY-XWAYLAND-FORCE`"
(dispatch-command (sway-dispatch-command
(string-append "xwayland " (cond (string-append "xwayland " (cond
((equal? #t option) SWAY-XWAYLAND-ENABLE) ((equal? #t option) SWAY-XWAYLAND-ENABLE)
((equal? #f option) SWAY-XWAYLAND-DISABLE) ((equal? #f option) SWAY-XWAYLAND-DISABLE)
@ -358,17 +356,17 @@ Response:
parameters: parameters:
- option: `SWAY-BORDER-NONE`, `SWAY-BORDER-NORMAL`, `SWAY-BORDER-CSD`, `SWAY-BORDER-PIXEL` - option: `SWAY-BORDER-NONE`, `SWAY-BORDER-NORMAL`, `SWAY-BORDER-CSD`, `SWAY-BORDER-PIXEL`
- thickness: int" - thickness: int"
(dispatch-command (sway-dispatch-command
(string-append "border " option (number->string thickness)))) (string-append "border " option (number->string thickness))))
(define (sway-border-toggle) (define (sway-border-toggle)
"Cycles through the available border styles." "Cycles through the available border styles."
(dispatch-command (sway-dispatch-command
(string-append "border toggle"))) (string-append "border toggle")))
(define (sway-exit) (define (sway-exit)
"Exit sway and end your Wayland session." "Exit sway and end your Wayland session."
(dispatch-command (sway-dispatch-command
(string-append "exit"))) (string-append "exit")))
(define SWAY-FLOATING-ENABLED "enabled") (define SWAY-FLOATING-ENABLED "enabled")
@ -379,7 +377,7 @@ Response:
"Make focused view floating, non-floating, or the opposite of what it is now. "Make focused view floating, non-floating, or the opposite of what it is now.
parameters: parameters:
- layout: `SWAY-FLOATING-ENABLED`, `SWAY-FLOATING-DISABLED`, `SWAY-FLOATING-TOGGLE`" - layout: `SWAY-FLOATING-ENABLED`, `SWAY-FLOATING-DISABLED`, `SWAY-FLOATING-TOGGLE`"
(dispatch-command (sway-dispatch-command
(string-append "floating " (cond (string-append "floating " (cond
((equal? #t option) SWAY-FLOATING-ENABLED) ((equal? #t option) SWAY-FLOATING-ENABLED)
((equal? #f option) SWAY-FLOATING-DISABLED) ((equal? #f option) SWAY-FLOATING-DISABLED)
@ -389,7 +387,7 @@ Response:
"Moves focus to the container that matches the specified criteria. "Moves focus to the container that matches the specified criteria.
parameters: parameters:
- criteria: sway criteria" - criteria: sway criteria"
(dispatch-command (sway-dispatch-command
(string-append criteria " focus"))) (string-append criteria " focus")))
(define SWAY-DIRECTION-UP "up") (define SWAY-DIRECTION-UP "up")
@ -405,48 +403,48 @@ Response:
"Moves focus to the next container in the specified direction. "Moves focus to the next container in the specified direction.
parameters: parameters:
- direction: `SWAY-DIRECTION-UP`, `SWAY-DIRECTION-RIGHT`, `SWAY-DIRECTION-DOWN`, `SWAY-DIRECTION-LEFT`" - direction: `SWAY-DIRECTION-UP`, `SWAY-DIRECTION-RIGHT`, `SWAY-DIRECTION-DOWN`, `SWAY-DIRECTION-LEFT`"
(dispatch-command (sway-dispatch-command
(string-append "focus " direction))) (string-append "focus " direction)))
(define (sway-focus-container-sibling sibling) (define (sway-focus-container-sibling sibling)
"Moves focus to the previous or next container in the current layout. "Moves focus to the previous or next container in the current layout.
parameters: parameters:
- sibling: `SWAY-SIBLING-NEXT`, `SWAY-SIBLING-PREV`" - sibling: `SWAY-SIBLING-NEXT`, `SWAY-SIBLING-PREV`"
(dispatch-command (sway-dispatch-command
(string-append "focus " sibling))) (string-append "focus " sibling)))
(define (sway-focus-container-child) (define (sway-focus-container-child)
"Moves focus to the last-focused child of the focused container." "Moves focus to the last-focused child of the focused container."
(dispatch-command (sway-dispatch-command
(string-append "focus child"))) (string-append "focus child")))
(define (sway-focus-container-parent) (define (sway-focus-container-parent)
"Moves focus to the last-focused child of the focused container." "Moves focus to the last-focused child of the focused container."
(dispatch-command (sway-dispatch-command
(string-append "focus parent"))) (string-append "focus parent")))
(define (sway-focus-output-direction direction) (define (sway-focus-output-direction direction)
"Moves focus to the next output in the specified direction. "Moves focus to the next output in the specified direction.
parameters: parameters:
- direction: `SWAY-DIRECTION-UP`, `SWAY-DIRECTION-RIGHT`, `SWAY-DIRECTION-DOWN`, `SWAY-DIRECTION-LEFT`" - direction: `SWAY-DIRECTION-UP`, `SWAY-DIRECTION-RIGHT`, `SWAY-DIRECTION-DOWN`, `SWAY-DIRECTION-LEFT`"
(dispatch-command (sway-dispatch-command
(string-append "focus output " direction))) (string-append "focus output " direction)))
(define (sway-focus-output-name name) (define (sway-focus-output-name name)
"Moves focus to the named output. "Moves focus to the named output.
parameters: parameters:
- name: string, output name" - name: string, output name"
(dispatch-command (sway-dispatch-command
(string-append "focus output " name))) (string-append "focus output " name)))
(define (sway-focus-container-tiling) (define (sway-focus-container-tiling)
"Sets focus to the last focused tiling container." "Sets focus to the last focused tiling container."
(dispatch-command (sway-dispatch-command
(string-append "focus tiling"))) (string-append "focus tiling")))
(define (sway-focus-container-floating) (define (sway-focus-container-floating)
"Sets focus to the last focused floating container." "Sets focus to the last focused floating container."
(dispatch-command (sway-dispatch-command
(string-append "focus floating"))) (string-append "focus floating")))
(define SWAY-FULLSCREEN-ENABLED "enabled") (define SWAY-FULLSCREEN-ENABLED "enabled")
@ -458,7 +456,7 @@ Response:
parameters: parameters:
- option: `SWAY-FULLSCREEN-ENABLED`, `SWAY-FULLSCREEN-DISABLED`, `SWAY-FULLSCREEN-TOGGLE` - option: `SWAY-FULLSCREEN-ENABLED`, `SWAY-FULLSCREEN-DISABLED`, `SWAY-FULLSCREEN-TOGGLE`
- global: #t, #f" - global: #t, #f"
(dispatch-command (sway-dispatch-command
(string-append "fullscreen " (cond (string-append "fullscreen " (cond
((equal? #t option) SWAY-FULLSCREEN-ENABLED) ((equal? #t option) SWAY-FULLSCREEN-ENABLED)
((equal? #f option) SWAY-FULLSCREEN-DISABLED) ((equal? #f option) SWAY-FULLSCREEN-DISABLED)
@ -490,7 +488,7 @@ Response:
- workspace: `SWAY-GAPS-WORKSPACE-ALL`, `SWAY-GAPS-WORKSPACE-CURRENT`, `SWAY-GAPS-WORKSPACE-SET`, - workspace: `SWAY-GAPS-WORKSPACE-ALL`, `SWAY-GAPS-WORKSPACE-CURRENT`, `SWAY-GAPS-WORKSPACE-SET`,
`SWAY-GAPS-WORKSPACE-PLUS`, `SWAY-GAPS-WORKSPACE-MINUS`, `SWAY-GAPS-WORKSPACE-TOGGLE` `SWAY-GAPS-WORKSPACE-PLUS`, `SWAY-GAPS-WORKSPACE-MINUS`, `SWAY-GAPS-WORKSPACE-TOGGLE`
- amount: amount of gap (number)" - amount: amount of gap (number)"
(dispatch-command (sway-dispatch-command
(string-append "gaps " option " " workspace " " (number->string amount)))) (string-append "gaps " option " " workspace " " (number->string amount))))
(define SWAY-INHIBIT-IDLE-FOCUS "focus") (define SWAY-INHIBIT-IDLE-FOCUS "focus")
@ -504,7 +502,7 @@ Response:
parameters: parameters:
- option: `SWAY-INHIBIT-IDLE-FOCUS`, `SWAY-INHIBIT-IDLE-FULLSCREEN`, `SWAY-INHIBIT-IDLE-OPEN`, - option: `SWAY-INHIBIT-IDLE-FOCUS`, `SWAY-INHIBIT-IDLE-FULLSCREEN`, `SWAY-INHIBIT-IDLE-OPEN`,
`SWAY-INHIBIT-IDLE-NONE`, `SWAY-INHIBIT-IDLE-VISIBLE`" `SWAY-INHIBIT-IDLE-NONE`, `SWAY-INHIBIT-IDLE-VISIBLE`"
(dispatch-command (sway-dispatch-command
(string-append "inhibit_idle " option))) (string-append "inhibit_idle " option)))
(define SWAY-LAYOUT-SPLITH "splith") (define SWAY-LAYOUT-SPLITH "splith")
@ -516,7 +514,7 @@ Response:
parameters: parameters:
- option: `SWAY-LAYOUT-DEFAULT`, `SWAY-LAYOUT-SPLITH`, `SWAY-LAYOUT-SPLITV`, - option: `SWAY-LAYOUT-DEFAULT`, `SWAY-LAYOUT-SPLITH`, `SWAY-LAYOUT-SPLITV`,
`SWAY-LAYOUT-STACKING`, `SWAY-LAYOUT-TABBED`" `SWAY-LAYOUT-STACKING`, `SWAY-LAYOUT-TABBED`"
(dispatch-command (sway-dispatch-command
(string-append "layout " option))) (string-append "layout " option)))
(define SWAY-LAYOUT-TOGGLE-ALL "all") (define SWAY-LAYOUT-TOGGLE-ALL "all")
@ -526,7 +524,7 @@ Response:
"Cycles the layout mode of the focused container though a preset list of layouts. "Cycles the layout mode of the focused container though a preset list of layouts.
parameters: parameters:
- option: `SWAY-LAYOUT-TOGGLE-ALL`, `SWAY-LAYOUT-TOGGLE-SPLIT`" - option: `SWAY-LAYOUT-TOGGLE-ALL`, `SWAY-LAYOUT-TOGGLE-SPLIT`"
(dispatch-command (sway-dispatch-command
(string-append "layout toggle" (if option (string-append " " option) "")))) (string-append "layout toggle" (if option (string-append " " option) ""))))
(define* (sway-move-container direction #:key amount) (define* (sway-move-container direction #:key amount)
@ -534,7 +532,7 @@ Response:
parameters: parameters:
- direction: `SWAY-DIRECTION-UP`, `SWAY-DIRECTION-RIGHT`, `SWAY-DIRECTION-DOWN`, `SWAY-DIRECTION-LEFT` - direction: `SWAY-DIRECTION-UP`, `SWAY-DIRECTION-RIGHT`, `SWAY-DIRECTION-DOWN`, `SWAY-DIRECTION-LEFT`
- amount: int" - amount: int"
(dispatch-command (sway-dispatch-command
(string-append "move " direction (string-append "move " direction
(if amount (string-append " " (number->string amount)) "")))) (if amount (string-append " " (number->string amount)) ""))))
@ -543,22 +541,22 @@ Response:
parameters: parameters:
- x: int - x: int
- y: int" - y: int"
(dispatch-command (sway-dispatch-command
(string-append "move absolute position " (number->string x) " " (number->string y)))) (string-append "move absolute position " (number->string x) " " (number->string y))))
(define (sway-move-container-absolute-center) (define (sway-move-container-absolute-center)
"Moves the focused container to be centered on the workspace." "Moves the focused container to be centered on the workspace."
(dispatch-command (sway-dispatch-command
(string-append "move absolute position center"))) (string-append "move absolute position center")))
(define (sway-move-container-cursor) (define (sway-move-container-cursor)
"Moves the focused container to be centered on the cursor." "Moves the focused container to be centered on the cursor."
(dispatch-command (sway-dispatch-command
(string-append "move position cursor"))) (string-append "move position cursor")))
(define (sway-move-container-to-mark mark) (define (sway-move-container-to-mark mark)
"Moves the focused container to the specified mark." "Moves the focused container to the specified mark."
(dispatch-command (sway-dispatch-command
(string-append "move container to mark " mark))) (string-append "move container to mark " mark)))
(define SWAY-WORKSPACE-PREVIOUS "prev") (define SWAY-WORKSPACE-PREVIOUS "prev")
@ -573,7 +571,7 @@ Response:
parameters: parameters:
- workspace: workspace name, `SWAY-WORKSPACE-PREVIOUS`, `SWAY-WORKSPACE-NEXT`, `SWAY-WORKSPACE-CURRENT`, - workspace: workspace name, `SWAY-WORKSPACE-PREVIOUS`, `SWAY-WORKSPACE-NEXT`, `SWAY-WORKSPACE-CURRENT`,
`SWAY-WORKSPACE-PREVIOUS-ON-OUTPUT`, `SWAY-WORKSPACE-NEXT-ON-OUTPUT`, `SWAY-WORKSPACE-BACK-AND-FORTH`" `SWAY-WORKSPACE-PREVIOUS-ON-OUTPUT`, `SWAY-WORKSPACE-NEXT-ON-OUTPUT`, `SWAY-WORKSPACE-BACK-AND-FORTH`"
(dispatch-command (sway-dispatch-command
(string-append "move container to workspace \"" workspace "\""))) (string-append "move container to workspace \"" workspace "\"")))
(define SWAY-OUTPUT-CURRENT "current") (define SWAY-OUTPUT-CURRENT "current")
@ -587,14 +585,14 @@ Response:
parameters: parameters:
- workspace: output name, output id, `SWAY-OUTPUT-CURRENT`, `SWAY-OUTPUT-UP`, - workspace: output name, output id, `SWAY-OUTPUT-CURRENT`, `SWAY-OUTPUT-UP`,
`SWAY-OUTPUT-RIGHT`, `SWAY-OUTPUT-DOWN`, `SWAY-OUTPUT-LEFT`" `SWAY-OUTPUT-RIGHT`, `SWAY-OUTPUT-DOWN`, `SWAY-OUTPUT-LEFT`"
(dispatch-command (sway-dispatch-command
(string-append "move container to output " (or (and (number? output) (string-append "move container to output " (or (and (number? output)
(number->string output)) (number->string output))
output)))) output))))
(define (sway-move-container-to-scratchpad) (define (sway-move-container-to-scratchpad)
"Moves the focused container to the scratchpad." "Moves the focused container to the scratchpad."
(dispatch-command (sway-dispatch-command
(string-append "move container to scratchpad"))) (string-append "move container to scratchpad")))
(define (sway-move-workspace-to-output output) (define (sway-move-workspace-to-output output)
@ -602,7 +600,7 @@ Response:
parameters: parameters:
- workspace: output name, output id, `SWAY-OUTPUT-CURRENT`, `SWAY-OUTPUT-UP`, - workspace: output name, output id, `SWAY-OUTPUT-CURRENT`, `SWAY-OUTPUT-UP`,
`SWAY-OUTPUT-RIGHT`, `SWAY-OUTPUT-DOWN`, `SWAY-OUTPUT-LEFT`" `SWAY-OUTPUT-RIGHT`, `SWAY-OUTPUT-DOWN`, `SWAY-OUTPUT-LEFT`"
(dispatch-command (sway-dispatch-command
(string-append "move workspace to output " (or (and (number? output) (string-append "move workspace to output " (or (and (number? output)
(number->string output)) (number->string output))
output)))) output))))
@ -611,12 +609,12 @@ Response:
"A no operation command that can be used to override default behaviour. "A no operation command that can be used to override default behaviour.
parameters: parameters:
- comment: optional comment argument is ignored, but logged for debugging purposes." - comment: optional comment argument is ignored, but logged for debugging purposes."
(dispatch-command (sway-dispatch-command
(string-append "nop " comment))) (string-append "nop " comment)))
(define (sway-reload) (define (sway-reload)
"Reloads the sway config file and applies any changes." "Reloads the sway config file and applies any changes."
(dispatch-command (sway-dispatch-command
(string-append "reload"))) (string-append "reload")))
(define (sway-rename-workspace old-name new-name) (define (sway-rename-workspace old-name new-name)
@ -624,14 +622,14 @@ Response:
parameters: parameters:
- old-name: old workspace name (str). - old-name: old workspace name (str).
- new-name: new workspace name (str)." - new-name: new workspace name (str)."
(dispatch-command (sway-dispatch-command
(string-append "rename workspace " old-name " to " new-name))) (string-append "rename workspace " old-name " to " new-name)))
(define (sway-rename-current-workspace new-name) (define (sway-rename-current-workspace new-name)
"Rename current workspace to the <new_name> "Rename current workspace to the <new_name>
parameters: parameters:
- new-name: new workspace name (str)." - new-name: new workspace name (str)."
(dispatch-command (sway-dispatch-command
(string-append "rename workspace to " new-name))) (string-append "rename workspace to " new-name)))
(define SWAY-RESIZE-TYPE-SHRINK "shrink") (define SWAY-RESIZE-TYPE-SHRINK "shrink")
@ -648,31 +646,31 @@ If the units are omitted, floating containers are resized in px and tiled contai
- type: `SWAY-RESIZE-TYPE-SHRINK`, `SWAY-RESIZE-TYPE-GROW-WIDTH`, `SWAY-RESIZE-TYPE-GROW-HEIGHT` - type: `SWAY-RESIZE-TYPE-SHRINK`, `SWAY-RESIZE-TYPE-GROW-WIDTH`, `SWAY-RESIZE-TYPE-GROW-HEIGHT`
- amount: number - amount: number
- unit: `SWAY-SIZE-UNIT-PX`, `SWAY-SIZE-UNIT-PPT`" - unit: `SWAY-SIZE-UNIT-PX`, `SWAY-SIZE-UNIT-PPT`"
(dispatch-command (sway-dispatch-command
(string-append "resize " type " " (string-append "resize " type " "
(number->string amount) (number->string amount)
(if unit (string-append " " unit) "")))) (if unit (string-append " " unit) ""))))
(define* (sway-resize-height amount #:key unit) (define* (sway-resize-height amount #:key unit)
"Sets the height of the container to height, specified in pixels or percentage points." "Sets the height of the container to height, specified in pixels or percentage points."
(dispatch-command (sway-dispatch-command
(string-append "resize height " (number->string amount) (string-append "resize height " (number->string amount)
(if unit (string-append " " unit) "")))) (if unit (string-append " " unit) ""))))
(define* (sway-resize-width amount #:key unit) (define* (sway-resize-width amount #:key unit)
"Sets the width of the container to width, specified in pixels or percentage points." "Sets the width of the container to width, specified in pixels or percentage points."
(dispatch-command (sway-dispatch-command
(string-append "resize width " (number->string amount) (string-append "resize width " (number->string amount)
(if unit (string-append " " unit) "")))) (if unit (string-append " " unit) ""))))
(define (sway-show-scratchpad) (define (sway-show-scratchpad)
"Shows a window from the scratchpad." "Shows a window from the scratchpad."
(dispatch-command (sway-dispatch-command
(string-append "scratchpad show"))) (string-append "scratchpad show")))
(define (sway-shortcuts-inhibitor flag) (define (sway-shortcuts-inhibitor flag)
"Enables or disables the ability of clients to inhibit keyboard shortcuts for a view." "Enables or disables the ability of clients to inhibit keyboard shortcuts for a view."
(dispatch-command (sway-dispatch-command
(string-append "scratchpad " (if flag "enabled" "disabled")))) (string-append "scratchpad " (if flag "enabled" "disabled"))))
(define SWAY-SPLIT-VERTICAL "vertical") (define SWAY-SPLIT-VERTICAL "vertical")
@ -685,7 +683,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
the effect of a previous split is undone. the effect of a previous split is undone.
parameters: parameters:
- option: `SWAY-SPLIT-VERTICAL`, `SWAY-SPLIT-HORIZONTAL`, `SWAY-SPLIT-NONE`, `SWAY-SPLIT-TOGGLE`" - option: `SWAY-SPLIT-VERTICAL`, `SWAY-SPLIT-HORIZONTAL`, `SWAY-SPLIT-NONE`, `SWAY-SPLIT-TOGGLE`"
(dispatch-command (sway-dispatch-command
(string-append "split " option))) (string-append "split " option)))
(define SWAY-STICKY-ENABLE "enable") (define SWAY-STICKY-ENABLE "enable")
@ -696,7 +694,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Sticks a floating window to the current output so that it shows up on all workspaces. "Sticks a floating window to the current output so that it shows up on all workspaces.
parameters: parameters:
- flag: `SWAY-STICKY-ENABLE`, `SWAY-STICKY-DISABLE`, `SWAY-STICKY-TOGGLE`" - flag: `SWAY-STICKY-ENABLE`, `SWAY-STICKY-DISABLE`, `SWAY-STICKY-TOGGLE`"
(dispatch-command (sway-dispatch-command
(string-append "sticky " (cond (string-append "sticky " (cond
((equal? #t flag) SWAY-STICKY-ENABLE) ((equal? #t flag) SWAY-STICKY-ENABLE)
((equal? #f flag) SWAY-STICKY-DISABLE) ((equal? #f flag) SWAY-STICKY-DISABLE)
@ -713,7 +711,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- type: `SWAY-SWAY-CONTAINER-TYPE-ID`, `SWAY-SWAY-CONTAINER-TYPE-CONTAINER-ID`, - type: `SWAY-SWAY-CONTAINER-TYPE-ID`, `SWAY-SWAY-CONTAINER-TYPE-CONTAINER-ID`,
`SWAY-SWAY-CONTAINER-TYPE-MARK` `SWAY-SWAY-CONTAINER-TYPE-MARK`
- arg: argument passed (based on selected type)" - arg: argument passed (based on selected type)"
(dispatch-command (sway-dispatch-command
(string-append "swap container with " type " " (string-append "swap container with " type " "
(if (number? arg) (if (number? arg)
(number->string arg) (number->string arg)
@ -729,7 +727,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
%instance - The X11 instance (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)" %shell - The protocol the window is using (typically xwayland or xdg_shell)"
(dispatch-command (sway-dispatch-command
(string-append "title_format " format))) (string-append "title_format " format)))
(define (sway-assign-to-workspace criteria workspace) (define (sway-assign-to-workspace criteria workspace)
@ -737,7 +735,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- criteria: a criteria string, use (sway-criteria) to build a one - criteria: a criteria string, use (sway-criteria) to build a one
- workspace: workspace name" - workspace: workspace name"
(dispatch-command (sway-dispatch-command
(string-append "assign " criteria " workspace " (or (and (number? workspace) (string-append "assign " criteria " workspace " (or (and (number? workspace)
(number->string workspace)) (number->string workspace))
workspace)))) workspace))))
@ -747,7 +745,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- criteria: a criteria string, use (sway-criteria) to build a one - criteria: a criteria string, use (sway-criteria) to build a one
- output: output name" - output: output name"
(dispatch-command (sway-dispatch-command
(string-append "assign " criteria " output " output))) (string-append "assign " criteria " output " output)))
(define* (sway-bindsym key command #:key whole-window border exclude-titlebar (define* (sway-bindsym key command #:key whole-window border exclude-titlebar
@ -769,7 +767,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- no-repeat: the command will not be run repeatedly when the key is held - no-repeat: the command will not be run repeatedly when the key is held
- inhibited: keyboard shortcuts run also when inhibitor is active for the currently focused window. - inhibited: keyboard shortcuts run also when inhibitor is active for the currently focused window.
- group: binding will only be available for specified group." - group: binding will only be available for specified group."
(dispatch-command (sway-dispatch-command
(string-append "bindsym " (string-append "bindsym "
(string-join (string-join
(filter (lambda (x) (> (string-length x) 0)) (filter (lambda (x) (> (string-length x) 0))
@ -806,7 +804,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- no-repeat: the command will not be run repeatedly when the key is held - no-repeat: the command will not be run repeatedly when the key is held
- inhibited: keyboard shortcuts run also when inhibitor is active for the currently focused window. - inhibited: keyboard shortcuts run also when inhibitor is active for the currently focused window.
- group: binding will only be available for specified group." - group: binding will only be available for specified group."
(dispatch-command (sway-dispatch-command
(string-append "bindcode " (string-append "bindcode "
(string-join (string-join
(filter (lambda (x) (> (string-length x) 0)) (filter (lambda (x) (> (string-length x) 0))
@ -834,7 +832,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- locked: run command also when screen locking program is active - locked: run command also when screen locking program is active
- no-warn: silence sway warning when overriding a keybinding - no-warn: silence sway warning when overriding a keybinding
- reload: the binding should also be executed when the config is reloaded." - reload: the binding should also be executed when the config is reloaded."
(dispatch-command (sway-dispatch-command
(string-append "bindswitch " (string-append "bindswitch "
(string-join (string-join
(filter (lambda (x) (> (string-length x) 0)) (filter (lambda (x) (> (string-length x) 0))
@ -903,7 +901,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- switch: Supported switches are lid (laptop lid) and tablet (tablet mode) switches. - switch: Supported switches are lid (laptop lid) and tablet (tablet mode) switches.
- state: valid values are on, off and toggle." - state: valid values are on, off and toggle."
(dispatch-command (sway-dispatch-command
(string-append "unbindswitch " switch ":" state))) (string-append "unbindswitch " switch ":" state)))
;; TODO ;; TODO
@ -925,7 +923,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- to-code: the keysyms will be translated into the corresponding keycodes - to-code: the keysyms will be translated into the corresponding keycodes
this will make them layout independant this will make them layout independant
- input-device: the binding will only be executed for specified input device" - input-device: the binding will only be executed for specified input device"
(dispatch-command (sway-dispatch-command
(string-append "unbindsym " (string-append "unbindsym "
(string-join (string-join
(filter (lambda (x) (> (string-length x) 0)) (filter (lambda (x) (> (string-length x) 0))
@ -952,7 +950,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- release: command is executed when the key combo is released. - release: command is executed when the key combo is released.
- locked: run command also when screen locking program is active - locked: run command also when screen locking program is active
- input-device: the binding will only be executed for specified input device" - input-device: the binding will only be executed for specified input device"
(dispatch-command (sway-dispatch-command
(string-append "unbindcode " (string-append "unbindcode "
(string-join (string-join
(filter (lambda (x) (> (string-length x) 0)) (filter (lambda (x) (> (string-length x) 0))
@ -971,7 +969,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"remove identifier from the list of current marks on a window. "remove identifier from the list of current marks on a window.
Parameters: Parameters:
- mark: string mark." - mark: string mark."
(dispatch-command (sway-dispatch-command
(string-append "unmark " identifier))) (string-append "unmark " identifier)))
(define SWAY-URGENT-ENABLE "enable") (define SWAY-URGENT-ENABLE "enable")
@ -984,7 +982,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
Parameters: Parameters:
- flag: `SWAY-URGENT-ENABLE`, `SWAY-URGENT-DISABLE`, - flag: `SWAY-URGENT-ENABLE`, `SWAY-URGENT-DISABLE`,
`SWAY-URGENT-ALLOW`, `SWAY-URGENT-DENY`" `SWAY-URGENT-ALLOW`, `SWAY-URGENT-DENY`"
(dispatch-command (sway-dispatch-command
(string-append "urgent " flag))) (string-append "urgent " flag)))
;; The meaning of each color is: ;; The meaning of each color is:
@ -997,7 +995,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"This command is ignored and is only present for i3 compatibility. "This command is ignored and is only present for i3 compatibility.
parameters: parameters:
- color: color code to be used (str)" - color: color code to be used (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.background " color))) (string-append "client.background " color)))
(define* (sway-client-focused-color border-color background-color text-color (define* (sway-client-focused-color border-color background-color text-color
@ -1009,7 +1007,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- text-color: color code to be used for text (str) - text-color: color code to be used for text (str)
- indictor-color: color code to be used for indicator (str) - indictor-color: color code to be used for indicator (str)
- child-border-color: color code to be used for child border (str)" - child-border-color: color code to be used for child border (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.focused " border-color " " background-color " " text-color (string-append "client.focused " border-color " " background-color " " text-color
(if indictor-color (string-append " " indictor-color) "") (if indictor-color (string-append " " indictor-color) "")
(if child-border-color (string-append " " child-border-color) "")))) (if child-border-color (string-append " " child-border-color) ""))))
@ -1024,7 +1022,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- text-color: color code to be used for text (str) - text-color: color code to be used for text (str)
- indictor-color: color code to be used for indicator (str) - indictor-color: color code to be used for indicator (str)
- child-border-color: color code to be used for child border (str)" - child-border-color: color code to be used for child border (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.focused_inactive " border-color " " background-color " " text-color (string-append "client.focused_inactive " border-color " " background-color " " text-color
(if indictor-color (string-append " " indictor-color) "") (if indictor-color (string-append " " indictor-color) "")
(if child-border-color (string-append " " child-border-color) "")))) (if child-border-color (string-append " " child-border-color) ""))))
@ -1038,7 +1036,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- text-color: color code to be used for text (str) - text-color: color code to be used for text (str)
- indictor-color: color code to be used for indicator (str) - indictor-color: color code to be used for indicator (str)
- child-border-color: color code to be used for child border (str)" - child-border-color: color code to be used for child border (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.focused_tab_title " border-color " " background-color " " text-color))) (string-append "client.focused_tab_title " border-color " " background-color " " text-color)))
(define* (sway-client-placeholder-color border-color background-color text-color (define* (sway-client-placeholder-color border-color background-color text-color
@ -1050,7 +1048,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- text-color: color code to be used for text (str) - text-color: color code to be used for text (str)
- indictor-color: color code to be used for indicator (str) - indictor-color: color code to be used for indicator (str)
- child-border-color: color code to be used for child border (str)" - child-border-color: color code to be used for child border (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.placeholder " border-color " " background-color " " text-color (string-append "client.placeholder " border-color " " background-color " " text-color
(if indictor-color (string-append " " indictor-color) "") (if indictor-color (string-append " " indictor-color) "")
(if child-border-color (string-append " " child-border-color) "")))) (if child-border-color (string-append " " child-border-color) ""))))
@ -1065,7 +1063,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- text-color: color code to be used for text (str) - text-color: color code to be used for text (str)
- indictor-color: color code to be used for indicator (str) - indictor-color: color code to be used for indicator (str)
- child-border-color: color code to be used for child border (str)" - child-border-color: color code to be used for child border (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.unfocused " border-color " " background-color " " text-color (string-append "client.unfocused " border-color " " background-color " " text-color
(if indictor-color (string-append " " indictor-color) "") (if indictor-color (string-append " " indictor-color) "")
(if child-border-color (string-append " " child-border-color) "")))) (if child-border-color (string-append " " child-border-color) ""))))
@ -1080,7 +1078,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- text-color: color code to be used for text (str) - text-color: color code to be used for text (str)
- indictor-color: color code to be used for indicator (str) - indictor-color: color code to be used for indicator (str)
- child-border-color: color code to be used for child border (str)" - child-border-color: color code to be used for child border (str)"
(dispatch-command (sway-dispatch-command
(string-append "client.urgent " border-color " " background-color " " text-color (string-append "client.urgent " border-color " " background-color " " text-color
(if indictor-color (string-append " " indictor-color) "") (if indictor-color (string-append " " indictor-color) "")
(if child-border-color (string-append " " child-border-color) "")))) (if child-border-color (string-append " " child-border-color) ""))))
@ -1094,7 +1092,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- type: color code to be used for border (str) - type: color code to be used for border (str)
- n: units in case pixel is chosen (number)" - n: units in case pixel is chosen (number)"
(dispatch-command (sway-dispatch-command
(string-append "default_border " type " " (if n (number->string n) "")))) (string-append "default_border " type " " (if n (number->string n) ""))))
(define* (sway-default-floating-border-style type #:key n) (define* (sway-default-floating-border-style type #:key n)
@ -1102,21 +1100,21 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- type: color code to be used for border (str) - type: color code to be used for border (str)
- n: units in case pixel is chosen (number)" - n: units in case pixel is chosen (number)"
(dispatch-command (sway-dispatch-command
(string-append "default_floating_border " type " " (if n (number->string n) "")))) (string-append "default_floating_border " type " " (if n (number->string n) ""))))
(define (sway-exec command) (define (sway-exec command)
"Executes shell command with sh. "Executes shell command with sh.
parameters: parameters:
- command: command to be executed (str)" - command: command to be executed (str)"
(dispatch-command (sway-dispatch-command
(string-append "exec " command))) (string-append "exec " command)))
(define (sway-exec-always command) (define (sway-exec-always command)
"Like exec, but the shell command will be executed again after reload. "Like exec, but the shell command will be executed again after reload.
parameters: parameters:
- command: command to be executed (str)" - command: command to be executed (str)"
(dispatch-command (sway-dispatch-command
(string-append "exec_always " command))) (string-append "exec_always " command)))
(define (sway-floating-maximum-size width height) (define (sway-floating-maximum-size width height)
@ -1124,7 +1122,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- width: target size width (number) - width: target size width (number)
- height: target size height (number)" - height: target size height (number)"
(dispatch-command (sway-dispatch-command
(string-append "floating_maximum_size " (string-append "floating_maximum_size "
(number->string width) " x " (number->string width) " x "
(number->string height)))) (number->string height))))
@ -1134,7 +1132,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- width: target size width (number) - width: target size width (number)
- height: target size height (number)" - height: target size height (number)"
(dispatch-command (sway-dispatch-command
(string-append "floating_minimum_size " (string-append "floating_minimum_size "
(number->string width) " x " (number->string width) " x "
(number->string height)))) (number->string height))))
@ -1148,7 +1146,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- modifier: the modifier key (str) - modifier: the modifier key (str)
- type: `SWAY-FLOATING-MODIFIER-TYPE-NORMAL`, `SWAY-FLOATING-MODIFIER-TYPE-INVERSE`" - type: `SWAY-FLOATING-MODIFIER-TYPE-NORMAL`, `SWAY-FLOATING-MODIFIER-TYPE-INVERSE`"
(dispatch-command (sway-dispatch-command
(string-append "floating_modifier" modifier " x " type))) (string-append "floating_modifier" modifier " x " type)))
(define SWAY-FOCUS-FOLLOW-MOUSE-FLAG-YES "yes") (define SWAY-FOCUS-FOLLOW-MOUSE-FLAG-YES "yes")
@ -1162,7 +1160,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- flag: `SWAY-FOCUS-FOLLOW-MOUSE-FLAG-YES`, `SWAY-FOCUS-FOLLOW-MOUSE-FLAG-NO`, - flag: `SWAY-FOCUS-FOLLOW-MOUSE-FLAG-YES`, `SWAY-FOCUS-FOLLOW-MOUSE-FLAG-NO`,
`SWAY-FOCUS-FOLLOW-MOUSE-FLAG-ALWAYS`" `SWAY-FOCUS-FOLLOW-MOUSE-FLAG-ALWAYS`"
(dispatch-command (sway-dispatch-command
(string-append "focus_follows_mouse " flag))) (string-append "focus_follows_mouse " flag)))
(define SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-SMART "smart") (define SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-SMART "smart")
@ -1175,7 +1173,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- flag: `SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-SMART`, `SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-URGENT`, - 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`" `SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-FOCUS`, `SWAY-FOCUS-ON-WINDOW-ACTIVATION-FLAG-NONE`"
(dispatch-command (sway-dispatch-command
(string-append "focus_on_window_activation " flag))) (string-append "focus_on_window_activation " flag)))
(define SWAY-FOCUS-WRAPPING-FLAG-YES "yes") (define SWAY-FOCUS-WRAPPING-FLAG-YES "yes")
@ -1188,7 +1186,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- flag: `SWAY-FOCUS-WRAPPING-FLAG-YES`, `SWAY-FOCUS-WRAPPING-FLAG-NO`, - flag: `SWAY-FOCUS-WRAPPING-FLAG-YES`, `SWAY-FOCUS-WRAPPING-FLAG-NO`,
`SWAY-FOCUS-WRAPPING-FLAG-FORCE`, `SWAY-FOCUS-WRAPPING-FLAG-WORKSPACE`" `SWAY-FOCUS-WRAPPING-FLAG-FORCE`, `SWAY-FOCUS-WRAPPING-FLAG-WORKSPACE`"
(dispatch-command (sway-dispatch-command
(string-append "focus_wrapping " flag))) (string-append "focus_wrapping " flag)))
(define* (sway-font font #:key pango) (define* (sway-font font #:key pango)
@ -1197,21 +1195,21 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- font: font name (str) - font: font name (str)
- pango: whether to use pango or not (boolean)" - pango: whether to use pango or not (boolean)"
(dispatch-command (sway-dispatch-command
(string-append "font " (if pango "pango:" "") font))) (string-append "font " (if pango "pango:" "") font)))
(define (sway-force-display-urgency-hint timeout) (define (sway-force-display-urgency-hint timeout)
"If an application on another workspace sets an urgency hint. "If an application on another workspace sets an urgency hint.
parameters: parameters:
- timeout: urgency timeout (number)" - timeout: urgency timeout (number)"
(dispatch-command (sway-dispatch-command
(string-append "force_display_urgency_hint " (number->string timeout)))) (string-append "force_display_urgency_hint " (number->string timeout))))
(define (sway-titlebar-border-thickness thickness) (define (sway-titlebar-border-thickness thickness)
"Thickness of the titlebar border in pixels. "Thickness of the titlebar border in pixels.
parameters: parameters:
- thickness: thickness of border (number)" - thickness: thickness of border (number)"
(dispatch-command (sway-dispatch-command
(string-append "titlebar_border_thickness " (number->string thickness)))) (string-append "titlebar_border_thickness " (number->string thickness))))
(define (sway-titlebar-padding horizontal vertical) (define (sway-titlebar-padding horizontal vertical)
@ -1219,7 +1217,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- horizontal: horizontal padding (number) - horizontal: horizontal padding (number)
- vertical: vertical padding (number)" - vertical: vertical padding (number)"
(dispatch-command (sway-dispatch-command
(string-append "titlebar_padding " (number->string horizontal) (string-append "titlebar_padding " (number->string horizontal)
" " (number->string vertical)))) " " (number->string vertical))))
@ -1229,7 +1227,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- criteria: a criteria string, use (sway-criteria) to build a one - criteria: a criteria string, use (sway-criteria) to build a one
- command: list of commands to execute (string)" - command: list of commands to execute (string)"
(dispatch-command (sway-dispatch-command
(string-append "for_window " criteria " " commands))) (string-append "for_window " criteria " " commands)))
(define (sway-default-gaps option amount) (define (sway-default-gaps option amount)
@ -1239,7 +1237,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
`SWAY-GAPS-OPTION-VERTICAL`, `SWAY-GAPS-OPTION-TOP`, `SWAY-GAPS-OPTION-RIGHT`, `SWAY-GAPS-OPTION-VERTICAL`, `SWAY-GAPS-OPTION-TOP`, `SWAY-GAPS-OPTION-RIGHT`,
`SWAY-GAPS-OPTION-BOTTOM`, `SWAY-GAPS-OPTION-LEFT` `SWAY-GAPS-OPTION-BOTTOM`, `SWAY-GAPS-OPTION-LEFT`
- amount: amount of gap (number)" - amount: amount of gap (number)"
(dispatch-command (sway-dispatch-command
(string-append "gaps " option " " (number->string amount)))) (string-append "gaps " option " " (number->string amount))))
(define SWAY-EDGE-BORDER-TYPE-NONE "none") (define SWAY-EDGE-BORDER-TYPE-NONE "none")
@ -1255,7 +1253,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
- type: `SWAY-EDGE-BORDER-TYPE-NONE`, `SWAY-EDGE-BORDER-TYPE-VERTICAL`, `SWAY-EDGE-BORDER-TYPE-HORIZONTAL`, - 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` `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" - i3: enables i3-compatible behavior to hide the title bar on tabbed and stacked containers with one child"
(dispatch-command (sway-dispatch-command
(string-append "hide_edge_borders " (if i3 "--i3 " "") type))) (string-append "hide_edge_borders " (if i3 "--i3 " "") type)))
(define (sway-input device subcommands) (define (sway-input device subcommands)
@ -1263,7 +1261,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- device: the name of the target device - device: the name of the target device
- subcommands: list of commands to execute (string)" - subcommands: list of commands to execute (string)"
(dispatch-command (sway-dispatch-command
(string-append "input " device " " subcommands))) (string-append "input " device " " subcommands)))
(define (sway-seat seat subcommands) (define (sway-seat seat subcommands)
@ -1271,12 +1269,12 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- seat: the name of the seat device - seat: the name of the seat device
- subcommands: list of commands to execute (string)" - subcommands: list of commands to execute (string)"
(dispatch-command (sway-dispatch-command
(string-append "seat " seat " " subcommands))) (string-append "seat " seat " " subcommands)))
(define (sway-kill) (define (sway-kill)
"Kills (closes) the currently focused container and all of its children." "Kills (closes) the currently focused container and all of its children."
(dispatch-command (sway-dispatch-command
(string-append "kill"))) (string-append "kill")))
(define SWAY-SMART-BORDERS-ON "on") (define SWAY-SMART-BORDERS-ON "on")
@ -1288,7 +1286,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
workspace has more than one visible child. workspace has more than one visible child.
parameters: parameters:
- flag: `SWAY-SMART-BORDERS-ON`, `SWAY-SMART-BORDERS-OFF`, `SWAY-SMART-BORDERS-NO-GAPS`" - flag: `SWAY-SMART-BORDERS-ON`, `SWAY-SMART-BORDERS-OFF`, `SWAY-SMART-BORDERS-NO-GAPS`"
(dispatch-command (sway-dispatch-command
(string-append "smart_borders " (cond (string-append "smart_borders " (cond
((equal? flag #t) SWAY-SMART-BORDERS-ON) ((equal? flag #t) SWAY-SMART-BORDERS-ON)
((equal? flag #f) SWAY-SMART-BORDERS-OFF) ((equal? flag #f) SWAY-SMART-BORDERS-OFF)
@ -1305,7 +1303,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- flag: `SWAY-SMART-GAPS-ON`, `SWAY-SMART-GAPS-OFF`, - flag: `SWAY-SMART-GAPS-ON`, `SWAY-SMART-GAPS-OFF`,
`SWAY-SMART-GAPS-TOGGLE`, `SWAY-SMART-GAPS-INVERSE-OUTER`" `SWAY-SMART-GAPS-TOGGLE`, `SWAY-SMART-GAPS-INVERSE-OUTER`"
(dispatch-command (sway-dispatch-command
(string-append "smart_gaps " (cond (string-append "smart_gaps " (cond
((equal? flag #t) SWAY-SMART-GAPS-ON) ((equal? flag #t) SWAY-SMART-GAPS-ON)
((equal? flag #f) SWAY-SMART-GAPS-OFF) ((equal? flag #f) SWAY-SMART-GAPS-OFF)
@ -1324,7 +1322,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Switches to the specified mode. The default mode is default. "Switches to the specified mode. The default mode is default.
parameters: parameters:
- mode: name of the mode (str)" - mode: name of the mode (str)"
(dispatch-command (sway-dispatch-command
(string-append "mode \"" mode "\""))) (string-append "mode \"" mode "\"")))
(define (sway-mode-subcommand mode subcommand) (define (sway-mode-subcommand mode subcommand)
@ -1332,7 +1330,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- mode: name of the mode (str) - mode: name of the mode (str)
- subcommand: list of subcommands (str)" - subcommand: list of subcommands (str)"
(dispatch-command (sway-dispatch-command
(string-append "mode \"" mode "\" " subcommand))) (string-append "mode \"" mode "\" " subcommand)))
(define SWAY-MOUSE-WARPING-OUTPUT "output") (define SWAY-MOUSE-WARPING-OUTPUT "output")
@ -1344,14 +1342,14 @@ If the units are omitted, floating containers are resized in px and tiled contai
If container is specified, the mouse will be moved to the middle of the container on switch. If container is specified, the mouse will be moved to the middle of the container on switch.
parameters: parameters:
- mode: `SWAY-MOUSE-WARPING-OUTPUT`, `SWAY-MOUSE-WARPING-CONTAINER`, `SWAY-MOUSE-WARPING-NONE`" - mode: `SWAY-MOUSE-WARPING-OUTPUT`, `SWAY-MOUSE-WARPING-CONTAINER`, `SWAY-MOUSE-WARPING-NONE`"
(dispatch-command (sway-dispatch-command
(string-append "mouse_warping " mode))) (string-append "mouse_warping " mode)))
(define (sway-no-focus criteria) (define (sway-no-focus criteria)
"Prevents windows matching <criteria> from being focused automatically when they're created. "Prevents windows matching <criteria> from being focused automatically when they're created.
parameters: parameters:
- criteria: a criteria string, use (sway-criteria) to build a one" - criteria: a criteria string, use (sway-criteria) to build a one"
(dispatch-command (sway-dispatch-command
(string-append "no_focus " criteria))) (string-append "no_focus " criteria)))
(define (sway-output output subcommands) (define (sway-output output subcommands)
@ -1359,7 +1357,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- output: name of the output (str) - output: name of the output (str)
- subcommand: list of subcommands (str)" - subcommand: list of subcommands (str)"
(dispatch-command (sway-dispatch-command
(string-append "output " output " " subcommands))) (string-append "output " output " " subcommands)))
(define SWAY-POPUP-TYPE-OUTPUTSMART "outputsmart") (define SWAY-POPUP-TYPE-OUTPUTSMART "outputsmart")
@ -1370,7 +1368,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Determines what to do when a fullscreen view opens a dialog. "Determines what to do when a fullscreen view opens a dialog.
parameters: parameters:
- type: `SWAY-POPUP-TYPE-OUTPUTSMART`, `SWAY-POPUP-TYPE-IGNORE`, `SWAY-POPUP-TYPE-LEAVE-FULLSCREEN`" - type: `SWAY-POPUP-TYPE-OUTPUTSMART`, `SWAY-POPUP-TYPE-IGNORE`, `SWAY-POPUP-TYPE-LEAVE-FULLSCREEN`"
(dispatch-command (sway-dispatch-command
(string-append "popup_during_fullscreen " type))) (string-append "popup_during_fullscreen " type)))
(define SWAY-PRIMARY-SELECTION-ENABLED "enabled") (define SWAY-PRIMARY-SELECTION-ENABLED "enabled")
@ -1380,7 +1378,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Enable or disable the primary selection clipboard. May only be configured at launch. Default is enabled. "Enable or disable the primary selection clipboard. May only be configured at launch. Default is enabled.
parameters: parameters:
- type: `SWAY-PRIMARY-SELECTION-ENABLED`, `SWAY-PRIMARY-SELECTION-DISABLED`" - type: `SWAY-PRIMARY-SELECTION-ENABLED`, `SWAY-PRIMARY-SELECTION-DISABLED`"
(dispatch-command (sway-dispatch-command
(string-append "primary_selection " (cond (string-append "primary_selection " (cond
((equal? type #t) SWAY-PRIMARY-SELECTION-ENABLED) ((equal? type #t) SWAY-PRIMARY-SELECTION-ENABLED)
((equal? type #f) SWAY-PRIMARY-SELECTION-DISABLED) ((equal? type #f) SWAY-PRIMARY-SELECTION-DISABLED)
@ -1393,7 +1391,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"If show_marks is yes, marks will be displayed in the window borders. "If show_marks is yes, marks will be displayed in the window borders.
parameters: parameters:
- flag: `SWAY-SHOW-MARKS-YES`, `SWAY-SHOW-MARKS-NO`" - flag: `SWAY-SHOW-MARKS-YES`, `SWAY-SHOW-MARKS-NO`"
(dispatch-command (sway-dispatch-command
(string-append "show_marks " (cond (string-append "show_marks " (cond
((equal? flag #t) SWAY-SHOW-MARKS-YES) ((equal? flag #t) SWAY-SHOW-MARKS-YES)
((equal? flag #f) SWAY-SHOW-MARKS-NO) ((equal? flag #f) SWAY-SHOW-MARKS-NO)
@ -1408,7 +1406,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- type: `SWAY-OPACITY-SET`, `SWAY-OPACITY-PLUS`, `SWAY-OPACITY-MINUS` - type: `SWAY-OPACITY-SET`, `SWAY-OPACITY-PLUS`, `SWAY-OPACITY-MINUS`
- value: opacity value (number) should be between 0 and 1" - value: opacity value (number) should be between 0 and 1"
(dispatch-command (sway-dispatch-command
(string-append "opacity " type " " (number->string value)))) (string-append "opacity " type " " (number->string value))))
(define SWAY-TILING-DRAG-ENABLE "enable") (define SWAY-TILING-DRAG-ENABLE "enable")
@ -1419,7 +1417,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Sets whether or not tiling containers can be dragged with the mouse. "Sets whether or not tiling containers can be dragged with the mouse.
parameters: parameters:
- flag: `SWAY-TILING-DRAG-ENABLE`, `SWAY-TILING-DRAG-DISABLE`, `SWAY-TILING-DRAG-TOGGLE`" - flag: `SWAY-TILING-DRAG-ENABLE`, `SWAY-TILING-DRAG-DISABLE`, `SWAY-TILING-DRAG-TOGGLE`"
(dispatch-command (sway-dispatch-command
(string-append "tiling_drag " (cond (string-append "tiling_drag " (cond
((equal? flag #t) SWAY-TILING-DRAG-ENABLE) ((equal? flag #t) SWAY-TILING-DRAG-ENABLE)
((equal? flag #f) SWAY-TILING-DRAG-DISABLE) ((equal? flag #f) SWAY-TILING-DRAG-DISABLE)
@ -1429,7 +1427,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Sets whether or not tiling containers can be dragged with the mouse. "Sets whether or not tiling containers can be dragged with the mouse.
parameters: parameters:
- threshold: threshold value (number)" - threshold: threshold value (number)"
(dispatch-command (sway-dispatch-command
(string-append "tiling_drag_threshold " (number->string threshold)))) (string-append "tiling_drag_threshold " (number->string threshold))))
(define SWAY-TILING-ALIGN-LEFT "left") (define SWAY-TILING-ALIGN-LEFT "left")
@ -1440,7 +1438,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"Sets the title alignment. "Sets the title alignment.
parameters: parameters:
- type: `SWAY-TILING-ALIGN-LEFT`, `SWAY-TILING-ALIGN-CENTER`, `SWAY-TILING-ALIGN-RIGHT`" - type: `SWAY-TILING-ALIGN-LEFT`, `SWAY-TILING-ALIGN-CENTER`, `SWAY-TILING-ALIGN-RIGHT`"
(dispatch-command (sway-dispatch-command
(string-append "title_align " type))) (string-append "title_align " type)))
(define* (sway-switch-workspace-id id #:key auto-back-and-forth) (define* (sway-switch-workspace-id id #:key auto-back-and-forth)
@ -1448,7 +1446,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- id: workspace id (number) - id: workspace id (number)
- auto-back-and-forth: enable/disable auto back and forth" - auto-back-and-forth: enable/disable auto back and forth"
(dispatch-command (sway-dispatch-command
(string-append "workspace number " (string-append "workspace number "
(unless auto-back-and-forth "--no-auto-back-and-forth ") (unless auto-back-and-forth "--no-auto-back-and-forth ")
(number->string id)))) (number->string id))))
@ -1458,7 +1456,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- workspace: workspace name (str) - workspace: workspace name (str)
- auto-back-and-forth: enable/disable auto back and forth" - auto-back-and-forth: enable/disable auto back and forth"
(dispatch-command (sway-dispatch-command
(string-append "workspace " (string-append "workspace "
(unless auto-back-and-forth "--no-auto-back-and-forth ") (unless auto-back-and-forth "--no-auto-back-and-forth ")
workspace))) workspace)))
@ -1468,7 +1466,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
parameters: parameters:
- workspace: workspace name (str) - workspace: workspace name (str)
- output: output name" - output: output name"
(dispatch-command (sway-dispatch-command
(string-append "workspace " workspace " output " output))) (string-append "workspace " workspace " output " output)))
(define SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES "yes") (define SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES "yes")
@ -1478,7 +1476,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
"When yes, repeating a workspace switch command will switch back to the prior workspace. "When yes, repeating a workspace switch command will switch back to the prior workspace.
parameters: parameters:
- option: `SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES`, `SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-NO`" - option: `SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES`, `SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-NO`"
(dispatch-command (sway-dispatch-command
(string-append "workspace_auto_back_and_forth " (string-append "workspace_auto_back_and_forth "
(cond (cond
((equal? option #t) SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES) ((equal? option #t) SWAY-WORKSPACE-AUTO-BACK-AND-FORTH-OPTION-YES)
@ -1495,7 +1493,7 @@ If the units are omitted, floating containers are resized in px and tiled contai
`SWAY-GAPS-OPTION-VERTICAL`, `SWAY-GAPS-OPTION-TOP`, `SWAY-GAPS-OPTION-RIGHT`, `SWAY-GAPS-OPTION-VERTICAL`, `SWAY-GAPS-OPTION-TOP`, `SWAY-GAPS-OPTION-RIGHT`,
`SWAY-GAPS-OPTION-BOTTOM`, `SWAY-GAPS-OPTION-LEFT` `SWAY-GAPS-OPTION-BOTTOM`, `SWAY-GAPS-OPTION-LEFT`
- amount: the amount of gap (number)" - amount: the amount of gap (number)"
(dispatch-command (sway-dispatch-command
(string-append "workspace " workspace option (number->string amount)))) (string-append "workspace " workspace option (number->string amount))))
(define* (sway-criteria #:key app-id class con-id con-mark (define* (sway-criteria #:key app-id class con-id con-mark