Commit Graph

210 Commits

Author SHA1 Message Date
Mikkel Oscar Lyderik
f8b260d4a1 Add support for bincode command
If a bindsym and bincode maps to the same combination, the last one will
overwrite any previous mappings.
2016-01-09 18:07:47 +01:00
Mikkel Oscar Lyderik
6392abe35b Implement IPC binding event (keyboard)
This implements the IPC binding event for keyboard bindings.  It is
slightly different from the i3 implementation [1] since sway supports
more than one non-modifier key in a binding. Thus the json interface has
been changed from:

    {
      ...
      "symbol": "t",
      ...
    }

to:

    {
      ...
      "symbols": [ "t" ],
      ...
    }

[1] http://i3wm.org/docs/ipc.html#_binding_event
2016-01-08 03:03:55 +01:00
Mikkel Oscar Lyderik
32cd3f70eb Add function for duplication a sway_binding 2016-01-08 03:03:55 +01:00
Mikkel Oscar Lyderik
dffacea831 Add function for getting list of modifier names.
Get an array of modifier names from modifier masks.
2016-01-08 03:03:40 +01:00
Mikkel Oscar Lyderik
55f63935ab Implement bindsym --release
This is a "simple" version of --release (same as i3) that only supports
a binding that contain one normal key. e.g.:

    bindsym --release $mod+x exec somthing-fun

I didn't bother implementing it for a combination like `$mod+x+z` since
it is a bit tricky to get right and also a bit weird to actually do on a
keyboard.
2016-01-07 21:43:00 +01:00
Mikkel Oscar Lyderik
843e2ad2c1 Only send modifier event once for active modifiers
This makes sure that a modifier event is only sent for active bar
modifiers, and that it is only sent once for each of those modifiers.

An active bar modifier is a modifier defined for a bar with `mode hide`
and `hidden_state hide`.
2016-01-05 23:18:59 +01:00
Mikkel Oscar Lyderik
95e0f44c73 Move modifier name table to common/util.c
Lookup of modifier names is required in several places, thus it makes
sense to move it to a general place.
2016-01-05 18:36:24 +01:00
Mikkel Oscar Lyderik
c20c63b677 Send IPC modifier event on bar_modifier up/down
Detects when a bar modifier key is pressed/released and sends a modifier
IPC event to any listeners (usually swaybars).

This way a swaybar can listen on the modifier event and hide/show the
bar accordingly (not implemented yet)

The modifier event looks like this:

    {
      "change": "pressed", // or released
      "modifier": "Mod4"
    }
2016-01-05 02:25:56 +01:00
Mikkel Oscar Lyderik
7727c9efbc Detect bar modifier pressed/released 2016-01-05 00:49:44 +01:00
Mikkel Oscar Lyderik
aa2f754c64 swaybar: Implement binding_mode_indicator 2016-01-03 22:16:36 +01:00
Mikkel Oscar Lyderik
7298a9c67a Add type to returned response.
Makes `ipc_recv_response` return a struct with size, type and payload
rather than just the payload string.

This is useful if the type has to be checked on the client.
2016-01-03 20:40:50 +01:00
Mikkel Oscar Lyderik
19833fbc8b Add IPC event types
Adds custom IPC_EVENT_* types
2016-01-03 20:37:10 +01:00
Mikkel Oscar Lyderik
16b8c2e915 Handle SIGTERM sent to sway
This makes sway handle and gracefully shut down everything when
receiving a SIGTERM.

Fix #416
2015-12-29 13:03:53 +01:00
progandy
8fefdb3c64 swaybar: fix memory leaks 2015-12-22 17:54:47 +01: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
Mikkel Oscar Lyderik
66c66c7304 Implement barconfig_update IPC event 2015-12-21 15:28:34 +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
progandy
21014e606b make gdk-pixbuf dependency really optional 2015-12-20 17:37:52 +01: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
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
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
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
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
f6da4dda4b Bring unmanaged windows to front on output arrange
Fixes #312
2015-12-16 19:20:34 -05:00
Mikkel Oscar Lyderik
2fd7dd64ec Implement bar option: separator_symbol 2015-12-16 13:01:11 +01:00
Mikkel Oscar Lyderik
f59f5d27aa Implement bar option: output <output> 2015-12-15 22:01:53 +01:00
Mikkel Oscar Lyderik
6834a33290 Add bar height option (Airblader/i3) 2015-12-15 15:02:13 +01: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
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
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
c6b13163c9 Add initial support for custom bar-id 2015-12-14 17:17:06 +01:00
Mikkel Oscar Lyderik
45b959f601 Move numlen(1) to sway/util.c 2015-12-14 17:07:52 +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
74152043f4 Implement 'bar { }' block parsing 2015-12-14 12:56:45 +01:00
Drew DeVault
e277d4e094 Subscribe to workspace change events and redraw 2015-12-13 16:04:54 -05:00
Drew DeVault
d361ce656d Track the fullscreen view on a workspace swayc_t 2015-12-13 07:58:00 -05:00
Drew DeVault
34277207fd Pass keys along from wayland backend to clients 2015-12-12 15:19:23 -05:00
Drew DeVault
029e0c7a2c Add some more keyboard handling for wayland clients 2015-12-12 12:54:10 -05: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
a7710c5537 Initialize keyboard in registry poll 2015-12-10 18:34:12 -05:00
Drew DeVault
266393a705 Include wayland-server.h instead of -core.h 2015-12-10 17:04:09 -05:00