aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
AgeCommit message (Collapse)Author
2022-10-07sway/commands/output: Add command for unplugging non-physical outputsAndri Yngvason
2022-07-04Remove internal references to DPMSSimon Ser
While at it, use an int for the config field, just like we do for all other fields.
2022-07-01Reject font values that are invalid for pangoHugo Osvaldo Barrera
Use pango to parse font configuration early, and reject the command as invalid if the value is invalid for pango. Since we're already parsing the font into a `PangoFontDescription`, keep that instance around and avoid re-parsing the font each time we render text. Fixes: https://github.com/swaywm/sway/issues/6805
2022-07-01Avoid unecessary string copyHugo Osvaldo Barrera
2022-06-25Strip quotes in bindsym --input-device=...Thomas Jost
If the input device is quoted, which is common when using variables in the config file, those quotes must be ignored here, or the input device will be ignored. Fixes #7029.
2022-06-23Rename dpms output command to powerSimon Ser
The "dpms" command refers to VESA Display Power Management Signaling, a deprecated standard. It's superseded by VESA DPM. Instead of tying out command name to a particular standard, use the neutral term "power".
2022-06-22Remove access to wlr_input_device unionSimon Ser
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626 Closes: https://github.com/swaywm/sway/issues/7077
2022-05-30sway: add bindgesture commandFlorian Franzen
Co-authored-by: Michael Weiser <michael.weiser@gmx.de>
2022-04-28xkb_switch_layout: fix relative layout switchesVictor Makarov
Fixes #6011
2022-04-09Shuffle variables to satisfy -Werror=restrictDaniel De Graaf
This also fixes an invalid strlen invocation on uninitialized memory.
2022-03-17sway/input: follow up wlroots input device events renamingSimon Zeni
2022-03-08Remove WLR_SWITCH_STATE_TOGGLE usageSimon Ser
Ref [1]. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/4792446ee8f50104bd207d9ccd8558a7e4eb4514
2022-03-06commands/focus: fix segfault when no container is already focused.Nicolas Avrutin
Fixes #6690.
2022-02-21sway/commands: add missing wlr_keyboard interface include in xkb_switch_layoutSimon Zeni
2022-02-08Fix snprintf compiler warningMuhamed Hobi
2022-01-31chore: chase wlr_output_layout_get_box() updateKirill Primak
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3439
2022-01-22cmd/swap: error on swapping a container with itselfRonan Pigott
2022-01-18treat fullscreen windows as 'tiled' for commands/focusPatrick Hilhorst
2022-01-16commands/focus: drop trailing whitespaceSimon Ser
2022-01-09commands/move: Fix crash when pos_y is omittedDavid96
Fixes #6737
2021-12-10Add focused_tab_titleVsevolod
2021-11-25sway: replace noop_output by fallback_outputSimon Zeni
wlroots removed the support for the noop backend. Instead we rely on the headless backend to provide the fallback output.
2021-11-25ipc: make `bar <bar_id> mode|hidden_state` behave as documentedAleksei Bavshin
sway-bar(5) says: > For compatibility with i3, bar mode <mode> [<bar-id>] syntax is > supported along with the sway only bar <bar-id> mode <mode> syntax. while the actual behavior is that `bar_cmd_mode` ignores already selected `config->current_bar` and applies the change to all the configured bars.
2021-11-23Add 'output render_bit_depth [8|10]' commandManuel Stoeckl
This makes it possible to hint to the renderer and backends how many bits per channel the buffers that the compositor draws windows onto should have. Renderers and backends may deviate from this if they do not support the formats with higher bit depth.
2021-10-30Bump RLIMIT_NOFILESimon Ser
Wayland compositors handle many file descriptors: client connections, DMA-BUFs, sync_files, wl_data_device pipes, and so on. Bump the limit to the max. Closes: https://github.com/swaywm/sway/issues/6285
2021-10-29Add smart_gaps inverse_outer commandbR3iN
Add a subcommand for `smart_gaps` that enables outer gaps only on workspaces with exactly one visible child. Also add documentation for `smart_gaps toggle`.
2021-10-21commands/focus: focus view inside containersiikamiika
seat_get_focus_inactive_floating and seat_get_focus_inactive_tiling do not always return a view, so get the previously focused view from the container with seat_get_focus_inactive_view. This is the i3 behavior.
2021-09-20Avoid unecessary font metric calculationsHugo Osvaldo Barrera
Prior to 62d90a8e, titlebar's font height (and other related values) would change any time any titlebar's content changed, so these values were recalculated each time any titlebar's content changed (or a new titlebar was created). However, since the above was merge, these values no longer change so often and we only need to recalculate them when the configured font changes (and stop calling `config_update_font_height` each time titlebars are rendered). This commit removes all the unecessary calls to this function and avoids all those unecessary calculations. Whenever the font strays from the default value, the `font` command is called, and it calls `config_update_font_height`, which is enough to keep the value always up to date. I've also added a default value to the `font_baseline` config, since otherwise that's zero for setups that don't explicitly specify a font.
2021-09-04commands: update split none command for a047b5ee4Ronan Pigott
2021-09-03command: implement split noneRonan Pigott
2021-08-31Add `output modeline` commandDavid Rosca
Only works with DRM backend.
2021-08-26Use fixed titlebar heightsHugo Osvaldo Barrera
Use fixed titlebar heights. The default height is calculated based on font metrics for the configured font and current locale. Some testing with titles with emoji and CJK characters (which are substantially higher in my setup) shows that the titlebars retain their initial value, text does shift up or down, and all titlebars always remain aligned. Also drop some also now-unecessary title_height calculations. Makes also needed to be updated, since they should be positioned with the same rules.
2021-08-14cmd_bind_or_unbind_switch: fix copy/paste typo error messageEric Engestrom
`[0]` is the switch type, not its state; we want `[1]` for that, and it's a string not an int :)
2021-07-22Add `gaps <type> <scope> toggle <px>` commandbR3iN
Add a subcommand for `gaps` that allows to toggle gaps at runtime. This functionality is part of i3-gaps since [1] but is missing in sway. [1] https://github.com/Airblader/i3/pull/264
2021-07-07Update wlr_box includesSimon Ser
Update for the breaking change in [1]. [1]: https://github.com/swaywm/wlroots/pull/3011
2021-06-22Revert "Add workspace {prev,next}_on_output --create"Ragnar Groot Koerkamp
This reverts commit 487c83f0de9ca2a7650ad636eed6fd694ddcb82e. The --create flag is undocumented, not in i3, and at least partially broken (#5913), so this removes the feature.
2021-06-18Only call workspace_auto_back_and_forth when neededRagnar Groot Koerkamp
Instead of disabling it for some workspace subcommands, this explicitly calls it only in the 2 places it's actually needed: for switching to a named or numbered workspace.
2021-06-18Move auto_back_and_forth logic out of workspace_switchRagnar Groot Koerkamp
This extracts the code to a separate workspace_auto_back_and_forth function. It also removes the bool argument by adding an extra if statement at the call site, and repurposes the no_auto_back_and_forth variable to auto_back_and_forth for simpler understanding.
2021-06-18Fix #6299 Disable auto_back_and_forth for next_on_outputRagnar Groot Koerkamp
This forces no_auto_back_and_forth to true for `workspace next_on_output` and `workspace prev_on_output` to keep parity with i3. In i3, running next_on_output never changes focus to another output. In Sway currently, with workspace_auto_back_and_forth set to yet, running next_on_output on an output with only a single active workspace will typically end up focussing the other output: 1. next_on_output focusses the current workspace, because it's the only one 2. auto_back_and_forth focusses the last focussed workspace, because the current workspace to focus is the current one. This will usually be on the other monitor if the workspace there was last focussed.
2021-06-05sway: commands: exec: restore SIGPIPE before exec:ingDaniel Eklöf
Sway ignores SIGPIPE (by installing a SIG_IGN handler), in order to “prevent IPC from crashing Sway”. SIG_IGN handlers are the *only* signal handlers inherited in sub-processes. As such, we should be a good citizen and restore the SIGPIPE handler to its default handler. Original bug report: https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1806907.html
2021-06-03config: Fix swaybar pango_markup inconsistencyDaniel Otero
Until now, swaybar did not have pango markup enabled by default, even if the sway config had it on. This patch aims to mimic the i3 behavior, but maintaining the functionality of the "pango_markup" sway config command.
2021-06-03Only defer seat attachment during initial startupBill Doyle
Deferred commands are only run once, during sway startup. This means that deferring seat attachment based on whether we are reading the config prevents devices from being reattached to the correct seat during a config reload. Instead, only defer if the config is not yet active. Fixes #6048.
2021-05-10commands/exec: stop truncating >4095-byte commandsManuel Stoeckl
2021-05-10cmd_fullscreen: ignore fullscreen request on workspacesRonan Pigott
2021-04-22commands/exec_always: log error on execlp failureSimon Ser
And exit(1) instead of indicating success.
2021-04-22Use execlp("sh") instead of execl("/bin/sh")Simon Ser
This stops assuming the POSIX shell command is located in /bin.
2021-04-18Prevent use-after-free on first bar subcommand errorMichael Weiser
If any error is encountered during execution of the first subcommand of a freshly created bar configuration, parsing apparently is to be aborted and the current bar config is freed. The pointer to that memory is left dangling though, leading to a use-after-free on successive bar subcommands. This quite reliably ends in a crash like so: sway -c reproducer.config 00:00:00.083 [sway/config.c:865] Error on line 2 'foo bar': Unknown/invalid command 'foo' (s) free(): double free detected in tcache 2 00:00:00.608 [swaynag/swaynag.c:451] failed to register with the wayland display Aborted (core dumped) Minimal reproducer config: bar { foo bar position top } Other messages: malloc(): unaligned fastbin chunk detected double free or corruption (fasttop) The invalid command has to be the first for a newly created bar config. Removing the command or switching order so it's not the first one masks the problem. Prevent this from occuring by resetting the pointer to NULL after freeing the memory. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2021-04-16cmd_fullscreen: allow fullscreen on fullscreen split containersRonan Pigott
Using the fullscreen command on a child of a fullscreen split container will now fullscreen the child instead of unfullscreening the parent.
2021-03-25Add toggle logic inside DPMS handlerIvan Fedotov
Logic that obtains current DPMS state is put inside the handler. sway_output from which the current DPMS state will be obtained is selected by the following logic: * For '-' and '--' the focused output is used; * For '*' error "Cannot apply toggle to all outputs" is reported; * For everything else all_output_by_name_or_id() is used. Fixes #5929.
2021-02-25Fix for_window criteria and mouse button bindingsftilde
Previously, the special case handling of scratchpad and unmark commands was (probably accidentally) limited to criteria directly handled in the execute_command function. This would exclude: 1. for_window criteria, as these are handled externally for views and 2. and mouse bindings which select target the node currently under the mouse cursor. As a concrete example `for_window [app_id="foobar"] move scratchpad, scratchpad show` would show (or hide due to the toggling functionality) another window from the scratchpad, instead of showing the window with app_id "foobar". This commit replaces the "using_criteria" flag with "node_overridden" with the more general notion of signifying that the node (and container/workspace) in the current command handler context of the sway config is not defined by the currently focused node, but instead overridden by other means, i.e., criteria or mouse position.