aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
Commit message (Collapse)AuthorAge
* output/config: Remove reset_outputs and co.Libravatar Kenny Levinsen2024-03-28
| | | | | | | | | | | | | | | apply_output_config_to_outputs uses the specified output config to check which outputs to apply to, and to use as backup when no config is found. If any config matches the output, the specified config will be disregarded. The only remaining user of apply_output_config_to_outputs is reset_outputs, which called apply_output_config_to_outputs with either the first stored wildcard config, or a new empty wildcard config. Providing a stored or empty wildcard config is practically the same as calling `apply_all_output_configs`. Replace uses of `reset_outputs` with `apply_all_output_configs` and remove the now unused functions.
* config: add fallback without env vars for keysym translation XKB keymapLibravatar Simon Ser2024-03-06
|
* config: error out on keysym translation XKB state failureLibravatar Simon Ser2024-03-06
| | | | | | | | If we can't create the XKB keymap used for keysym translation, gracefully error out instead of crashing. This can happen if the XKB_DEFAULT_LAYOUT is set to an invalid value, for instance. Closes: https://github.com/swaywm/sway/issues/7789
* Define _POSIX_C_SOURCE globallyLibravatar Simon Ser2024-02-23
| | | | See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
* config: use format_str() instead of hand-rolled snprintf()Libravatar Simon Ser2024-02-08
|
* sway/config.c: only reset primary_selection at launchLibravatar Violet Purcell2024-02-05
| | | | | Otherwise, an error will be shown whenever reloading due to the value of primary_selection being reset to true.
* Drop old security config remnantsLibravatar Simon Ser2024-02-03
|
* sway/config.c: use `memcpy()` for known buffer sizeLibravatar Sergei Trofimovich2023-11-29
| | | | | | | | | | | | | | | | | `gcc-14` added a new warning around dangerous use of `strncpy()` withi known overflow: ../sway/config.c: In function 'do_var_replacement': ../sway/config.c:983:33: error: '__builtin___strncpy_chk' specified bound depends on the length of the source argument [-Werror=stringop-truncation] 983 | strncpy(newptr, var->value, vvlen); | ^ ../sway/config.c:971:45: note: length computed here 971 | int vvlen = strlen(var->value); | ^~~~~~~~~~~~~~~~~~ It's a bit fishy to rely on truncating behaviour of `strncpy()`. The change uses `memcpy()` as more explicit way to express copy of `vvlen` bytes.
* Use format_str() throughoutLibravatar Simon Ser2023-04-14
|
* input: enable user xkb configs with cap_sys_niceLibravatar Ronan Pigott2023-01-11
|
* Add `primary_selection` config optionLibravatar Aidan Dang2022-12-05
| | | | | | | | | | | | See: https://github.com/swaywm/sway/issues/4511 Adds a bool config option `primary_selection`, which explicitly enables/disables the primary selection clipboard. Defaults to enabled. This is implemented as a launch-only option which enables or disables the creation of the `zwp_primary_selection_device_manager_v1` global. Co-authored-by: Tilde Rose <t1lde@protonmail.com>
* Reject font values that are invalid for pangoLibravatar Hugo Osvaldo Barrera2022-07-01
| | | | | | | | | 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
* sway: add bindgesture commandLibravatar Florian Franzen2022-05-30
| | | | Co-authored-by: Michael Weiser <michael.weiser@gmx.de>
* Add focused_tab_titleLibravatar Vsevolod2021-12-10
|
* Add smart_gaps inverse_outer commandLibravatar bR3iN2021-10-29
| | | | | | 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`.
* Drop hardcoded font metric valuesLibravatar Hugo Osvaldo Barrera2021-09-20
|
* Avoid unecessary font metric calculationsLibravatar Hugo Osvaldo Barrera2021-09-20
| | | | | | | | | | | | | | | | | | | | | 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.
* Use fixed titlebar heightsLibravatar Hugo Osvaldo Barrera2021-08-26
| | | | | | | | | | | | | | | 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.
* Fix crash when starting without HOMELibravatar Tobias Stoeckmann2021-07-23
| | | | | | | | | | If HOME environment variable is not set, sway fails startup with a segmentation fault due to null pointer dereference. Also check calloc return value and only perform the fallback code when really needed. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* cairo: Replace <cairo/cairo.h> by <cairo.h>Libravatar Issam E. Maghni2021-05-10
| | | | | | | For full context, read https://gitlab.freedesktop.org/cairo/cairo/-/issues/479 TL;DR, cairo’s pc file adds `/cairo` to CFLAGS. So namespace cairo shouldn’t be used.
* config: allow whitespaces in config pathLibravatar columbarius2021-03-25
|
* Log when config file is not foundLibravatar Simon Ser2021-01-17
| | | | | This happens when Sway is not installed on the system, so there's no default config in /etc.
* Raise verbosity of error message in load_main_configLibravatar Simon Ser2021-01-17
|
* Reload command now matches i3's implementationLibravatar Geoffrey Casper2020-07-07
|
* Remove code related to the security featuresLibravatar Érico Rolim2020-05-21
| | | | | | - Remove struct definitions - Remove struct members - Remove initializations and frees
* config: fix unfocused text colorLibravatar Thomas Hebb2020-04-04
| | | | | | This color, both in i3 and as described in sway(5), defaults to #888888. However, the actual default also has an alpha of 88 instead of FF, meaning it ends up significantly darker than intended.
* Change focus_on_window_activation default to urgentLibravatar Simon Ser2020-03-29
| | | | | | | | | | Before the default was "smart". This means a visible app could steal focus whenever it wanted to. This can be an issue since having focus allows for e.g. clipboard access. This commit changes the default to "urgent" instead. Closes: https://github.com/swaywm/sway/issues/5139
* config: fix validation exit code and log levelLibravatar Brian Ashworth2020-02-11
| | | | | | | | | This makes it so invalid configs will return the exit code 1 when the validation flag is given. This also reduces the log level to SWAY_ERROR, which makes it so only the errors are shown. If someone wants more verbose output, the can use the -V/--verbose or -d/--debug flags. Additionally, this also makes it so swaybg will not be spawned when validating the config.
* cmd_client_*: refactor duplicated codeLibravatar Brian Ashworth2019-12-28
| | | | | | | | | | | | | This is the second in a series of commits to refactor the color handling in sway. This removes the duplicated color parsing code in sway/commands/client.c. Additionally, this combines the parsing of colors to float arrays with that in sway/config.c and introduces a color_to_rgba function in commom/util.c. As an added bonus, this also makes it so non of the colors in a border color class will be changed unless all of the colors specified are valid. This ensures that an invalid command does not get partially applied.
* config: apply input type configs on reloadLibravatar Brian Ashworth2019-12-04
| | | | | | When making the reload validation improvements, I forgot that input type configs are stored in a separate list. This makes it so input type configs are correctly applied on reload.
* config: improvements to the reload validationLibravatar Brian Ashworth2019-11-27
| | | | | | | | For the validation pass of reloading, there is no need to touch swaybg, swaynag, inputs, outputs, or seats. This drastically improves the speed of a reload by skipping over the expensive I/O configuration and handling of wayland clients. As long as the syntax is valid, the CMD_FAILURE's can be relayed during the actual reload.
* smart_borders: separate smartness from edge typesLibravatar Ronan Pigott2019-11-04
|
* Fix various memory leaksLibravatar lbonn2019-11-01
| | | | Found with clang-tidy
* Skip line continuation when it is a commentLibravatar Robert Günzler2019-10-31
| | | | | | | | | | | | | Currently commented lines ending in the backslash character will be concatenated with the following line. ``` # with this comment \ exec swaynag -m 'will not run' ``` This change modifies `getline_with_cont` to stop reading when the initial character is a '#'.
* cmd_xwayland: add force for immediate launchLibravatar Brian Ashworth2019-08-20
| | | | | | | This just adds a force option to cmd_xwayland that allows for xwayland to be immediately launched instead of lazily launched. This is useful for slower machines so it can be part of the startup time instead of when the user is actively trying to use it
* cmd_bindswitch: add option to execute on reloadLibravatar Brian Ashworth2019-07-09
| | | | | | | This adds a --reload flag to cmd_bindswitch that allows for the binding to be executed on reload. One possible use case for this is to allow users to disable outputs when the lid closes and enable them when the lid opens without having to open and re-close the lid after a reload.
* config/xwayland: retain xwayland status on reloadLibravatar Brian Ashworth2019-06-19
| | | | | | | | | | Since xwayland can only be enabled/disabled at launch, the xwayland status should be retained on reload. Having `xwayland enabled|disabled` in the config, should not cause `config->xwayland` to be invalid on reload. This also returns `CMD_FAILURE` with a message that xwayland can only be enabled/disabled on launch when trying to set the invalid status on reload. This allows swaynag to notify the user that the change will not take effect until sway is restarted.
* bindings: defer while initiailizingLibravatar Brian Ashworth2019-06-12
| | | | | | | | This adds the logic to defer binding execution while sway is still initializing. Without this, the binding command would be executed, but the command handler would return CMD_DEFER, which was being treated as a failure to run. To avoid partial executions, this will defer all bindings while config->active is false.
* Destroy swaybg client on reloadLibravatar Brian Ashworth2019-05-04
| | | | | | | | | | | | | When reloading, this destroys the old config's swaybg client before spawning the new config's swaybg. This fixes a race condition where the old config's swaybg client's destroy was being called after the new config's swaybg client was being spawned. This was causing the reference to the new swaybg client to be removed and never destroyed. This also modifies handle_swaybg_client_destroy to grab the config reference using wl_container_of on the listener since the swaybg client may be the old config swaybg client and should be used instead of the global config instance
* config: fix clang warningLibravatar Konstantin Pospelov2019-04-26
|
* bindsym: change xkb_rule_names initializationLibravatar Konstantin Pospelov2019-04-26
|
* bindsym: consider xkb_rule_names for --to-codeLibravatar Konstantin Pospelov2019-04-26
|
* bindsym: change default keymap for --to-codeLibravatar Konstantin Pospelov2019-04-26
| | | | Replace XKB_DEFAULT_LAYOUT with NULL as the default layout.
* config: simplify keysym translation fieldsLibravatar Konstantin Pospelov2019-04-26
| | | | Do not store `xkb_keymap` since it can be retrieved from `xkb_state`.
* Implement bindsym --to-codeLibravatar Konstantin Pospelov2019-04-26
| | | | | | | | | | | | * `bindsym --to-code` enables keysym to keycode translation. * If there are no `xkb_layout` commands in the config file, the translation uses the XKB_DEFAULT_LAYOUT value. * It there is one or more `xkb_layout` command, the translation uses the first one. * If the translation is unsuccessful, a message is logged and the binding is stored as BINDING_KEYSYM. * The binding keysyms are stored and re-translated when a change in the input configuration may affect the translated bindings.
* Implement input type configs (#3784)Libravatar Benjamin Cheng2019-04-14
| | | | | | | | | | | Add support for configurations that apply to a type of inputs (i.e. natural scrolling on all touchpads). A type config is differentiated by a `type:` prefix followed by the type it corresponds to. When new devices appear, the device config is merged on top of its type config (if it exists). New type configs are applied on top of existing configs.
* Spawn swaynag as a wayland clientLibravatar Brian Ashworth2019-04-14
| | | | | This spawns swaynag as a wayland client similar to how swaybar and swaybg are already done
* swaybg: one instance for all outputsLibravatar Brian Ashworth2019-04-04
| | | | | | | | | This makes it so there will only be one swaybg instance running instead of one per output. swaybg's cli has been changed to a xrandr like interface, where you select an output and then change properties for that output and then select another output and repeat. This also makes it so swaybg is only killed and respawned when a background changes or when reloading.
* Support WLR_INPUT_DEVICE_SWITCH in swayLibravatar Ryan Walklin2019-03-19
| | | | | | | | | | | | | | | | | | | | | This commit adds support for laptop lid and tablet mode switches as provided by evdev/libinput and handled by wlroots. Adds a new bindswitch command with syntax: bindswitch <switch>:<state> <command> Where <switch> is one of: tablet for WLR_SWITCH_TYPE_TABLET_MODE lid for WLR_SWITCH_TYPE_LID <state> is one of: on for WLR_SWITCH_STATE_ON off for WLR_SWITCH_STATE_OFF toggle for WLR_SWITCH_STATE_TOGGLE (Note that WLR_SWITCH_STATE_TOGGLE doesn't map to libinput and will trigger at both on and off events)
* add --i3 flag to hide_edge_bordersLibravatar db2019-02-24
| | | | | | | Enables i3-compatible behavior regarding hiding the title bar on tabbed and stacked containers with one child. Related issues and merge requests: #3031, #3002, #2912, #2987.