Commit graph

846 commits

Author SHA1 Message Date
Mikkel Oscar Lyderik cf64000e21 Focus new sibling added to container
This makes sure that the window being added to a container gets focus.
2015-12-25 22:32:42 +01:00
Mikkel Oscar Lyderik 5d07c61330 Trigger workspace init event (floating)
Triggers workspace init event when moving a floating window to a new
workspace.

This is a follow up on #391 which didn't handle floating windows.
2015-12-25 18:02:12 +01:00
Yacine Hmito f02cf75ff3 Use SYSCONFDIR as recommended
- swaylock config path not hardcoded anymore
- the unusual and weird FALLBACK_CONFIG_DIR is no more
2015-12-23 12:22:48 +01:00
Drew DeVault 8a22ac3966 Initialize id, part two 2015-12-22 08:21:13 -05:00
Drew DeVault 7c06ef35de Initialize ID 2015-12-22 08:14:50 -05:00
Drew DeVault 91c102a897 Merge pull request #393 from robotanarchy/musl-libc-compatibility
musl libc compatibility
2015-12-21 20:42:08 -05:00
robotanarchy c3e9ee5e43 replace non-standard qsort_r with qsort
I've tried to make as few changes, as possible.

Usually the reason for using qsort_r is, that you can pass an extra userdata pointer to the
compare function. However, in sway list_sort wrapped qsort_r and always called a wrapper
function for comparing, the wrapper function then had the real compare function as argument.
The only thing, that the wrapper function does, is dereferencing the 'left' and 'right' function
arguments before passing them to the real compare function.

I have renamed list_sort to list_qsort to avoid confusion (so nobody tries to use list_qsort like
list_sort) and removed the wrapper functionality. Now the dereferencing must be done in the
compare function, that gets passed.

Some compare functions were used in both list_sort and list_seq_find. To make the difference
clear, I've added a '_qsort' suffix to the compare functions, that are intended to be used with
the new list_qsort. (In other words: list_qsort is not compatible anymore with list_seq_find).

- Changed and renamed function (it isn't used anywhere but in commands.c, and only for sorting):
	compare_set -> compare_set_qsort
- New wrapper functions:
	sway_binding_cmp_qsort (for sway_binding_cmp)
	sway_mouse_binding_cmp_qsort (for sway_mouse_binding_cmp)
2015-12-22 00:38:18 +01:00
Mikkel Oscar Lyderik 50b04884b6 Trigger ipc_event_workspace in all cases
This makes sure that the workspace IPC event is triggered when needed.

Fixes #382 while making sure that the IPC event is only triggered once.
2015-12-21 23:07:52 +01:00
robotanarchy 3dd2393797 remove unused execinfo.h include from debug_log.c 2015-12-21 18:57:26 +01:00
Drew DeVault 442a54c38b Merge pull request #390 from mikkeloscar/workspace-ipc-event
Don't skip all clients on ipc_workspace_event.
2015-12-21 09:49:55 -05:00
Mikkel Oscar Lyderik 42e5b4b032 Don't skip all clients on ipc_workspace_event.
Only clients not subcriped to the workspace event should be skipped.
2015-12-21 15:40:01 +01:00
Mikkel Oscar Lyderik c803b79764 Trigger event on bar mode|hidden_state commands 2015-12-21 15:31:09 +01:00
Mikkel Oscar Lyderik 66c66c7304 Implement barconfig_update IPC event 2015-12-21 15:28:34 +01:00
Mikkel Oscar Lyderik a96a5e0013 Handle bar commands outside config file
Our initial implementation of `bar {  }` assumed that the commands could
only be used in the config. This is not true for two commands:

* bar mode
* bar hidden_state

This patch makes it possible to issue these commands outside a bar
block, for instance through swaymsg

    $ swaymsg bar mode hide bar-0

This does not implement the `barconfig_update` IPC event which should be
trigged from these commands. I have added TODO's where this should be
added once implemented.
2015-12-21 14:33:27 +01:00
Drew DeVault fc71c6303c Fix default swaybar font 2015-12-21 05:07:19 -05:00
S. Christoffer Eliesen f4b9c3856a layout: Fix edge_gaps off with top/left panels.
Since x/y won't be zero when there's a top or left panel in place, we
need to take those coordinates into account too.
2015-12-20 21:23:20 +01:00
S. Christoffer Eliesen ce54b4ff2e container: Fix inner gaps against screen edge. 2015-12-20 21:23:20 +01:00
Drew DeVault 3082245243 Merge pull request #373 from sce/per_panel_config
Per panel config
2015-12-20 12:05:32 -05:00
Drew DeVault 33fb648938 Merge pull request #372 from sce/fix_swaybar_output_name_test
config: load_swaybars: Fix name comparison.
2015-12-20 09:23:34 -05:00
S. Christoffer Eliesen e45fd9b6c5 extensions: Track panels by wl_resource, position per panel.
Track each panel separately via its wl_resource. `set_panel_position`
might be called before `set_panel`, so reuse panel config.

Place the position in panel_config so that each panel has its own
position.
2015-12-20 12:54:34 +01:00
S. Christoffer Eliesen 6db0f6f80f extensions: panel_config->resource => wl_surface_res.
Change the name to something less ambigious.
2015-12-20 12:54:34 +01:00
S. Christoffer Eliesen 6ace37d0b1 config: load_swaybars: Fix name comparison. 2015-12-20 12:53:56 +01:00
S. Christoffer Eliesen 2779559b15 config: free_bar: Check if outputs is NULL.
bar_config.outputs is NULL if no output is explicitly defined in config
(ie. use for for all outputs).
2015-12-20 10:14:36 +01:00
Drew DeVault 3282163f64 Implement compositor support for swaylock
This makes swaylock more or less work.
2015-12-18 19:30:19 -05:00
Drew DeVault eefc93db43 Fix lock extension setup in compositor 2015-12-18 19:30:19 -05:00
Drew DeVault 253efad437 Merge pull request #361 from mikkeloscar/i3bar-command
Add support for running swaybar_command
2015-12-18 19:17:56 -05:00
Mikkel Oscar Lyderik 207678e809 Add support for running swaybar_command 2015-12-19 01:03:39 +01:00
Drew DeVault 7647762bab Fix default workspace name generation
This fixes the issue where workspace 10 ends up being the default.
2015-12-18 18:52:51 -05:00
Drew DeVault 2ab4e5676e Merge pull request #360 from sce/fix_arrange_windows
Fix arrange windows
2015-12-18 18:39:02 -05:00
Drew DeVault b9f14cee41 Merge pull request #359 from mikkeloscar/i3bar-command
Add bar option: swaybar_command <command>
2015-12-18 18:19:59 -05:00
Mikkel Oscar Lyderik 9d7f1afdfb Add bar option: swaybar_command <command> 2015-12-19 00:13:51 +01:00
S. Christoffer Eliesen f0b3ee6d84 layout: arrange_windows: Partially fix swaybar irregularties. 2015-12-18 23:53:42 +01:00
S. Christoffer Eliesen 0ad5059b6f layout: arrange_windows: Fix/better debug output. 2015-12-18 23:53:42 +01:00
Mikkel Oscar Lyderik 90ff36cab8 Terminate children when freeing output container 2015-12-18 18:27:54 +01:00
Mikkel Oscar Lyderik ede27eabc5 Reload swaybar/swaybg on config reload.
This works by tracking the pids of the child processes in the related
output container and terminating the processes and spawning new ones on
a config reload.

Should solve: #347
2015-12-18 18:27:44 +01:00
Drew DeVault 7558a274fa Add shims for swaylock on compositor 2015-12-18 08:49:04 -05:00
S. Christoffer Eliesen ed730db11b layout: Keep output at the correct size, workspace can be smaller.
If the output is not at the correct size then that info must be queried
from wlc. The output size is used by e.g. seamless mouse to detect
output edges.

With this patch the output size is now correct and the workspace size is
adjusted according to any panels.

Without this patch seamless mouse would fail to detect outputs
above/below each other if there was a panel in between because the
output would offically end where the panel started, not at the actual
screen edge.
2015-12-18 14:03:11 +01:00
S. Christoffer Eliesen 18a7afa1b3 focus: Fix moving last workspace.
If there's only one workspace on an output and it's moved to a different
output then active workspace will be NULL.
2015-12-18 13:23:49 +01:00
progandy 76c520a04b sway: insert numbered workspaces in order
fixes #308

Ordered by number ascending, with insert before same numbers.
Workspaces without numbers are appended at the end of the list.

Example order:
1 2:named 3:the_second 3:the_first 9 FIRST_NAME SECOND_NAME ...
2015-12-18 01:22:07 +01:00
progandy 8f1ac1ef2c sway: enable workspace selection by number 2015-12-18 01:21:31 +01:00
Drew DeVault 03787871d0 Fix bar invocation for multihead setup 2015-12-16 19:36:31 -05:00
Drew DeVault 1a365f19c9 Use system swaybar instead of local swaybar 2015-12-16 19:30:38 -05:00
Drew DeVault 60c204a09b Invoke swaybar when an output matches a bar config 2015-12-16 19:29:47 -05:00
Drew DeVault f6da4dda4b Bring unmanaged windows to front on output arrange
Fixes #312
2015-12-16 19:20:34 -05:00
Drew DeVault 01798a5ae2 Merge pull request #338 from mikkeloscar/bar-separator-symbol
Implement bar option: separator_symbol
2015-12-16 07:47:00 -05:00
Mikkel Oscar Lyderik 053fb09d1e Use free_flat_list for simple char* list.
No need to reimplement free_flat_list functionality.
2015-12-16 13:06:54 +01:00
Mikkel Oscar Lyderik 2fd7dd64ec Implement bar option: separator_symbol 2015-12-16 13:01:11 +01:00
Drew DeVault 473ac4531f [swaybar] Get bar config via IPC 2015-12-15 22:22:22 -05:00
Drew DeVault efff8e5ba5 Merge pull request #335 from mikkeloscar/bar-font
Implement bar option: font <font>
2015-12-15 18:11:21 -05:00
Mikkel Oscar Lyderik 9316851715 Implement bar option: font <font> 2015-12-15 23:59:16 +01:00
Mikkel Oscar Lyderik ded8919c69 Implement bar option: binding_mode_indicator <yes|no> 2015-12-15 23:38:17 +01:00
Mikkel Oscar Lyderik 47f4aea9e7 Correctly free bindings list 2015-12-15 22:16:54 +01:00
Mikkel Oscar Lyderik f59f5d27aa Implement bar option: output <output> 2015-12-15 22:01:53 +01:00
Mikkel Oscar Lyderik 05e7334106 Fix active_workspace_border color definition 2015-12-15 15:08:41 +01:00
Drew DeVault 809c251df8 Merge pull request #328 from mikkeloscar/bar-height
Add bar height option (Airblader/i3)
2015-12-15 09:08:40 -05:00
Mikkel Oscar Lyderik 6834a33290 Add bar height option (Airblader/i3) 2015-12-15 15:02:13 +01:00
Drew DeVault 432e3310f6 Fix crash from ipc_json_describe_workspace
destroying workspace '10'
Error: Signal 11. Printing backtrace
Backtrace: sway(error_handler+0x2f) [0x41478f]
Backtrace: /usr/lib/libc.so.6(+0x33680) [0x7f06d9a99680]
Backtrace: /usr/lib/libc.so.6(strlen+0x2a) [0x7f06d9ae70ca]
Backtrace: /usr/lib/libc.so.6(__strdup+0xe) [0x7f06d9ae6dfe]
Backtrace: /usr/lib/libjson-c.so.2(json_object_new_string+0x39) [0x7f06da01ffe9]
Backtrace: sway(ipc_json_describe_workspace+0xd8) [0x410408]
Backtrace: sway(ipc_event_workspace+0x38) [0x410618]
Backtrace: sway(set_focused_container+0x190) [0x40daf0]
Backtrace: sway(workspace_switch+0x1a1) [0x4142b1]
Backtrace: sway() [0x4096c6]
Backtrace: sway(handle_command+0x178) [0x405eb8]
Backtrace: sway() [0x40e6ee]
Backtrace: /usr/lib/libwlc.so.0(+0x19a1b) [0x7f06da6f0a1b]
Backtrace: /usr/lib/libwlc.so.0(+0x11b0c) [0x7f06da6e8b0c]
Backtrace: /usr/lib/libwayland-server.so.0(wl_event_loop_dispatch+0x72) [0x7f06d9e13242]
Backtrace: /usr/lib/libwayland-server.so.0(wl_display_run+0x25) [0x7f06d9e119a5]
Backtrace: /usr/lib/libwlc.so.0(wlc_run+0xfc) [0x7f06da6fda1c]
Backtrace: sway(main+0x25f) [0x4125cf]
Backtrace: /usr/lib/libc.so.6(__libc_start_main+0xf0) [0x7f06d9a86610]
Backtrace: sway(_start+0x29) [0x405bf9]
2015-12-15 08:41:10 -05:00
Drew DeVault b76acbaf4f Implement IPC_GET_BAR_CONFIG 2015-12-15 08:25:53 -05:00
Mikkel Oscar Lyderik de1f625c27 Add rgba support for bar colors 2015-12-15 13:45:04 +01:00
Mikkel Oscar Lyderik 8c1d56812b Implement bar option: colors {} 2015-12-15 13:12:55 +01:00
Mikkel Oscar Lyderik 71a25d5da7 Remove a couple of unwanted spaces 2015-12-15 10:29:37 +01:00
Drew DeVault 242da783f4 Merge pull request #324 from mikkeloscar/free-bar-bindings
Free bar->bindings
2015-12-14 19:58:41 -05:00
Drew DeVault 7b0ea051c6 Merge pull request #325 from gpyh/bar_cmd_modifier
Added bar_cmd_modifier
2015-12-14 19:57:39 -05:00
Yacine Hmito 0ead9324dc Added bar_cmd_modifier 2015-12-15 01:53:45 +01:00
Mikkel Oscar Lyderik 95de999922 Free bar->bindings 2015-12-15 01:53:34 +01:00
Drew DeVault 9db15e29b1 Merge pull request #323 from gpyh/bar_cmd_status_command
Added bar_cmd_status_command
2015-12-14 19:29:02 -05:00
Yacine Hmito 5786fa7e35 Added bar_cmd_status_command 2015-12-15 01:15:02 +01:00
Mikkel Oscar Lyderik 0513322c03 Move default bar config to bar creation.
Get rid of `config->bar` and define the default bar config options when
a bar is initialized.
2015-12-15 01:05:00 +01:00
Yacine Hmito 87126a9fc2 Added bar_cmd_bindsym
Defined a sway_mouse_binding for clicks on the swaybar
2015-12-15 00:15:32 +01:00
Drew DeVault 42a85431ee Merge pull request #320 from mikkeloscar/configure-mouse-btn2
Lookup dragging key when in dragging mode
2015-12-14 17:14:49 -05:00
Mikkel Oscar Lyderik 82af08d8e9 Lookup dragging key when in dragging mode
Fixes bug introduced in 22916e9 where dragging of floating windows was
messed up.
2015-12-14 22:44:50 +01:00
Mikkel Oscar Lyderik 0aeee6963d Make mouse key used for drag/resize configurable
This makes it possible to define what mouse button key (left|right) to
use for dragging/resizing.
2015-12-14 22:31:34 +01:00
Mikkel Oscar Lyderik 0d1eb5553c Implement bar option: mode <dock|hide|invisible> 2015-12-14 20:15:58 +01:00
Mikkel Oscar Lyderik d6cd37d873 Implement bar option: hidden_state <hide|show> 2015-12-14 19:52:25 +01:00
Mikkel Oscar Lyderik 401333e7c7 Implement bar option: id <custom-id>
If the id is defined by another bar it will just use the default id for
the bar. Typically `bar-x`.

If the id command is used multiple times within a bar block, the last
one will 'win'.
2015-12-14 18:34:20 +01:00
Drew DeVault 2be742d02d Merge pull request #314 from mikkeloscar/bar-id
Add initial support for custom bar-id
2015-12-14 11:25:31 -05:00
Mikkel Oscar Lyderik 2cedf88273 Add bar id to debug logs 2015-12-14 17:17:06 +01:00
Mikkel Oscar Lyderik c6b13163c9 Add initial support for custom bar-id 2015-12-14 17:17:06 +01:00
Mikkel Oscar Lyderik cf56c41c10 Move sway/util.c to common/util.c 2015-12-14 17:17:06 +01:00
Streetwalrus Einstein 774ffbe0d5 Detect proprietary AMD drivers too 2015-12-14 18:13:44 +02:00
Drew DeVault b65e348233 Fix crash in bar { } blocks 2015-12-14 11:11:45 -05:00
Mikkel Oscar Lyderik 45b959f601 Move numlen(1) to sway/util.c 2015-12-14 17:07:52 +01:00
Mikkel Oscar Lyderik 211bc71599 Use tabs instead of spaces 2015-12-14 16:38:49 +01:00
Drew DeVault 0b2cf8b65c Merge pull request #313 from mikkeloscar/bar-confing-subcommands
Bar confing subcommands
2015-12-14 09:59:13 -05:00
Mikkel Oscar Lyderik b00c106460 Add more debug logging to bar option parsing 2015-12-14 15:24:27 +01:00
Mikkel Oscar Lyderik bd0c58e85a Implement bar option: position <top|bottom|left|right> 2015-12-14 15:15:07 +01:00
Mikkel Oscar Lyderik cc08daded4 Implement bar option: strip_workspace_numbers <yes|no> 2015-12-14 15:14:50 +01:00
Drew DeVault 4d17aa9919 Revert "Make mouse key used for drag/resize configurable"
This reverts commit 22916e9ebc.
2015-12-14 08:57:00 -05:00
Mikkel Oscar Lyderik cb9b157e03 Add tray_output not supported warning 2015-12-14 14:52:34 +01:00
Drew DeVault 3ef6173c15 Merge pull request #311 from mikkeloscar/bar-config-parser
Implement bar { } config parsing
2015-12-14 08:11:51 -05:00
Mikkel Oscar Lyderik 0a8ec26383 Implement bar option: tray_padding <px> [px] 2015-12-14 12:56:59 +01:00
Mikkel Oscar Lyderik b9e8accc51 Implement bar option: workspace_buttons <yes|no> 2015-12-14 12:56:59 +01:00
Mikkel Oscar Lyderik 74152043f4 Implement 'bar { }' block parsing 2015-12-14 12:56:45 +01:00
Kevin Hamacher 64a183b23d Fix dangling pointer on focus swap/describe WS 2015-12-14 11:43:17 +01:00
Drew DeVault 0b6949df08 Merge pull request #305 from mikkeloscar/fix-window-start
Don't reset x,y position before use.
2015-12-13 17:01:16 -05:00
Drew DeVault 7868e44d3f Notify IPC on workspace changes more frequently 2015-12-13 16:59:22 -05:00
Mikkel Oscar Lyderik 3891a7c73f Don't reset x,y position before use.
The x and y position is calculated based on the position of the bar, we
don't want to reset these values when we need them.
2015-12-13 22:49:58 +01:00
Kevin Hamacher d77d03ce84 Make destroy_workspace behave as expected 2015-12-13 18:19:24 +01:00
Drew DeVault 2f89b7084d Correctly handle moving between fullscreen views
If focus would move in an output with a fullscreen view, it always
leaves the output. If focus would enter an output with a fullscreen
view, it always focuses the fullscreened view.
2015-12-13 08:18:12 -05:00
Drew DeVault d361ce656d Track the fullscreen view on a workspace swayc_t 2015-12-13 07:58:00 -05:00
Drew DeVault 6655534feb Fullscreen on top of bar 2015-12-13 07:52:57 -05:00
Drew DeVault af80b12add Implement invoking sway as IPC client
As an alternative to invoking swaymsg.
2015-12-12 13:01:00 -05:00
Drew DeVault 19fd979af4 Merge pull request #300 from mikkeloscar/configure-mouse-btn
[RFC] Make mouse key used for drag/resize configurable
2015-12-12 12:28:56 -05:00
Drew DeVault bffbe11e53 Fix config.c strlen error 2015-12-11 14:22:28 -05:00
Mikkel Oscar Lyderik f28a1d9183 Add floating_modifier extension to manpage 2015-12-11 18:04:27 +01:00
Mikkel Oscar Lyderik 22916e9ebc Make mouse key used for drag/resize configurable
This makes it possible to define what mouse button key (left|right) to
use for dragging/resizing.
2015-12-11 18:04:27 +01:00
Drew DeVault 762a78be3c Merge pull request #292 from christophgysin/man
move manpages to subfolders
2015-12-05 18:16:45 -05:00
Drew DeVault 71afa38890 Add swaylock protocol, add resource destructors
This prevents sway crashing if swaybg or swaybar dies.
2015-12-03 08:35:22 -05:00
Christoph Gysin bf5244b49c Fix using last output config if none matched 2015-12-02 23:05:04 +02:00
Christoph Gysin 99af7e7c9c move manpages to subfolders 2015-12-02 12:49:01 +02:00
Christoph Gysin cce9c338c0 cmake: build common code only once
This creates (static) libraries for protocols/, common/, and wayland/.
2015-12-02 12:15:57 +02:00
Drew DeVault 9b9d968cbf Fix for_window [...] move scratchpad correctly 2015-12-01 18:09:37 -05:00
Drew DeVault d098c620fe Revert "Fix bug with for_window [...] move scratchpad"
This reverts commit 0796b0c475.
2015-12-01 18:05:37 -05:00
Drew DeVault 0796b0c475 Fix bug with for_window [...] move scratchpad 2015-12-01 18:00:46 -05:00
Drew DeVault 98ff23b497 Fix busted install of /etc/sway/config 2015-12-01 16:57:03 -05:00
Christoph Gysin 92a3538381 cmake: extract sway 2015-12-01 22:47:22 +02:00
Mikkel Oscar Lyderik 3658777e47 Use wlc_point instead of deprecated wlc_origin
Struct was renamed in wlc, use the new name.
2015-12-01 21:04:34 +01:00
Yacine Hmito f3f77f9ff1 FALLBACK_CONFIG_DIR did not work. Fixed.
- Flag was ignored. Now it's taken into account.
- Missing trailing slashes in path now behaves properly.
2015-12-01 19:41:44 +01:00
Yacine Hmito 09feef89ee Can customize config fallback directory
CMake takes a `FALLBACK_CONFIG_DIR` flag which is the directory where the
standard configuration file `config` is copied at installation.
If loading from typical configuration directories fails, sway loads
FALLBACK_CONFIG_DIR/config (/etc/sway/config by default).
2015-12-01 01:07:48 +01:00
Drew DeVault 44d0f731c3 Add framework for switching command sets
This will allow the bar {} block to have a different command set (and
also bar { colors { } }.
2015-11-29 17:20:27 -05:00
Drew DeVault 4f89735fc4 Add bar config struct and defaults 2015-11-29 17:05:04 -05:00
Drew DeVault 3f950b6e52 Merge pull request #278 from christophgysin/merge
cmd_output: Merge instead of replace output config
2015-11-29 16:26:11 -05:00
Christoph Gysin b1bd3ae6f3 cmd_output: Merge instead of replace output config 2015-11-29 23:17:56 +02:00
Christoph Gysin ae7ed79573 config: Store 'enabled' as int 2015-11-29 23:17:55 +02:00
Christoph Gysin 3c8763af22 cmd_output: check for missing subcommand arguments 2015-11-29 22:36:17 +02:00
Drew DeVault 5a369b3132 Only strip comments at the start of a line
This is necessary because i3 config files use CSS notation for colors
(i.e. #rrggbb).
2015-11-29 14:02:58 -05:00
Drew DeVault ef91764bc7 Fix output adjustment for panels 2015-11-29 13:59:12 -05:00
Drew DeVault e59cffcea2 Support desktop shell panels in compositor 2015-11-29 12:03:13 -05:00
Drew DeVault 9d2bbe2640 Merge pull request #274 from sce/fix_stray_floats
cmd_floating: Don't add non-float as sibling to float.
2015-11-29 09:10:29 -05:00
Drew DeVault 25ad3181f5 Merge pull request #276 from sce/earlier_logging
main: Setup logging before wlc_init.
2015-11-29 09:08:56 -05:00
Drew DeVault c942f1624e Merge pull request #275 from christophgysin/cmd_output
refactor cmd_output
2015-11-29 09:07:22 -05:00
Drew DeVault 0af15cc19e Merge pull request #269 from christophgysin/usage
Add --help to print usage
2015-11-29 09:04:39 -05:00
S. Christoffer Eliesen c26a4b42cf main: Setup logging before wlc_init.
If `wlc_init` fails the error message will never be logged or printed
anywhere.
2015-11-29 15:01:47 +01:00
Christoph Gysin 7059eccaa1 cmd_output: Log enable/disable state 2015-11-29 15:32:02 +02:00
Christoph Gysin ffdfaaa985 apply_output_config: use list_seq_find() to find config 2015-11-29 15:31:58 +02:00
Christoph Gysin 7d82cd9c0a cmd_output: Use list_seq_find() to find matching config 2015-11-29 15:29:06 +02:00
Christoph Gysin 88f372a22a cmd_output: Cleanup cmd_output argument handling 2015-11-29 14:51:56 +02:00
S. Christoffer Eliesen badfb4bb43 cmd_floating: Don't add non-float as sibling to float.
When turning a float to a non-float, `get_focused_container` might
return another floating view, causing the active view to be inserted
into the floating list on its workspace instead of the normal child list
which it should. (Since it has `is_floating` as false the resulting
discrepency triggered other bad behaviour eventually leading sway to
crash.)

This patch fixes that by simply checking floating status before making
it a sibling.
2015-11-29 13:00:10 +01:00
Christoph Gysin 923c3245ac Fix option parsing
Using 'flag' results in duplicate code paths for short and long options.

This broke the -q short option in swaymsg, because there was:

 {"quiet", no_argument, &quiet, 'q'}

Which will set quiet to 'q' and return 0, not 'q'.
2015-11-28 23:50:44 +02:00
Christoph Gysin 2f2e1f3fc7 sway: Add --help option that prints usage 2015-11-28 23:50:44 +02:00
Christoph Gysin e48a16ce5e sway: Print usage and exit on unknown options 2015-11-28 23:50:44 +02:00
Christoph Gysin 3ba33321de Use macros for exit values 2015-11-28 23:50:10 +02:00
Mikkel Oscar Lyderik c477bbf345 Add warnings about invalid output commands
This handles some cases where sway will crash if an output command is
invalid/missing an argument.
2015-11-28 22:02:06 +01:00
S. Christoffer Eliesen 20cb390323 sway/main: Move wlc init to after args are handled.
First of all because it's not needed that early, and second of all
because there's a bug where calling `sway --get-socketpath` via `popen`
causes the child sway process to spin/hang instead of returning EOF.
(Specifically `(unset SWAYSOCK; swaymsg)` hangs.) This patch fixes that.

(Also note that this patch moves the "detailed review" comment, so I
guess this patch requires extra detailed review?)
2015-11-28 20:35:57 +01:00
Drew DeVault 1661edee28 Allow output config for output named *
Which will match any output.
2015-11-28 10:18:37 -05:00
Drew DeVault 2f192cceca Improve config file loading
This also makes it so that your i3 config is used before
/etc/sway/config.
2015-11-28 10:00:53 -05:00
S. Christoffer Eliesen 2d0f78c0d6 workspace: Learn sticky.
A floating window that's sticky will move to the new active workspace
whenever the workspace on the same output changes.
2015-11-27 17:58:10 +01:00
S. Christoffer Eliesen db642fc8c5 commands: code formatting: Sort list of commands by alphabet. 2015-11-27 17:58:10 +01:00
Drew DeVault cbd7348704 Merge pull request #265 from sce/better_logging
debug_log: Improve container_log so that debug lines are aligned.
2015-11-27 09:56:07 -07:00
Drew DeVault cad2694a3c Merge pull request #264 from sce/fix_ws_next_name
workspace: Improve workspace_next_name.
2015-11-27 09:53:27 -07:00
S. Christoffer Eliesen c1d88acf72 debug_log: Improve container_log so that debug lines are aligned.
Makes the log easier to read, and the developers more happy (this one at
least).
2015-11-27 17:49:07 +01:00
S. Christoffer Eliesen 0a78af0acc workspace: Improve workspace_next_name.
This function looks for bound commands that start with `workspace` (ie.
the commands that change to a static workspace) and fetches the
workspace name.

However, if it's actually a list of commands, then the parsing will pick
up the delimiter ("," or ";") and also fail to recognize keywords
("next" etc).

This patch fixes that by properly separating with delimiters.
2015-11-27 17:30:05 +01:00
S. Christoffer Eliesen d9770cc243 cmd_floating: Support enable and disable commands too.
This is especially relevant in combination with `for_window`, e.g.:
`for_window [title="Terminal"] floating enable`.
2015-11-27 17:09:19 +01:00
Drew DeVault 27f03c705d Move IPC client into common, refactor IPC 2015-11-27 09:50:04 -05:00
Drew DeVault 53d353e6b4 Add "variant": "sway" to IPC version response 2015-11-26 16:49:36 -05:00
Drew DeVault 9a15371ba3 Parse command line args for swaymsg 2015-11-26 14:31:29 -05:00
Drew DeVault 206606b32c Merge pull request #261 from christophgysin/exec
Call swaybg without invoking a shell
2015-11-25 18:59:35 -05:00
Christoph Gysin e362f871d9 Call swaybg without invoking a shell
This makes escaping the arguments obsolete.

Also avoid dynamic memory allocation for the output id. It only supported ids up
to 99. Now we support up to 999, and take 4 bytes off the stack instead.
2015-11-25 23:19:11 +02:00
Christoph Gysin be3fae148b swaybg: implement scaling mode "fit" 2015-11-25 22:32:02 +02:00
Drew DeVault 9fb020d04c Merge pull request #251 from sce/criteria_1
criteria: Add. Learn for_window command.
2015-11-25 09:28:43 -05:00
S. Christoffer Eliesen 5483fe1883 criteria: Code formatting. 2015-11-25 14:59:07 +01:00
Christoph Gysin eeb7f5c036 config: print line number 2015-11-25 15:48:27 +02:00
S. Christoffer Eliesen a06cb7cd01 criteria: Add. Learn for_window command.
A criteria is a string in the form of `[class="regex.*" title="str"]`.
It is stored in a struct with a list of *tokens* which is a
attribute/value pair (stored as a `crit_token` struct). Most tokens will
also have a precompiled regex stored that will be used during criteria
matching.

for_window command: When a new view is created its metadata is tested
against all stored criteria, and if a match is found the associated
command list is executed.

Unfortunately some metadata is not available in sway at the moment
(specifically `instance`, `window_role` and `urgent`). Any criteria
string that tries to match an unsupported attribute will fail.

(Note that while the criteria code can be used to parse any criteria
string it is currently only used by the `for_window` command.)
2015-11-25 14:34:33 +01:00
Christoph Gysin a99aa92bc6 extensions: add missing include
This fixes a compiler warning:

../sway/extensions.c: In function ‘set_background’:
../sway/extensions.c:16:37: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
  struct background_config *config = malloc(sizeof(struct background_config));
                                     ^
../sway/extensions.c:16:37: warning: incompatible implicit declaration of built-in function ‘malloc’
../sway/extensions.c:16:37: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
2015-11-25 14:39:09 +02:00
S. Christoffer Eliesen e31a899841 layout: get_swayc_in_direction_under: Handle floating views. 2015-11-24 21:34:41 +01:00
S. Christoffer Eliesen b5ddad4bf6 layout: swap_container: Handle floating views. 2015-11-24 21:34:41 +01:00
S. Christoffer Eliesen ed1b0bffbc layout: replace_child: Handle floating views. 2015-11-24 21:34:41 +01:00
S. Christoffer Eliesen 8aef255d5f layout: add_sibling: Handle floating views properly.
This should fix #241.
2015-11-24 21:34:24 +01:00
S. Christoffer Eliesen a6c9f40b9a sway_binding_cmp_keys: Differentiate between modifier keys.
Compare modifiers as well as keys when number of modifiers+keys are the
same (so that e.g. mod1+x != mod4+x).
2015-11-24 19:26:43 +01:00
S. Christoffer Eliesen db92920cf9 handle_command: Skip commands that has a criteria string.
We can't handle them currently (the criteria needs to e.g. be passed to
each command handler which then needs to do the right thing), so it's
better to just do nothing than to create unexpected results (because the
command was executed on the wrong view).

(Before this patch any command list with a criteria string would simply
fail to parse, so this is at least a step in the right direction.)
2015-11-24 16:29:28 +01:00
S. Christoffer Eliesen b7e3d05ace stringop: Properly handle criteria strings.
A criteria string (e.g. '[class="something" title="something"]') is now
correctly treated as a single argument.
2015-11-24 16:12:37 +01:00
S. Christoffer Eliesen 4367e6d3e3 container: Store app_id attribute for views. 2015-11-24 16:00:41 +01:00
S. Christoffer Eliesen 47c313fe3e container: Store class attribute for views. 2015-11-24 16:00:41 +01:00
taiyu 9d50f88cef fix list sorting 2015-11-24 00:30:02 -08:00
S. Christoffer Eliesen a0c5a0bb30 cmd_bindsym: Detect/handle duplicates.
Also replace `bindsym_sort` with function `sway_binding_cmp` that takes
all data into account when comparing.
2015-11-22 21:17:36 +01:00
S. Christoffer Eliesen 9ce5d635f1 commands: Comment/doc for config_command. 2015-11-22 15:54:31 +01:00
S. Christoffer Eliesen 5531dbe1b2 cmd_workspace: Don't fill up config->workspace_outputs with duplicates.
This also fixes a bug where issuing a new "workspace a output b" command
for an already assigned workspace would not work (the old config would
be found first and used instead).
2015-11-22 11:08:08 +01:00
S. Christoffer Eliesen d0af224e6d stringop: lenient_strcmp: Add. 2015-11-21 22:22:09 +01:00
Drew DeVault 2100d7bfef Fix #240 2015-11-19 20:04:03 -05:00
Drew DeVault 35fd139105 Add all documented scaling modes to config parser
Note that not all scaling modes are actually supported by swaybg yet.
2015-11-19 18:55:58 -05:00
Drew DeVault 5728307520 Add wallpapers to output command 2015-11-19 18:55:17 -05:00
Drew DeVault 79b277fe9b Parse output background config 2015-11-19 18:25:15 -05:00
Drew DeVault 4a1584be53 Fix background extensions
Thanks @Cloudef, it works great
2015-11-19 07:23:11 -05:00
Drew DeVault 65b8a5c3ce Add background handling
This does not work as expected. I think the problem is on the wlc side.
Please review, @Cloudef. To reproduce the issues:

1. Run sway
2. Open terminal in sway
3. Run swaybg

swaybg will create a surface and ask to have it set as the background,
but wlc_handle_from_wl_surface_resource will return 0. If the swaybg
surface is a shell surface, then it works - but wlc complains about the
pointer type and segfaults as soon as the pre-render hook tries to draw
the background.
2015-11-18 22:14:57 -05:00
Drew DeVault 82db2a57a9 Basic support for extensions in server and clients 2015-11-18 22:01:22 -05:00
Drew DeVault 01202568f9 Track pid of child process from exec
This will allow us to eventually open that process on the current view.
Requires support from @Cloudef.
2015-11-16 19:40:44 -05:00
S. Christoffer Eliesen 236f26f62e output: Support multiple adjacent outputs.
When querying for an adjacent output we now need an absolute position in
order to know which adjacent output that matches. (The position is
either the current mouse position or the center of the currently focused
container, depending on context.)

If two outputs have one edge each that at least partially align with
each other they now count as adjacent.

Seamless mouse is affected by this and now properly moves and positions
itself between outputs with "uneven" placement (as long as they have at
least some part of the edge adjacent to each other).

When focusing or moving a container in a specified direction the center
of the current focused container decides where to look for an adjacent
output. So if e.g. an output has two adjacent outputs to the right and a
"focus right" command is issued then it's the placement of the currently
focused container that decides which output actually gets focused.

Also, if an output has at least one output adjacent in some direction
but the entire edge is not covered (ie. it has "holes" with no outputs),
then the algorithm will choose the output that is closest to the
currently focused container (this does not apply to seamless mouse, the
pointer will just stop at the edge in that case).
2015-11-16 21:32:18 +01:00
S. Christoffer Eliesen a94a91a723 cmd_output: Replace existing config if called multiple times. 2015-11-16 15:57:42 +01:00
Drew DeVault cd161aa985 We somewhat more wlc_point now
Apparently I missed some

cc @Cloudef
2015-11-14 17:14:23 -05:00
Drew DeVault 95442dac8d We wlc_point now
cc @Cloudef
2015-11-14 11:30:29 -05:00
S. Christoffer Eliesen f64b7e71d4 ipc: Store socketname in SWAYSOCK. Fixes --get-socketpath.
After adding pid to the socket path the `--get-socketpath` command broke
because it doesn't know the pid of the running instance. Fix this by
setting and querying `SWAYSOCK`.

Also ignore `SWAYSOCK` upon normal startup if a socket exists at that
location (ie. from another sway instance), and don't overwrite `I3SOCK`
if it exists either.
2015-11-13 18:18:52 +01:00
Drew DeVault 1011957465 Merge branch 'master' of github.com:SirCmpwn/sway 2015-11-13 08:17:35 -05:00
Drew DeVault 38b18d460a Revert "Try ~/.i3/config earlier than /etc/sway/config"
This reverts commit f0ceb4e909.
2015-11-13 08:17:29 -05:00
Drew DeVault f3fc48f692 Merge pull request #225 from sce/logind_socket_path
ipc: Put socket into proper user runtime dir.
2015-11-13 08:15:14 -05:00
Drew DeVault f0ceb4e909 Try ~/.i3/config earlier than /etc/sway/config
And ~/.config/i3/config, of course.
2015-11-13 08:09:30 -05:00
S. Christoffer Eliesen 253204efb9 ipc: Put socket into proper user runtime dir. 2015-11-13 14:07:18 +01:00
Drew DeVault c43ef2aedd We don't need to implement strdup
After defining _GNU_SOURCE
2015-11-12 19:43:03 -05:00
Drew DeVault bfcabe48ef Start fleshing out wayland client implementation
This introduces a basic shared framework for making wayland clients
within sway itself.
2015-11-12 19:04:01 -05:00
Drew DeVault ef8335d694 Start working on IPC for get_pixels
This is broken
2015-11-12 12:37:23 -05:00
Drew DeVault 250097d32b Fix gaps for views being incorrect 2015-11-12 08:02:39 -05:00