aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
Commit message (Collapse)AuthorAge
...
* | | config: fix line number with continued linesLibravatar Brian Ashworth2019-01-11
| | | | | | | | | | | | | | | | | | | | | 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.
* | | config: do not reset pos when braces foundLibravatar Brian Ashworth2019-01-11
| | | | | | | | | | | | | | | When a brace is found, the config file should not seek back to before the brace, otherwise the brace will be read multiple times.
* | | Merge pull request #3400 from ianyfan/config-braceLibravatar emersion2019-01-10
|\ \ \ | |/ / |/| | config.c: fix brace detection at end of file
| * | config.c: fix brace detection at end of fileLibravatar Ian Fan2019-01-10
| | |
* | | Simplify evdev includes on FreeBSD by relying on up-to-date packageLibravatar Jan Beich2019-01-09
|/ / | | | | | | | | | | | | | | | | | | | | | | 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> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
* | reload: apply seat cfgs after reading entire cfgLibravatar Brian Ashworth2019-01-09
| | | | | | | | | | | | | | 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.
* | Merge pull request #3275 from ianyfan/remove-readlineLibravatar emersion2019-01-08
|\ \ | | | | | | Rewrite strip_whitespace and remove readline.c
| * | fixup! config.c: re-enable backslash continuation in config fileLibravatar Ian Fan2019-01-01
| | |
| * | config.c: re-enable backslash continuation in config fileLibravatar Ian Fan2019-01-01
| | |
| * | Remove readline.cLibravatar Ian Fan2019-01-01
| | | | | | | | | | | | | | | All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.
| * | stringop.c: rewrite strip_whitespaceLibravatar Ian Fan2019-01-01
| | |
* | | Implement tiling_drag_thresholdLibravatar Brian Ashworth2019-01-02
|/ / | | | | | | | | | | | | | | | | 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`.
* | hide_cursor: change to a seat subcommandLibravatar Brian Ashworth2018-12-30
| | | | | | | | | | This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
* | Verify seat fallback settings on reloadLibravatar Brian Ashworth2018-12-30
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Implement hide_cursor <timeout> commandLibravatar Brian Ashworth2018-12-25
| | | | | | | | | | Allows the cursor to be hidden after a specified timeout in milliseconds
* | Rework default output configsLibravatar Brian Ashworth2018-12-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | list.c: rename free_flat_list to list_free_items_and_destroyLibravatar Ian Fan2018-12-09
| |
* | Cleanup list codeLibravatar Ian Fan2018-12-09
| |
* | list.c: Remove list_foreachLibravatar Ian Fan2018-12-09
| | | | | | | | | | 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.
* | config: do not set $XDG_CONFIG_HOME if unset or emptyLibravatar Ian Fan2018-12-03
| | | | | | | | Instead redefine the config paths to use the default $HOME/.config
* | config: set $XDG_CONFIG_HOME if emptyLibravatar Ian Fan2018-12-03
| | | | | | | | | | Before, it was only set if it was not set, but it should also be done when empty.
* | Introduce a way to show config warnings in swaynagLibravatar Brian Ashworth2018-11-28
| | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #3185 from emersion/remove-xopen-sourceLibravatar Ryan Dwyer2018-11-26
|\ \ | | | | | | Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
| * | Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | | | | | | | | | And make sure we don't define both in the same source file.
* | | Implement title alignmentLibravatar Brian Ashworth2018-11-25
|/ / | | | | | | | | | | | | | | 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.
* / Adding commands for configuring titlebar borders and paddingLibravatar Florent de Lamotte2018-11-22
|/
* Fix double free of modeLibravatar Ryan Dwyer2018-11-15
| | | | | | | config->current_mode is a pointer into the config->modes list, and each mode has already been freed. Same with bars.
* More frees.Libravatar Connor E2018-11-13
|
* Merge pull request #3085 from 7415963987456321/masterLibravatar Drew DeVault2018-11-08
|\ | | | | Remove extra line.
| * Remove extra lineLibravatar 74159639874563212018-11-09
| |
* | Implement per side and per direction outer gapsLibravatar Brian Ashworth2018-11-07
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add focus_follows_mouse always. (#3081)Libravatar Connor E2018-11-06
| | | | | | | | * Add focus_follows_mouse_mode. * Fail if focus_follows_mouse is invalid. * Fix indentation.
* config: mention that reload message is also printed on validationLibravatar Rouven Czerwinski2018-11-05
|
* config: remove peeked + expanded line log entriesLibravatar Brian Ashworth2018-10-22
| | | | | | | | The peeked and expanded line log entries were useful during the switch to generic code blocks and subcommands. However, it has been a while since those were introduced and the log entries are no longer helpful for any remaining issues with config parsing. Instead of keeping them as clutter in the log, they can just be removed.
* Remove raise_floating directiveLibravatar Ryan Dwyer2018-10-20
| | | | | | | | | | | | | The directive controlled whether floating views should raise to the top when the cursor is moved over it while using focus_follows_mouse. The default was enabled, which is undesirable. For example, if you have two floating views where one completely covers the other, the smaller one would be inaccessible because moving the mouse over the bigger one would raise it above the smaller one. There is no known use case for having raise_floating enabled, so this patch removes the directive and implements the raise_floating disabled behaviour instead.
* Minor refactor of input managerLibravatar Ryan Dwyer2018-10-20
| | | | | | | | | | | | | | | | | | | | | The input manager is a singleton object. Passing the sway_input_manager argument to each of its functions is unnecessary, while removing the argument makes it obvious to the caller that it's a singleton. This patch removes the argument and makes the input manager use server.input instead. On a similar note: * sway_input_manager.server is removed in favour of using the server global. * seat.input is removed because it can get it from server.input. Due to a circular dependency, creating seat0 is now done directly in server_init rather than in input_manager_create. This is because creating seats must be done after server.input is set. Lastly, it now stores the default seat name using a constant and removes a second reference to seat0 (in input_manager_get_default_seat).
* fix_edge_gaps: Allow negative values for outer gaps.Libravatar Tarmack2018-10-13
| | | | While allowing negative values for the outer gaps it is still prevented that negative values move windows out of the container. This replaces the non-i3 option for edge_gaps.
* Add mouse_warping containerLibravatar Rouven Czerwinski2018-10-10
| | | | | | | This option always moves the cursor into the middle of the container if the warp variable is true in seat_set_focus_warp. Fixes #2577
* config: remove double free of config->swaynag_commandLibravatar Rouven Czerwinski2018-10-09
| | | | Fixes #2796
* Merge branch 'master' into popup-during-fullscreenLibravatar Brian Ashworth2018-10-08
|\
| * Allow swaynag to be disabledLibravatar Brian Ashworth2018-10-08
| |
| * Allow swaybg to be disabledLibravatar emersion2018-10-08
| | | | | | | | | | | | Same as #2791 but for swaybg. Fixes #2790
* | Implement popup_during_fullscreenLibravatar Ryan Dwyer2018-10-08
|/ | | | | | | | | | This introduces a new view_impl function: is_transient_for. Similar to container_has_ancestor but works using the surface parents rather than the tree. This patch modifies view_is_visible, container_at and so on to allow transient views to function normally when they're in front of a fullscreen view.
* Reload config using idle eventLibravatar Ryan Dwyer2018-10-08
| | | | | | | | | | | | | | | | This patch makes it so when you run reload, the actual reloading is deferred to the next time the event loop becomes idle. This avoids several use-after-frees and removes the workarounds we have to avoid them. When you run reload, we validate the config before creating the idle event. This is so the reload command will still return an error if there are validation errors. To allow this, load_main_config has been adjusted so it doesn't apply the config if validating is true rather than applying it unconditionally. This also fixes a memory leak in the reload command where if the config failed to load, the bar_ids list would not be freed.
* Add configuration for raising containers on focusLibravatar Jonathan Buch2018-10-03
| | | | | | | * New configuration option: raise_floating (From the discussion on https://github.com/i3/i3/issues/2990) * By default, it still raises the window on focus, otherwise it will raise the window on click.
* Handle border options for gapsLibravatar Brian Ashworth2018-10-01
| | | | | | | | | | | | Fixes `hide_edge_borders smart` when gaps are in use. Implements `hide_edge_borders smart_no_gaps` and `smart_borders on|no_gaps|off`. Since `smart_borders on` is equivalent to `hide_edge_borders smart` and `smart_borders no_gaps` is equivalent to `hide_edge_borders smart_no_gaps`, I opted to just save the last value set for `hide_edge_borders` and restore that on `smart_borders off`. This simplifies the conditions for setting the border.
* Rename workspace_outputs to workspace_configs and fix memory leakLibravatar Ryan Dwyer2018-09-28
| | | | | | | | | | | | | | | When we eventually implement `workspace <ws> gaps inner|outer <px>`, we'll need to store the gaps settings for workspaces before they're created. Rather than create a workspace_gaps struct, the approach I'm taking is to rename workspace_outputs to workspace_configs and then add gaps settings to that. I've added a lookup function workspace_find_config. Note that we have a similar thing for outputs (output_config struct and output_find_config). Lastly, when freeing config it would create a memory leak by freeing the list items but not the workspace or output names inside them. This has been rectified using a free_workspace_config function.
* Introduce tiling_drag directiveLibravatar Ryan Dwyer2018-09-11
|
* Align titles to baselineLibravatar Ryan Dwyer2018-09-08
| | | | | | | | | | | | | This does the following: * Adds a baseline argument to get_text_size (the baseline is the distance from the top of the texture to the baseline). * Stores the baseline in the container when calculating the title height. * Takes the baseline into account when calculating the config's max font height. * When rendering, pads the textures according to the baseline so they line up.
* Implement type safe arguments and demote sway_containerLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the meaning of sway_container so that it only refers to layout containers and view containers. Workspaces, outputs and the root are no longer known as containers. Instead, root, outputs, workspaces and containers are all a type of node, and containers come in two types: layout containers and view containers. In addition to the above, this implements type safe variables. This means we use specific types such as sway_output and sway_workspace instead of generic containers or nodes. However, it's worth noting that in a few places places (eg. seat focus and transactions) referring to them in a generic way is unavoidable which is why we still use nodes in some places. If you want a TL;DR, look at node.h, as well as the struct definitions for root, output, workspace and container. Note that sway_output now contains a workspaces list, and workspaces now contain a tiling and floating list, and containers now contain a pointer back to the workspace. There are now functions for seat_get_focused_workspace and seat_get_focused_container. The latter will return NULL if a workspace itself is focused. Most other seat functions like seat_get_focus and seat_set_focus now accept and return nodes. In the config->handler_context struct, current_container has been replaced with three pointers: node, container and workspace. node is the same as what current_container was, while workspace is the workspace that the node resides on and container is the actual container, which may be NULL if a workspace itself is focused. The global root_container variable has been replaced with one simply called root, which is a pointer to the sway_root instance. The way outputs are created, enabled, disabled and destroyed has changed. Previously we'd wrap the sway_output in a container when it is enabled, but as we don't have containers any more it needs a different approach. The output_create and output_destroy functions previously created/destroyed the container, but now they create/destroy the sway_output. There is a new function output_disable to disable an output without destroying it. Containers have a new view property. If this is populated then the container is a view container, otherwise it's a layout container. Like before, this property is immutable for the life of the container. Containers have both a `sway_container *parent` and `sway_workspace *workspace`. As we use specific types now, parent cannot point to a workspace so it'll be NULL for containers which are direct children of the workspace. The workspace property is set for all containers, except those which are hidden in the scratchpad as they have no workspace. In some cases we need to refer to workspaces in a container-like way. For example, workspaces have layout and children, but when using specific types this makes it difficult. Likewise, it's difficult for a container to get its parent's layout when the parent could be another container or a workspace. To make it easier, some helper functions have been created: container_parent_layout and container_get_siblings. container_remove_child has been renamed to container_detach and container_replace_child has been renamed to container_replace. `container_handle_fullscreen_reparent(con, old_parent)` has had the old_parent removed. We now unfullscreen the workspace when detaching the container, so this function is simplified and only needs one argument now. container_notify_subtree_changed has been renamed to container_update_representation. This is more descriptive of its purpose. I also wanted to be able to call it with whatever container was changed rather than the container's parent, which makes bubbling up to the workspace easier. There are now state structs per node thing. ie. sway_output_state, sway_workspace_state and sway_container_state. The focus, move and layout commands have been completely refactored to work with the specific types. I considered making these a separate PR, but I'd be backporting my changes only to replace them again, and it's easier just to test everything at once.