summaryrefslogtreecommitdiffstats
path: root/sway
Commit message (Collapse)AuthorAge
* Don't apply hide_edge_borders to floating windowsLibravatar mwenzkowski2019-04-16
| | | | This change matches i3's behavior.
* view.c: refactor view_autoconfigure()Libravatar mwenzkowski2019-04-16
|
* Add documentation for rename workspaceLibravatar Ashkan Kiani2019-04-16
|
* Send disabled output available modes on IPC get_outputsLibravatar Ranieri Althoff2019-04-16
| | | | | | - Also fix missing trailing newline on pretty print Signed-off-by: Ranieri Althoff <1993083+ranisalt@users.noreply.github.com>
* Add deprecation warnings for new_float, new_window, and force_focus_wrapping.Libravatar Connor E2019-04-14
|
* 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.
* Add heuristics to differentiate touchpadsLibravatar Benjamin Cheng2019-04-14
| | | | | | | Use libinput_device_config_tap_get_finger_count to determine whether a pointer is a touchpad. swaymsg is also updated to reflect the new touchpad type.
* 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
* Fix scratchpad fullscreen behavior and crashLibravatar Brian Ashworth2019-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | When setting fullscreen on a hidden scratchpad container, there was a check to see if there was an existing fullscreen container on the workspace so it could be fullscreen disabled first. Since the workspace is NULL, it would cause a SIGSEGV. This adds a NULL check to avoid the crash. This also changes the behavior of how fullscreen is handled when adding a container to the scratchpad or changing visibility of a scratchpad container to match i3's. The behavior is as follows: - When adding a container to the scratchpad or hiding a container back into the scratchpad, there is an implicit fullscreen disable - When setting fullscreen on a container that is hidden in the scratchpad, it will be fullscreen when shown (and fullscreen disabled when hidden as stated above) - When setting fullscreen global on a container that is hidden in the scratchpad, it will be shown immediately as fullscreen global. The container is not moved to a workspace and remains in the scratchpad. The container will be visible until fullscreen disabled or killed. Since the container is in the scratchpad, running `scratchpad show` or `move container to scratchpad` will have no effect This also changes `container_replace` to transfer fullscreen and scratchpad status.
* Fix potential null accessesLibravatar Ashkan Kiani2019-04-13
|
* Fix scratchpad logic for floating windowsLibravatar Ashkan Kiani2019-04-12
| | | | | | | When a tiled window is sent to the scratchpad, we want to use sane defaults, which is to center it and resize it to the default. For floating windows, we want to use their existing geometry.
* sway-input.5: add xkeyboard-config(7) to "see also"Libravatar Martin Michlmayr2019-04-12
| | | | | Since xkeyboard-config(7) is mentioned in the man page, add a reference to the "see also" section.
* cmd_focus: raise floating for `<criteria> focus`Libravatar Brian Ashworth2019-04-11
| | | | | Floaters are currently raised for `focus <direction>`. This extends the same functionality to `<criteria> focus`.
* Honor output for xdg_toplevel_set_fullscreenLibravatar Brian Ashworth2019-04-11
| | | | | | | | | | | | | | This honors the fullscreen output request for `xdg_toplevel_set_fullscreen` and `zxdg_toplevel_v6_set_fullscreen`. If the request was sent before mapping, the fullscreen output request will be retrieved from the client_pending state for the toplevel. The output will be passed to `view_map` and if there is a workspace on the output, the view will be placed on that workspace. If the request comes in after being mapped, the view will be moved to the workspace on the output (if there is one) before becoming fullscreen.
* config/output: unbreak on 32-bit architecturesLibravatar Jan Beich2019-04-08
| | | | | | | | | | sway/config/output.c:624:54: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] sway_log(SWAY_DEBUG, "spawn_swaybg cmd[%ld] = %s", k, cmd[k]); ~~~ ^ %zu include/log.h:40:74: note: expanded from macro 'sway_log' _sway_log(verb, "[%s:%d] " fmt, _sway_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) ^~~~~~~~~~~
* 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.
* idle_inhibit: fix crash during view destructionLibravatar Brian Ashworth2019-04-03
| | | | | | | | | | | This fixes a crash for application set idle inhibitors when their associated view is being destroyed. There is a call to `view_is_visible` to determine is the view is visible and it assumes that the view has an container, but it is possible for the container to already have been destroyed at this point. There is a NULL check for the view in `check_active` and this re-adds the NULL check for the container that I accidentally dropped when refactoring during the inhibit_idle command PR
* root_scratchpad_hide: fix crash when layer focusedLibravatar Brian Ashworth2019-04-03
| | | | | | | | | | | This fixes a crash in `root_scratchpad_hide` when a layer surface is focused. Since `seat_get_focus` is NULL when a layer surface is focused, the call to `node_has_ancestor` was causing a SIGSEGV since it was attempting to access the parent of NULL. This changes the call to `seat_get_focus_inactive`, which will return a node even when a layer surface is focused and is also guaranteed to have something in the focus stack if a scratchpad container is being hidden (otherwise there would not be any containers yet).
* scratchpad: set initial sizeLibravatar Brian Ashworth2019-03-31
| | | | | | This matches i3's behavior of setting scratchpad containers to 50% of the workspace's width and 75% of the workspace's height, bound by the minimum and maximum floating width/height.
* floating: fix size of non-view containersLibravatar Brian Ashworth2019-03-31
| | | | | | | | | | | | This fixes the sizing of floating non-view containers. On master, the floater will get set to the maximum width and height, which by default is the entire output layout. When setting a non-view container to floating, this will set a sane default size of 50% of the workspace width and 75% of the workspace height, or whatever the closest is that the minimum and maximum floating width/height values allow for. On all future calls to `floating_natural_resize`, the width and height will be kept unless they need to be changed to respect the min/max floating width/height values.
* Fix xwayland configure request scratchpad crashLibravatar Brian Ashworth2019-03-31
| | | | | | | | | | | | | | | | | | This fixes a crash in `container_init_floating` when a xwayland view sends a configure request while in the scratchpad. `container_init_floating` gets called so the configured minimum and maximum sizes gets respected when resizing to the requested size. Since the workspace was NULL, it would SIGSEGV when attempting to get the workspace's output for the output box retrieval. This extracts the resizing portion of `container_init_floating` into a separate function. If the container is in the scratchpad, it will just be resized and skip the centering. Additionally, `container_init_floating` has been renamed to `container_floating_resize_and_center` to more accurately describe what it does.
* Fix null pointer crash when doing tiling dragLibravatar Ryan Dwyer2019-03-29
| | | | | | | * Create layout S[V[view view] view] * Drag bottom view to the top * Sway would crash when the cursor hovers the V[view view] title while dragging
* bindings: fix overwrite log argument mismatchLibravatar Jan Pokorný2019-03-27
| | | | Thanks, @RedSoxFan, for the review spotting another instance.
* Fix crash for floating command on scratchpad windowLibravatar Ashkan Kiani2019-03-26
|
* Implement inhibit_idle commandLibravatar Brian Ashworth2019-03-24
| | | | | | | | | | | | | | | | | | | | | | This implements the following command to set/unset a user idle inhibitor for a view: `inhibit_idle focus|fullscreen|open|none|visible` The modes are as follows: - focus: inhibited when the view is focused by any seat - fullscreen: inhibited when the view is fullscreen (or a descendant of a fullscreen container) and is visible on any output - open: inhibited until the view is closed or the inhibitor is unset or changed - none: unsets any user set idle inhibitors for the view - visible: inhibited when the view is visible on any output This should have no effect on idle inhibitors set by the applications themselves and those should still work as intended. Since this operates on the view in the handler context, it is possible to set it on the currently focused view, on any existing view with criteria, or for any future view with for_window.
* Fix #3924Libravatar Philipe Goulet2019-03-24
| | | | | | | | | | Removes "unescape_string(argv[i]);". Since "do_var_replacement(argv[i])" never adds escape characters, it is both wrong and unnecessary to remove escape characters on the next line. This caused characters that were meant to be escaped to not be anymore.
* Add support for manually setting subpixel hinting on outputs.Libravatar Geoff Greer2019-03-24
| | | | | | Many laptop screens report unknown subpixel order. Allow users to manually set subpixel hinting to work around this. Addresses https://github.com/swaywm/sway/issues/3163
* Allow for workspace renaming during exec handlingLibravatar mliszcz2019-03-23
| | | | | | | | | | | | This change adds support for renaming a workspace when `exec` command is being processed by keeping sway_workspace and pid_workspace names in sync. The change can be verified by running following command: swaymsg exec <application>; swaymsg rename workspace number 1 to 5 Fixes: #3952
* fix opening a floating view on the NOOP outputLibravatar Brian Ashworth2019-03-23
| | | | | | | | | | | | | | | | Since the NOOP output has no size, the minimum floating size is greater than the workspace size for the NOOP output. In this case, the floater gets centered in the output instead of the workspace. However, the NOOP output is not part of the output layout and thus has a NULL box. Attempting to access the properties of this box was causing a segfault. This fixes the issue by just setting the floater's box to all zeroes when mapping on the NOOP output. When the workspace gets moved from the NOOP output to a new output, any floater whose width or height is zero or has an x or y location outside of the output, gets passed to `container_init_floating` again. This will then set the appropriate size and centering. For any floater that has a valid size and location, they are preserved.
* criteria: fix __focused__ when no focus or unsetLibravatar Brian Ashworth2019-03-23
| | | | | | | | | | | | | | | | | | | | | | | | This fixes the behavior of `__focused__` when there is no focused view to match i3's behavior of successfully matching no views instead of returning an error of a missing value. It also applies the same logic when a token is not applicable (or unset) for a view such as `app_id` for a focused xwayland view or `class` for a focused xdg-shell view. This adds an `autofail` boolean to `struct criteria`. If it is set to `true`, then `criteria_matches_view` will immediately bail out as a no match. If `autofail` is set, the criteria will also not be considered empty by `criteria_is_empty`. To set this new `autofail` property, `get_focused_prop` will now take in a boolean pointer of the same name. If `__focused__` is supported for the token and there is no focused view or the focused view does not have a value for the token, then the boolean will be set to true. In `parse_token`, the boolean value will be checked and if set to true, then `criteria->autofail` will be set to true and `parse_token` will bail successfully. Tokens will still be parsed to make sure the whole criteria is syntactically valid, which is also why `&criteria->autofail` is not passed to `get_focused_prop` and a local boolean is declared in `parse_token`.
* cmd_mode: allow cmd_set to be a subcommandLibravatar Brian Ashworth2019-03-23
| | | | This allows set to be used in mode blocks
* Support focus <direction> for floating containersLibravatar Ryan Dwyer2019-03-20
| | | | | | | | | | | | | | | | | | This kind of worked before in that focus would change, but it wasn't intentionally supported and had side effects such as not raising the container, and being unable to cycle through all floaters depending on the direction used. This commit makes it properly supported. The new focus is chosen based on the distance to the center point of each floating container in the workspace, and the container is raised. In a multi output setup, if both visible workspaces have floating containers, focus will NOT cross into the other output. It is assumed the user will use a workspace binding in this case. If two floating containers occupy the exact same center point and you try to focus in a direction, the behaviour is undefined.
* 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)
* Clean up focus follows mouse logicLibravatar Ryan Dwyer2019-03-19
| | | | | | | | | | | | | | | | | | | | | | | Firstly, this fixes a recent regression where having `focus_follows_mouse yes` and hovering an inactive tab caused it to gain focus. The code was missing a view_is_visible check. The code is handling the logic for both focus_follows_mouse yes and focus_follows_mouse always, where the latter will apply when nudging the mouse after a workspace switch. However, the view_is_visible check didn't apply when using focus_follows_mouse always, so hovering a tab with that configuration would cause is to focus. This was a bug. When adding the view_is_visible check, it now applies to both yes and always. Note that the comment about the split container was wrong. At this point the hovered node cannot be a split container because it passed the node_is_view check. The comment has been removed. Lastly, the else condition is completely removed. This didn't appear to have any practical use. Setting focus to the result of seat_get_focus_inactive is very likely going to be a no op. There is a slim chance that this will break something, and if so I'd like to find out what so it can be properly documented in the code.
* Remove debug treeLibravatar Ryan Dwyer2019-03-18
| | | | This feature has served its purpose. It's better to use IPC now.
* Document the title_format commandLibravatar Ryan Dwyer2019-03-18
|
* config/output: handle wildcard in get_output_configLibravatar Brian Ashworth2019-03-17
| | | | | | | | | | | In #3916, I overlooked that `get_output_config` does not handle wildcards unless the config is reloading, which is a remnant of older iterations of the output config handling that went unnoticed due to `output_find_config` handling it. With the current version of the output config handling, having `get_output_config` handle wildcard configs is actually preferable. This fixes having only a wildcard output config in the config file or when connecting/enabling a new output with only a wildcard config existing.
* Introduce default seatopLibravatar Ryan Dwyer2019-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a `default` seat operation which is used when no mouse buttons are being held. This means there is now always a seat operation in progress. It allows us to separate `default` code from the standard cursor management code. The sway_seatop_impl struct has gained callbacks `axis`, `rebase` and `end`, and lost callbacks `finish` and `abort`. `axis` and `rebase` are only used by the default seatop. `end` is called when a seatop is being replaced by another one and allows the seatop to free any resources, though no seatop currently needs to do this. `finish` is no longer required, as each seatop can gracefully finish in their `button` callback. And `abort` is not needed, as calling `end` would achieve the same thing. The struct has also gained a bool named allow_set_cursor which allows the client to set a new cursor during `default` and `down` seatops. Seatops would previously store which button they were started with and stop when that button was released. This behaviour is changed so that it only ends once all buttons are released. So you can start a drag with $mod+left, then click and hold right, release left and it'll continue dragging while the right button is held. The motion callback now accepts dx and dy. Most seatops don't use this as they store the cursor position when the seatop is started and compare it with the current cursor position. This approach doesn't make sense for the default seatop though, hence why dx and dy are needed. The pressed_buttons array has been moved from the sway_cursor struct to the default seatop's data. This is only used for the default seatop to check bindings. The total pressed button count remains in the sway_cursor struct though, because all the other seatops check it to know if they should end. The `down` seatop no longer has a `moved` property. This was used to track if the cursor moved and to recheck focus_follows_mouse, but seems to work without it. The logic for focus_follows_mouse has been refactored. As part of this I've removed the call to wlr_seat_keyboard_has_grab as we don't appear to use keyboard grabs. The functions for handling relative motion, absolute motion and tool axis have been changed. Previously the handler functions were handle_cursor_motion, handle_cursor_motion_absolute and handle_tool_axis. The latter two both called cursor_motion_absolute. Both handle_cursor_motion and cursor_motion_absolute did very similar things. These are now simplified into three handlers and a single common function called cursor_motion. All three handlers call cursor_motion. As cursor_motion works with relative distances, the absolute and tool axis handlers convert them to relative first.
* Replace seatup allows_events with button callbackLibravatar Ryan Dwyer2019-03-17
|
* config/output: revamp identifier/name layeringLibravatar Brian Ashworth2019-03-16
| | | | | | | | | | | | | | | | | | | | | | This revamps the way that output configs are handled when referencing an output by both identifier and name. If an output is always referred to by name or by identifier, this should have no noticeable change. As soon as there is a name output config and an identifier output config that matches an output, an output config is generated that is named `<identifier> on <name>` that is generated with the identifier output config merged on top of the name output config and stored. When a change to either is stored, the delta is merged on top of that "id on name" output config, as well. If the "id on name" output config exists, it has the highest precedence and will be used when applying a config to the output. This fixes the following case: - `swaymsg output <name> bg /path/to/wallpaper1 fill` - `swaymsg output <identifier> bg /path/to/wallpaper2 fill` - `swaymsg output <name> dpms on` Without this, the wallpaper is changed to `/path/to/wallpaper1`. With this, the wallpaper remains `/path/to/wallpaper2`.
* Fix output config retrieval for new outputsLibravatar Brian Ashworth2019-03-16
| | | | | | | | | | | | | | | | | | | This removes `output_find_config`, which would take the first matching output config it found. This is fine if only a name output config, identifier output config, or even just wildcard exist, but if there is a name output config and identifier output config, they are not merged. Instead, this introduces find_output_config, which is just a wrapper for `get_output_config`. This ensures that both the name and identifier output configs are respected. This fixes the following case: - For simplicity in this example, remove all output configs from config - Run `swaymsg output <name> bg #ff0000 solid_color` - Run `swaymsg output <identifier> scale 2` - Disconnect and reconnect output Without this, the output will have the background, but not the scale. With this, the output will have both the background and scale
* Fix quoting of commands passed to for_windowLibravatar minus2019-03-15
| | | | | | E.g. `for_window [class="mpv"] move container to output "Dell Inc. ..."` does not work because the executed move command only uses `Dell` as output name.
* output_cmd_background: validate colorsLibravatar Brian Ashworth2019-03-15
| | | | | This validates the color and fallback color in `output_cmd_background` to ensure that only colors of the form `#RRGGBB` are accepted.
* Set prev_workspace_name based off of focusLibravatar Brian Ashworth2019-03-14
| | | | | | | | | This moves setting `seat->prev_workspace_name` from `workspace_switch` to `set_workspace`. `workspace_switch` is only called when using a `workspace` command to change the workspace so any workspace change based on criteria was not altering `seat->prev_workspace_name`. By moving it to `set_workspace`, which is called by `seat_set_focus`, it will change any time focus changes to a node on a different workspace
* xwayland: handle floating configure request sizeLibravatar Brian Ashworth2019-03-13
| | | | | | | | | | | This makes it so the container gets resized by a configure request for xwayland floating views. The minimum and maximum sizes are also respected. Previously, the configure request was resizing the surface to the size requested, but never changing the container size. This caused the surface to be rendered outside of the container or to be smaller than the container. The former is never ideal and the latter makes no sense for floating views since the container itself can just be shrunk.
* criteria: change workspace to support regexLibravatar Brian Ashworth2019-03-12
| | | | | This changes the workspace criteria to support regex instead of basic strings. This matches i3's behavior.
* Handle seat_get_focused_workspace returning NULLLibravatar Brian Ashworth2019-03-12
| | | | | This modifiers the callers of seat_get_focused_workspace to handle getting NULL as the return value, if they did not already.
* get_deco_rect: fix floaters on tabbed/stacked wsLibravatar Brian Ashworth2019-03-11
| | | | | | | | | | | This fixes the decoration rects for floating containers on a workspace that is either tabbed or stacked. Without this, the floater would incorrectly try to calculate where it's tab or stack decorations were on the workspace. This would cause a SIGFPE (due to a divide-by-zero) when the floater was on a tabbed workspace without any tiling children. Furthermore, the floater does not care what the workspace's layout is and should just use the location relative to the workspace. This should have no effect on children of a floating container.
* commands: allow tiled sticky containers to be movedLibravatar Ian Fan2019-03-11
| | | | | Namely, to a workspace on the same output. However, tiled sticky children of floating containers are still restricted.
* Stop using wlr_output->{lx,ly}Libravatar emersion2019-03-11
| | | | | Also fixes sway_output->{lx,ly,width,height} not being updated. Also fixes output_get_in_direction adding buffer coords to layout coords.