Commit graph

451 commits

Author SHA1 Message Date
Tony Crisci dc8c9fbeb6 Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"
This reverts commit 472e81f35d, reversing
changes made to 6b7841b11f.
2018-03-29 23:41:33 -04:00
Drew DeVault d0c7f66e95
Revert "Refactor tree" 2018-03-29 23:29:29 -04:00
Tony Crisci 2778edef97 arrange windows 2018-03-29 23:15:39 -04:00
Drew DeVault 8efee109ad Implement modes 2018-03-29 22:11:08 -04:00
Drew DeVault 741424c4e7 Clean up imported bar commands 2018-03-29 22:11:08 -04:00
Drew DeVault 849c3515ab Use statically allocated text buffer 2018-03-29 22:11:08 -04:00
Drew DeVault 8b5b72c576 Restart swaybar on config reload 2018-03-29 22:11:08 -04:00
Drew DeVault 5c9cdbcdd2 Add swaybg_command 2018-03-29 22:11:08 -04:00
Drew DeVault bf7a4cd0eb Add bar configuration commands 2018-03-29 22:11:08 -04:00
Tony Crisci 62d1b4cb96 fix container_get_in_direction name 2018-03-29 18:17:31 -04:00
Tony Crisci eca029f218 more renaming things 2018-03-29 17:06:29 -04:00
Tony Crisci b90099b4b7 rename container functions 2018-03-29 16:40:40 -04:00
Tony Crisci 874f009866 move tree includes to their own directory 2018-03-29 14:21:42 -04:00
Drew DeVault 68cfa7ef67 Render layer surfaces and respect exclusive zone 2018-03-28 16:42:13 -04:00
Tony Crisci 2154b7c7d6 add config handlers 2018-02-24 13:34:47 -05:00
Tony Crisci 7262bf655f remove checks for command handlers 2018-02-24 13:22:57 -05:00
Tony Crisci 66d1e0b313 basic layout command 2018-02-22 18:37:14 -05:00
Tony Crisci a3ae67af4e basic focus in direction 2018-02-14 17:12:21 -05:00
Tony Crisci 52670c636c basic focus (without direction) 2018-02-14 16:47:23 -05:00
Tony Crisci a7d49da239 separate seat get focus and seat get focus inactive 2018-02-07 18:17:57 -05:00
Tony Crisci 5151502298 basic focus overhaul 2018-02-04 14:08:54 -05:00
Drew DeVault b28602aa74 Implement workspaces 2018-01-30 23:09:21 -05:00
Dominique Martinet 6259831d31 commands/reload: remove unimplemented 'load_swaybars' call 2018-01-22 07:26:40 +01:00
Dominique Martinet 869be4378d commands: add 'reload' command 2018-01-22 07:25:23 +01:00
Tony Crisci beb3805cf0 dont allow kill command in config 2018-01-21 19:13:11 -05:00
Tony Crisci c3fc0d446f cmd-kill: use sway_assert when no container 2018-01-21 14:15:10 -05:00
Tony Crisci 0e3eae4baa view interface 2018-01-21 09:09:53 -05:00
Tony Crisci 1156523ccf run all commands with focused container context 2018-01-21 08:46:31 -05:00
Tony Crisci 6a1d71b8b8 basic command criteria 2018-01-20 16:21:45 -05:00
Tony Crisci c353e01c85 add kill command 2018-01-20 14:10:11 -05:00
Tony Crisci cc3c713889 seat config handler context 2018-01-20 11:44:34 -05:00
Tony Crisci 9e0595f26b input config handler context 2018-01-20 11:34:57 -05:00
Dominique Martinet 67985e9031 sway: change all sway_log to wlr_log 2018-01-05 23:39:46 +01:00
Dominique Martinet c83900593d config: add 'set' command 2018-01-05 15:36:20 +01:00
Dominique Martinet 28b8ea9f1e cmd_input: cleanup around current_input_config
- Restore old one if we weren't part of a block (should be NULL anyway)
- Check current_input_config got properly allocated
- free temporary current_input_config when done using it
2018-01-05 00:07:34 +01:00
Drew DeVault 91313d3847
Merge pull request #1539 from acrisci/bindings
Bindings
2018-01-04 09:47:36 -05:00
Tony Crisci b01a53abfb Merge branch 'wlroots' into bindings 2018-01-04 08:00:22 -05:00
Tony Crisci 50e791cadb binding release 2018-01-04 07:25:52 -05:00
emersion ead3f1e676
Allow to configure outputs by their identifier 2017-12-29 19:04:16 +01:00
Tony Crisci bd3ca70e3d fix nitpicks 2017-12-29 09:11:15 -05:00
Tony Crisci 62b7ab3959 overwrite old bindings 2017-12-28 18:50:22 -05:00
emersion 21c61f1c09
Refactor output command, add output enable 2017-12-27 21:23:30 +01:00
Tony Crisci ba69f06695 binding config 2017-12-27 12:31:06 -05:00
Tony Crisci 5c036a3eac error on not enough input/seat args for cmd 2017-12-19 05:26:55 -05:00
Tony Crisci a949d7de5a Merge branch 'wlroots' into feature/input 2017-12-18 11:01:11 -05:00
Tony Crisci 483ede0146 improve xkb command logging 2017-12-18 10:44:25 -05:00
emersion c815d6d1a9
Add support for fractional output scale 2017-12-18 14:13:07 +01:00
Tony Crisci 88bcd43ebf seat fallback config 2017-12-17 10:39:22 -05:00
Tony Crisci c41801b75e set keyboard config at runtime 2017-12-16 20:06:58 -05:00
Tony Crisci b8261ab24b expect exactly one xkb arg 2017-12-16 12:40:58 -05:00
Tony Crisci f16aa3c0ad rename config apply cmds 2017-12-16 12:14:24 -05:00
Tony Crisci 9fa70ce426 Merge branch 'wlroots' into feature/input 2017-12-16 07:33:23 -05:00
Tony Crisci 9eecbb5d8a xkb config 2017-12-15 05:22:51 -05:00
Tony Crisci 92fef27eaa basic configuration 2017-12-14 11:11:56 -05:00
emersion cba592b3d2
Use strtol instead of atoi in output command 2017-12-14 02:23:33 +01:00
emersion 9254c5a93f
Fail if unknown output subcommand 2017-12-14 00:50:01 +01:00
emersion 4d389f8b65
Replace refresh_rate and position by mode in output command 2017-12-14 00:45:47 +01:00
emersion d293c42942
Update output container box in event handler 2017-12-12 21:09:51 +01:00
Tony Crisci c173d30b92 seat configuration 2017-12-12 10:55:20 -05:00
Tony Crisci 538903bc5a config cleanup 2017-12-12 09:03:58 -05:00
Tony Crisci 462a451328 input config 2017-12-11 07:55:01 -05:00
emersion 4a14aa9ad9
Remove output from layout 2017-12-09 15:48:52 +01:00
emersion 8764dc26c6
Add new_output_config, update root container size on output hotplug 2017-12-06 19:45:43 +01:00
emersion c25ad5e7c4
Merge branch 'wlroots' into output-config 2017-12-06 19:11:46 +01:00
emersion 68ae989cee
Init, merge output config params, use wlr_output_layout 2017-12-06 12:57:13 +01:00
emersion aaae59026f
Add output config 2017-12-06 12:36:06 +01:00
emersion 9aeda82477
Add include command 2017-12-05 18:47:57 +01:00
emersion 90f7f1a0e6
Add minimal config subsystem 2017-12-05 10:40:55 +01:00
emersion 514c819ff9
Add exec and exec_always commands 2017-12-04 22:43:49 +01:00
Drew DeVault d7d21bb0f8 Add initial command subsystem (untested)
Need to spin up the IPC server to test this
2017-11-22 21:20:41 -05:00
Drew DeVault 733993a651 Move everything to sway/old/ 2017-11-18 11:22:02 -05:00
Drew DeVault 1efd5f819f Wire up output frame loop 2017-11-11 14:41:18 -05:00
Drew DeVault 6271abd644 Fix #1291 2017-10-08 11:26:45 -04:00
Drew DeVault 6d83a59b46 Merge pull request #1263 from nyorain/master
Implement get_clipboard ipc message
2017-10-08 11:05:54 -04:00
lbonn 6197fff0b4 Fix move to named workspaces
The command parsing did not handle workspaces with spaces in their name
(like it's done in `cmd_workspace`)
2017-10-06 14:16:24 +02:00
Calvin Lee 419a1087ac Clean up output command
Plugs memory leaks during failure of the output command and in other
circumstances and fixes `bg` option.

Fixes #1381
2017-10-05 20:46:31 -06:00
Jonas Karlsson 05aeccfca0 Fix issue #1287
All variables without a $ prefix lost their last character due to off by one error
2017-10-03 21:51:02 +02:00
Scott Anderson c29e5bbde8 Use WLC v2 pointer interface 2017-07-12 16:39:14 +12:00
Tobias Blass 566863ba5d fix use-after-free bug 2017-07-10 22:59:59 +02:00
nyorain 02c75ebe37 Implement ipc get_clipboard 2017-07-07 15:38:45 +02:00
Mykyta Holubakha 4f905ecb96
permit.c: check for NULL pointer dereference 2017-07-01 21:35:53 +03:00
nyorain 60fa626116 Add the 'clipboard' command to set the clipboard 2017-07-01 18:35:42 +02:00
Calvin Lee 843ad38b3c Implement Tray Icons
This commit implements the StatusNotifierItem protocol, and enables
swaybar to show tray icons. It also uses `xembedsniproxy` in order to
communicate with xembed applications.
The tray is completely optional, and can be disabled on compile time
with the `enable-tray` option. Or on runtime with the bar config option
`tray_output none`.

Overview of changes:
In swaybar very little is changed outside the tray subfolder except
that all events are now polled in `event_loop.c`, this creates no
functional difference.

Six bar configuration options were added, these are detailed in
sway-bar(5)

The tray subfolder is where all protocol implementation takes place and
is organised as follows:

tray/sni_watcher.c:
	This file contains the StatusNotifierWatcher. It keeps track of
	items and hosts and reports when they come or go.
tray/tray.c
	This file contains the StatusNotifierHost. It keeps track of
	sway's version of the items and represents the tray itself.
tray/sni.c
	This file contains the StatusNotifierItem struct and all
	communication with individual items.
tray/icon.c
	This file implements the icon theme protocol. It allows for
	finding icons by name, rather than by pixmap.
tray/dbus.c
	This file allows for asynchronous DBus communication.

See #986 #343
2017-06-07 17:49:16 -07:00
johalun 7fef283044 FreeBSD fixes
Increase _POSIX_SOURCE value where needed.
Increase _XOPEN_SOURCE value where needed.
Conditionally link to libcap (only on Linux).
Possibly some trailing whitespace fixes (automatic).
2017-06-06 09:45:50 +02:00
Josip Janzic 400998d6d2 Add mouse button bindings
Adds support for bindings like:

bindsym button3 floating toggle
bindsym $mod+button3 floating toggle
2017-05-04 23:00:03 +02:00
Zandr Martin f65a88e68d
prevent crash when layout auto is missing args 2017-04-29 14:02:07 -04:00
Drew DeVault 816ceddcbd Set child border to background if not specified 2017-04-29 10:07:18 -04:00
Drew DeVault 02812a2e4d Support specifying fewer than 5 colors
This doesn't work, I'm not sure why. The color structs definitely get
changed but if you specify fewer than 5, it renders with the defaults.
2017-04-29 09:56:07 -04:00
Drew DeVault 51143a75af Implement no_focus
Ref #2
2017-04-26 15:29:42 -04:00
Vasilij Schneidermann 0f31323659 Use i3's dimensions for initial scratchpad views
See https://github.com/i3/i3/blob/master/src/scratchpad.c#L196-L197
2017-04-18 23:47:09 +02:00
Vasilij Schneidermann d4ac594264 Implement and document move [to] scratchpad 2017-04-18 21:41:28 +02:00
Jerzi Kaminsky 2ad8850398 Handle symlinks as IPC security targets
- When policies are allocated, the ipc target path goes
  through symlink resolution. The result is used as
  the canonical for matching pids to policies at runtime.
  In particular, this matches up with the target of
  the `/proc/<pid>/exe`.
- There's a possible race condition if this isn't done
  correctly, read below.

Originally, validate_ipc_target() always tried to resolve
its argument for symlinks, and returned a parogram target string
if it validates. This created a possible race condition with
security implications. The problem is that get_feature_policy()
first independently resolved the policy target in order to check
whether a policy already exists. If it didn't find any, it called
alloc_feature_policy() which called validate_ipc_target() which
resolved the policy target again. In the time between the two
checks, the symlink could be altered, and a lucky attacker could
fool the program into thinking that a policy doesn't exist
for a target, and then switch the symlink to point at another file.
At the very least this could allow him to create two policies
for the same program target, and possibly to bypass security
by associating the permissions for one target with another,
or force default permissions to apply to a target for which
a more specific rule has been configured. So we don't that.

Instead, the policy target is resolved once and that result is
used for the rest of the lookup/creation process.
2017-04-16 17:09:53 +03:00
Jerzi Kaminsky bfb99235e3 Move get_feature_policy to sway/security.c 2017-04-16 17:09:53 +03:00
Jerzi Kaminsky b4357a8eb6 Rename get_policy to get_feature_policy 2017-04-16 17:09:53 +03:00
Calvin Lee 154c6718c1 Add -t get_marks and use more i3-like marks
In i3 every mark is unique and one mark cannot be used in more than one
window, sway behavior has been amended to match this.
`swaymsg -t get_marks` will now return an array of all marks used in sway.

See #98
2017-04-07 11:37:51 -06:00
Calvin Lee 069d37f987 Improve criteria handling
This commit changes how commands decide what container to act on.
Commands get the current container though `current_container`, a global
defined in sway/commands.c. If a criteria is given before a command,
then the following command will be run once for every container the
criteria matches with a reference to the matching container in
'current_container'. Commands should use this instead of
`get_focused_container()` from now on.

This commit also fixes a few (minor) mistakes made in implementing marks
such as non-escaped arrows in sway(5) and calling the "mark" command
"floating" by accident. It also cleans up `criteria.c` in a few places.
2017-04-05 22:07:23 -06:00
Calvin Lee 2445d27960 Impliment i3-style marks
This commit adds three commands to sway: `show_marks`, `mark` and
`unmark`. Marks are displayed right-aligned in the window border as i3
does. Marks may be found using criteria.

Fixes #1007
2017-04-03 11:48:37 -06:00
Zandr Martin baa17ec696
remove unnecessary todo item
As best I can tell this todo was intended to add workspace movement to
the given output with the `workspace <ws> output <op>` command, but i3
does not behave this way.
2017-03-18 17:26:59 -04:00
Jarkko Oranen f6196b7e9a Fix off-by-one error when checking workspace_layout arguments 2017-03-18 22:24:44 +02:00
Zandr Martin b507462d1c
Merge branch 'master' of git://github.com/SirCmpwn/sway into new-command-aliases 2017-03-13 07:35:12 -04:00
Drew DeVault 9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Zandr Martin 18450dd16a
deprecate new_window and new_float commands 2017-03-09 14:56:15 -05:00
Zandr Martin 8684b9ecca
fix workspace output assignment 2017-03-08 14:30:01 -05:00
Calvin Lee d47d3d78de Fix #1099: Allow spaces in worspace names
This commit allows unquoted spaces in worspace names in order to keep
compatability with i3. The names _must not_ contain the string "output"
which is documented in 'sway.5' because how sway detects the `move
<workspace> output <output>` command. Also I documented that "number"
may be used before the worspace name without affecting how the name is
evaluated.
2017-03-01 11:35:47 -07:00
Calvin Lee b35782bcad i3 feature support: Moving flotaing containers
This commit lets the 'move' command apply to floating containers as well
as tiled ones. The command may be appended with a number of pixels and
then optionally the string `px` (like '10 px') in order to move the
container more or fewer than the standard ten pixels.
2017-03-01 11:00:16 -07:00
Drew DeVault 126ce571da Read configs from /etc/sway/security.d/* 2017-02-20 07:51:31 -05:00
Drew DeVault eabfb6c559 Add * policies and fix bug 2017-02-20 06:48:33 -05:00
Drew DeVault 1980a08358 Enforce new IPC policies 2017-02-20 06:33:04 -05:00
Drew DeVault b10721b89e Add initial support code for new IPC security 2017-02-20 06:11:56 -05:00
wil 71b386964a replaced "bot" with "bottom" in auto layout commands 2017-01-14 19:41:00 +01:00
willakat 4c06a10004 Merge branch 'master' into master 2017-01-14 19:40:02 +01:00
Frantisek Fladung c04819e8c0 Implement hide_edge_borders smart (like in i3 4.13) 2017-01-12 12:40:28 +01:00
wil 07474a4fa7 reworked "layout auto*" star commands
- "layout auto_left|auto_xxx" are now "layout auto xxx"
- "layout incmaster <n>" is now "layout auto master [set|inc] <n>"
- "layout incncol <n>" is now "layout auto ncol [set|inc] <n>"
2017-01-08 17:57:38 +01:00
wil 063c79874a Indent cleanups 2017-01-08 14:49:47 +01:00
wil 3c84250be8 [fix] resize should now preserve surrounding container's dimensions
- prior to this modification, the requested pixels were added/removed
  to both edges of the modified container. To preserve sizes,
  only half the pixels should be added/removed to each edge.
2017-01-07 18:20:13 +01:00
wil bd415029ba Moved auto_* layout functions from resize.c to layout.c 2017-01-07 17:41:15 +01:00
wil 97f70987d7 [fix] cleanups suggested by Sway community 2017-01-01 21:52:49 +01:00
wil a62048f15d changed "layout promote" command to "move first"
This is more consistent with other Sway semantics.
2017-01-01 19:53:53 +01:00
wil 15745abf0c [fix] cycle auto layouts backwards 2016-12-31 18:41:13 +01:00
wil a0aa8d9780 cleanup in auto layouts
- added L_AUTO_FIRST/LAST instead of using explicit layouts.
- when switching between auto layout that don't share the same major axis, invert the
  width/height of their child views to preserve their relative proportions.
2016-12-29 20:31:30 +01:00
wil 0ff9fe9a7a introduce next/prev as a direction for focus/move commands. 2016-12-29 20:31:30 +01:00
wil bc3dc97026 [fix] Handle auto layout resize with multiple slave groups 2016-12-29 20:31:30 +01:00
wil 8b0073b195 Added "layout incnmaster|incncol" commands 2016-12-29 20:31:30 +01:00
wil 5425d0489f Handle resize in auto layouts 2016-12-29 20:31:30 +01:00
wil 97f7d47413 Added Awesome/Monad type "auto" layouts 2016-12-29 20:31:30 +01:00
Drew DeVault 1172566d4e Change how security config is loaded 2016-12-17 15:21:57 -05:00
Drew DeVault 63d96c1bb4 Fix indentation issues 2016-12-15 19:01:41 -05:00
Drew DeVault 10c8b73075 Handle calloc failures 2016-12-15 19:01:41 -05:00
Drew DeVault 7784f1a905 Handle allocation failures in security code
Note that such errors are generally going to be fatal
2016-12-15 19:01:41 -05:00
Drew DeVault 248df18c24 Handle allocation failure in commands 2016-12-15 19:01:40 -05:00
D.B 35b8d185ac fix layout switching (was broken because of workspace_layout)
For workspace containers, swayc_change_layout also changes ->layout alongside
->workspace_layout when it's a sensible thing to do. There is an additional test
for 'layout toggle' command which ensures that containers will be tiled
horizontally after toggling from tabbed or stacked.
2016-12-04 08:31:34 -05:00
D.B 6fb4b6737a add workspace_layout to container
Add swayc_change_layout function, which changes either layout or
workspace_layout, depending on the container type.
2016-12-04 08:31:34 -05:00
Drew DeVault d2d6fcd1ff Fix clang issues 2016-12-02 18:38:31 -05:00
Drew DeVault d353da248b Add ipc connection feature policy controls 2016-12-02 18:09:19 -05:00
Drew DeVault 62dad7148f Enforce IPC security policy 2016-12-02 17:55:03 -05:00
Drew DeVault c8dc4925d1 Add IPC security policy command handlers 2016-12-02 17:34:26 -05:00
Drew DeVault f23880b1fd Add support for command policies in config file 2016-12-02 08:10:03 -05:00
Drew DeVault 76cab04b4d Implement permit and reject commands 2016-12-01 21:36:43 -05:00
D.B 05be14ff7c change default layout toggle to L_HORIZ
After issuing 'layout toggle split' command from tabbed/stacked layout,
layout should have been horizontally split.
2016-11-06 08:13:24 +01:00
D.B 58eb7ac19f change bar colors from char[10] to *char
This commit removes has_* booleans from bar color struct. It also
generalizes of functions in commands/bar/colors.c.
2016-11-02 21:07:04 +01:00
D.B ad4d21d60b add bar colours for focused_(workspace|statusline|separator)
If these aren't defined in config, color settings without 'focused_'
prefix are used as a fallback.
2016-11-02 18:58:33 +01:00
D.B 39ee0ec552 use urgent_ws color in swaybar if binding_mode is undefined 2016-11-02 18:58:33 +01:00
Michał Winiarski e8d8abfbb5 Add left_handed support for input devices
Some users may want to switch buttons on their input devices, turns out
libinput already supports it. Let's add a support for it in our config.

Signed-off-by: Michał Winiarski <knr@hardline.pl>
2016-10-25 22:06:23 +02:00
Drew DeVault 4cba91803e Revert "Fixes dealing with workspace_layout and related bugs [rfc]" 2016-10-12 21:26:06 -04:00
D.B 571321a1d8 add workspace_layout, ensure ws is always L_HORIZ
Add swayc_change_layout function, which changes either layout or
workspace_layout, depending on the container type. Workspace being
always L_HORIZ makes this much more i3-compatible.
2016-10-11 09:16:59 +02:00
Nicolas Cornu 5384d3effe Can't move an empty workspace 2016-10-11 01:51:55 +02:00
D.B d3f5ac8cbb add force_focus_wrapping option 2016-10-07 08:12:14 +02:00
Ryan Dwyer 64d463142f Implement default name for workspace command
This implements commands such as:

    workspace number 9: test

If a workspace with the given number exists then it will be focused,
otherwise a new workspace with the given name will be created.
2016-09-25 21:42:28 +10:00
Zandr Martin 511eed90cd
squash commits, move enum into resize.c 2016-09-07 06:48:41 -05:00
Zandr Martin 65ace5dec5
merge in latest commits 2016-09-02 14:11:48 -05:00
Zandr Martin b374c35758
refactor commands.c 2016-09-01 21:39:08 -05:00