aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
AgeCommit message (Collapse)Author
2019-12-04config: apply input type configs on reloadBrian Ashworth
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.
2019-11-27config: improvements to the reload validationBrian Ashworth
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.
2019-11-04smart_borders: separate smartness from edge typesRonan Pigott
2019-11-01Fix various memory leakslbonn
Found with clang-tidy
2019-10-31Skip line continuation when it is a commentRobert Günzler
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 '#'.
2019-08-20cmd_xwayland: add force for immediate launchBrian Ashworth
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
2019-07-09cmd_bindswitch: add option to execute on reloadBrian Ashworth
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.
2019-06-19config/xwayland: retain xwayland status on reloadBrian Ashworth
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.
2019-06-12bindings: defer while initiailizingBrian Ashworth
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.
2019-05-04Destroy swaybg client on reloadBrian Ashworth
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
2019-04-26config: fix clang warningKonstantin Pospelov
2019-04-26bindsym: change xkb_rule_names initializationKonstantin Pospelov
2019-04-26bindsym: consider xkb_rule_names for --to-codeKonstantin Pospelov
2019-04-26bindsym: change default keymap for --to-codeKonstantin Pospelov
Replace XKB_DEFAULT_LAYOUT with NULL as the default layout.
2019-04-26config: simplify keysym translation fieldsKonstantin Pospelov
Do not store `xkb_keymap` since it can be retrieved from `xkb_state`.
2019-04-26Implement bindsym --to-codeKonstantin Pospelov
* `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.
2019-04-14Implement input type configs (#3784)Benjamin Cheng
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.
2019-04-14Spawn swaynag as a wayland clientBrian Ashworth
This spawns swaynag as a wayland client similar to how swaybar and swaybg are already done
2019-04-04swaybg: one instance for all outputsBrian Ashworth
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.
2019-03-19Support WLR_INPUT_DEVICE_SWITCH in swayRyan Walklin
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)
2019-02-24add --i3 flag to hide_edge_bordersdb
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.
2019-02-24Make load_include_configs void. Fix some cases where WD would not be restored.Connor E
2019-02-16Fix reload freeze when not modsetting current modeBrian Ashworth
This fixes the issue of the display freezing on reload with wlroots#1545. On master, all output configs are applied on reload. This may cause an output to have its config applied up to three times, instead of just once. The three cases are: output name, output identifier, and wildcard. Not only is this inefficient, but it can cause swaybg to be spawned and immediately killed. However, swaybg requires two roundtrips of wl_display (to obtain needed globals) before it enters its normal event loop. Modesetting will roundtrip the wl_display. Without modesetting, waitpid for killing swaybg could block infinitely due to swaybg being blocked by wl_display_roundtrip. This only configured an output once. It either uses the wildcard config or creates an empty wildcard config and applies that. This also fixes a bug where an output would not be reset when there is no output config to apply to it.
2019-02-11fix misc memory leaksBrian Ashworth
This fixes a few misc memory leaks reported by asan: - Items of `config->config_chain` are now freed instead of just the list itself - `bar->swaybar_command` is now freed - The result returned by a seat subcommand is now returned instead of leaked
2019-02-07Revert "Return false if config could not be loaded."Drew DeVault
This reverts commit 855368b67e8b7d0b1dd035bde7f9119d37b35e5d.
2019-02-07Revert "Restore CWD if returning early."Drew DeVault
This reverts commit 921e42c6c06212a61d899d6335d95eb4c781e2e8.
2019-02-07load_main_config: use given path, store realpathBrian Ashworth
Since `load_include_config` compares against the realpath of a config file when checking if a config has already been added, the main config's realpath has to be added to the config_chain. However, includes from the main config should be processed relative to the path given to allow for symbolic links. This stores the realpath in `config->config_chain`, but uses the given path for all other operations.
2019-02-06Restore CWD if returning early.Connor E
2019-02-06Return false if config could not be loaded.Connor E
2019-02-06load_main_config: add realpath to config_chainBrian Ashworth
Since `load_include_config` compares against the realpath of a config file when checking if a config has already been added, the main config's realpath has to be added to the config_chain.
2019-02-05load_include_configs: fix wordexp fail conditionBrian Ashworth
This fixes the failure condition for the wordexp call in load_include_configs. The only success value is zero. Since the error codes are positive, having the check be less than zero was causing segfaults on failure when accessing the words.
2019-02-03seat_cmd_cursor: do not create non-existing seatBrian Ashworth
If a seat does not exist in seat_cmd_cursor, do not create it. A seat without any attachments is useless since it will have no capabilities. This changes `input_manager_get_seat` to have an additional argument that dictates whether or not to create the seat if it does not exist.
2019-02-03Skip wildcard seat config in destroy_removed_seatsvilhalmer
2019-01-29Cleanup config reading failure error logsBrian Ashworth
This cleans up the log when sway fails to read a config file. The following changes have been made: - A missing error message has been added to the log when the config file is a directory instead of a regular file - In main, `goto` statements have been added after the `sway_terminate` calls instead of wrapping every block in `if (!terminate_request)` - Unnecessary NULL-checks around calls to free in `main` have been removed - Deferred command execution has been extracted to a separate function and the `Running deferred commands` log message will not be shown when there are no deferred commands.
2019-01-21Replace wlr_log with sway_logM Stoeckl
This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-14Remove 'input' field of IPC command return jsonM Stoeckl
This field is not in i3 and provides imprecise and redundant information. (Specifically, when swaymsg is given a list of commands, the IPC return array already indicates precisely which number command failed; knowing the name of the command is not useful when multiple commands of the same type are provided.)
2019-01-13Merge pull request #3144 from emersion/cmd-xwaylandDrew DeVault
Add xwayland command
2019-01-13Merge pull request #3388 from RedSoxFan/reset-inputs-on-reloadDrew DeVault
reload: reset input configs
2019-01-11config: fix line number with continued linesBrian Ashworth
When the config has continued lines, `get_line_with_cont` may read more than one line of the actual file. When displaying line numbers for error messages, they should be the line number in the file to make it easy to find and fix the issue.
2019-01-11config: do not reset pos when braces foundBrian Ashworth
When a brace is found, the config file should not seek back to before the brace, otherwise the brace will be read multiple times.
2019-01-10Merge pull request #3400 from ianyfan/config-braceemersion
config.c: fix brace detection at end of file
2019-01-10config.c: fix brace detection at end of fileIan Fan
2019-01-09reload: reset input configsBrian Ashworth
This resets all input options to their defaults on reload. This also fixes some debug log typos in `input_manager_libinput_config_pointer`.
2019-01-09Simplify evdev includes on FreeBSD by relying on up-to-date packageJan Beich
evdev-proto is installed by a dependency, so some files have been missed: In file included from ../sway/input/cursor.c:3: /usr/local/include/libevdev-1.0/libevdev/libevdev.h:30:10: fatal error: 'linux/input.h' file not found #include <linux/input.h> ^~~~~~~~~~~~~~~ ../swaybar/i3bar.c:3:10: fatal error: 'linux/input-event-codes.h' file not found #include <linux/input-event-codes.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-09reload: apply seat cfgs after reading entire cfgBrian Ashworth
Wait until all seat configs have been read before applying them on reload. This prevents unnecessary attachment/detachment of input devices and therefore creation/destruction of seat devices as individual lines are read.
2019-01-08Merge pull request #3275 from ianyfan/remove-readlineemersion
Rewrite strip_whitespace and remove readline.c
2019-01-02Implement tiling_drag_thresholdBrian Ashworth
Implements `tiling_drag_threshold <threshold>` to prevent accidental dragging of tiling containers. If a container (and all of its descendants) are unfocused and the tile bar is pressed, a threshold will be used before actually starting the drag. Once the threshold has been exceeded, the cursor will change to the grab icon and the operation will switch from `OP_MOVE_TILING_THRESHOLD` to `OP_MOVE_TILING`.
2019-01-01fixup! config.c: re-enable backslash continuation in config fileIan Fan
2019-01-01config.c: re-enable backslash continuation in config fileIan Fan
2019-01-01Remove readline.cIan Fan
All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.