Commit graph

739 commits

Author SHA1 Message Date
Mikkel Oscar Lyderik 2c43bd2ac8 Only update visibility if WS isn't destroyed after
No need to update visibility if the workspace will be destroyed right
after.
2016-01-21 22:05:06 +01:00
Yacine Hmito c487cf71a5 Fix issue #455
CMAKE_INSTALL_FULL_SYSCONFIG is not actually passed to
the C preprocessor. I remember it working, so I must have
messed up somewhere last time I touched this.
This is fixed by manually passing its value to the C preprocessor
through the SYSCONFDIR definition
2016-01-21 21:08:18 +01:00
Drew DeVault d969a1dec0 Fix memory leak in config.c
Thanks @jollywho
2016-01-21 11:18:13 -05:00
Mikkel Oscar Lyderik ac740271a5 Strip stray whitespace 2016-01-21 17:03:21 +01:00
Cole Mickens 28081b7689 libinput 2016-01-19 06:51:36 -08:00
crondog 81caf89ff8 cmd_assign
This implements cmd_assign. Basically a copy and paste from
cmd_for_window however it has → handling and injects a `move container to
workspace`
2016-01-15 16:03:34 +11:00
Mikkel Oscar Lyderik 0ba3f08f52 Strip quotes from workspace name v2
This is a more general fix for #444

This reverts part of commit 222f0d44fc.
2016-01-11 03:42:45 +01:00
Mikkel Oscar Lyderik fc8e5703a5 Strip quotes of each argv when handling command 2016-01-11 03:39:34 +01:00
Mikkel Oscar Lyderik 222f0d44fc Strip quotes from workspace name.
Fix #444

This is a temporary fix, the real fix is to store the commands as a
formatted argv array, so they don't have to be reformatted all over the
place.
2016-01-11 03:13:36 +01:00
Mikkel Oscar Lyderik 15621ea8ff Add backwards compatability for binding event 2016-01-09 20:56:42 +01:00
Mikkel Oscar Lyderik e3ddcaabc4 Add bindcode to binding events. 2016-01-09 20:31:18 +01:00
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 cb8ac7fd4a Unescape string after doing var replacement
Fix #426
2016-01-08 23:30:18 +01:00
Mikkel Oscar Lyderik 15cbc53a77 Make IPC binding event support a compile time opt. 2016-01-08 15:03:25 +01:00
Mikkel Oscar Lyderik 14147ac056 Reduce duplicate code 2016-01-08 14:27:41 +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 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
Drew DeVault 8f5de70c93 Merge pull request #434 from mikkeloscar/detect-modifier
Send IPC modifier event on bar_modifier up/down
2016-01-06 07:26:54 -05:00
Mikkel Oscar Lyderik 9186455a3c Merge branch 'master' of github.com:SirCmpwn/sway 2016-01-05 23:44:03 +01:00
Mikkel Oscar Lyderik 364e37a1eb Fix whitespace issues. 2016-01-05 23:42:40 +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
Jøhannes Lippmann 648db4016f Clearer order of locations searched for config file.
The i3wm config locations are visited _before_ using the fallback
configs. The man page was confusing - it talked about the fallback
configs first, but also said they are looked at "at last". By changing
the order of the sentences, this should be clearer.
2016-01-05 22:06:02 +01:00
Mikkel Oscar Lyderik 2e0ef533f2 Init layout before checking config 2016-01-05 19:16:46 +01:00
Mikkel Oscar Lyderik a8402035e9 Add modifier key to bar_config json 2016-01-05 18:36:26 +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
Drew DeVault caaff5ac54 Revert "Free wordexp_t in config.c:get_config_path"
This reverts commit 33b24736c7.
2016-01-04 23:00:56 -05: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
Drew DeVault 33b24736c7 Free wordexp_t in config.c:get_config_path
Thanks @jollywho
2016-01-04 19:39:33 -05:00
Mikkel Oscar Lyderik 5af4e747d3 Merge pull request #433 from crondog/issue431
Return focus to fullscreen view
2016-01-05 01:14:28 +01:00
crondog b755fd073e Return focus to fullscreen view
This fixes https://github.com/SirCmpwn/sway/issues/431 by returning
focus to the fullscreen view. Also it fixes the issue with the
fullscreen view pointer not being set which did my head in
2016-01-05 10:55:29 +11:00
Mikkel Oscar Lyderik 7727c9efbc Detect bar modifier pressed/released 2016-01-05 00:49:44 +01:00
Mikkel Oscar Lyderik e62c49f83c Fix overwriting current pressed keys.
This fixes a bug where the key at index 0 in the `key_state_array` would
be overwritten by the next pressed key. This broke any bindings
consisting of multiple non-mod keys like: `$mod+a+b`.
2016-01-04 23:26:40 +01:00
Mikkel Oscar Lyderik aa2f754c64 swaybar: Implement binding_mode_indicator 2016-01-03 22:16:36 +01:00
Mikkel Oscar Lyderik 19833fbc8b Add IPC event types
Adds custom IPC_EVENT_* types
2016-01-03 20:37:10 +01:00
crondog 397b58e88f split toggle
Not sure if you will accept this, but i find it useful (I use it when
opening new terminal windows on a workspace

v2: add short hand command and docs
2015-12-31 11:14:06 +11:00
crondog 596c4d9428 Dont try and fullscreen a workspace with no views
Found this completely by accident
2015-12-30 13:50:50 +11:00
Drew DeVault 5292860b92 Merge pull request #418 from mikkeloscar/sway-handle-sigterm
Handle SIGTERM sent to sway
2015-12-29 08:22:32 -05: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
Drew DeVault d409620a55 Fix use-after-free when closing fullscreen views 2015-12-29 00:04:12 -05:00
S. Christoffer Eliesen b18f004210 handlers: geometry_request: Better debug output.
Previous output was confusing.
2015-12-28 14:58:17 +01:00
S. Christoffer Eliesen 6750975b9f arrange_windows_r: Round pixels to match reality, fixes calculations.
If the width or height of a container can't be evenly distributed to its
children, then the layout algorithm still thought it got it right (due
to using decimals) which caused a gap of one or more pixels for some
window arrangements.

This is fixed by this patch by first rounding off the width and height
(so that decimals are never introduced) and then adjusting the last
view in a container to fill the remaining pixels (which now is counted
correctly due to the decimals being removed).

Also, due to the way gaps are implemented, an odd sized gap can never be
aligned properly, so just adjust to closest even number.
2015-12-28 14:58:17 +01:00
S. Christoffer Eliesen 831f6680f4 arrange_windows_r: Bring parent coordinates into layout calculations.
This brings consistency into the algorithm (instead of resetting and
then fetching again).
2015-12-28 01:14:48 +01:00
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