aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
AgeCommit message (Collapse)Author
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.
2019-01-01stringop.c: rewrite strip_whitespaceIan Fan
2018-12-30hide_cursor: change to a seat subcommandBrian Ashworth
This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
2018-12-30Verify seat fallback settings on reloadBrian Ashworth
This fixes an issue where on reload, all input devices that were added via an implicit fallback to the default seat would be removed from the default seat and applications would crash due to the seat having no capabilities. On reload, there is a query for a seat config with the fallback setting set (it can either be true or false). If no such seat config exists, the default seat is created (if needed) and has the implicit fallback true applied to its seat config. This is the same procedure that occurs when a new input is detected.
2018-12-25Implement hide_cursor <timeout> commandBrian Ashworth
Allows the cursor to be hidden after a specified timeout in milliseconds
2018-12-13Rework default output configsBrian Ashworth
Default output configs were generated on reload to reset an output to its default settings. The idea was that anything that was removed from the config or changed at runtime and not in the config should be reset on reload. Originally, they were created using the output name. Recently, they were changed to use the output identifier. It turns out that there are issues of shadowing with that solution as well. This should fix those issues. Instead of generating the default output configs on reload and storing them in the output config list to merge on top of, they are now only generated when retrieving the output config for an output during a reload. This means that the default output configs are never stored anywhere and just used as a base to merge unaltered user configs on top of during a reload. Starting with a blank output config, merges get applied in the following order: 1. Default output config (only during a reload) 2. Wildcard config (only if neither output name or output identifier exist) 3. Output name config 4. Output identifier config
2018-12-09list.c: rename free_flat_list to list_free_items_and_destroyIan Fan
2018-12-09Cleanup list codeIan Fan
2018-12-09list.c: Remove list_foreachIan Fan
Most occurrences have been replaced by `free_flat_list` which has been moved from stringop.c to list.c. The rest have been replaced by for loops.
2018-12-03config: do not set $XDG_CONFIG_HOME if unset or emptyIan Fan
Instead redefine the config paths to use the default $HOME/.config
2018-12-03config: set $XDG_CONFIG_HOME if emptyIan Fan
Before, it was only set if it was not set, but it should also be done when empty.
2018-11-28Introduce a way to show config warnings in swaynagBrian Ashworth
Adds the function `config_add_swaynag_warning(char *fmt, ...)` so that handlers can add warnings to the swaynag config log in a uniform way. The formatting is identical to errors and include the line number, line, and config path. This also alters the background file access warning to use the function and introduces a warning for duplicate bindings.
2018-11-26Merge pull request #3185 from emersion/remove-xopen-sourceRyan Dwyer
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
2018-11-25Implement title alignmentBrian Ashworth
This adds support for `i3 4.16`'s ability to set the title alignment. The command is `title_align left|center|right`. When the title is on the right, marks are moved to the left. Otherwise, they are on the right.
2018-11-25Replace _XOPEN_SOURCE with _POSIX_C_SOURCEemersion
And make sure we don't define both in the same source file.
2018-11-22Adding commands for configuring titlebar borders and paddingFlorent de Lamotte
2018-11-19Add xwayland commandemersion
2018-11-15Fix double free of modeRyan Dwyer
config->current_mode is a pointer into the config->modes list, and each mode has already been freed. Same with bars.
2018-11-13More frees.Connor E
2018-11-08Merge pull request #3085 from 7415963987456321/masterDrew DeVault
Remove extra line.
2018-11-09Remove extra line7415963987456321
2018-11-07Implement per side and per direction outer gapsBrian Ashworth
This introduces the following command extensions from `i3-gaps`: * `gaps horizontal|vertical|top|right|bottom|left <amount>` * `gaps horizontal|vertical|top|right|bottom|left all|current set|plus|minus <amount>` * `workspace <ws> gaps horizontal|vertical|top|right|bottom|left <amount>` `inner` and `outer` are also still available as options for all three of the above commands. `outer` now acts as a shorthand to set/alter all sides. Additionally, this fixes two bugs with the prevention of invalid gap configurations for workspace configs: 1. If outer gaps were not set and inner gaps were, the outer gaps would be snapped to the negation of the inner gaps due to `INT_MIN` being less than the negation. This took precedence over the default outer gaps. 2. Similarly, if inner gaps were not set and outer gaps were, inner gaps would be set to zero, which would take precedence over the default inner gaps. Fixing both of the above items also requires checking the gaps again when creating a workspace since the default outer gaps can be smaller than the negation of the workspace specific inner gaps.
2018-11-06Add focus_follows_mouse always. (#3081)Connor E
* Add focus_follows_mouse_mode. * Fail if focus_follows_mouse is invalid. * Fix indentation.
2018-11-05config: mention that reload message is also printed on validationRouven Czerwinski