Commit graph

950 commits

Author SHA1 Message Date
Drew DeVault 06107bb44e Make the nvidia warning louder 2016-03-24 16:48:53 -04:00
Drew DeVault fd061d4dc4 Don't set WLC_DIM on startup 2016-03-24 14:09:18 -04:00
Drew DeVault 5c85c018b4 Update to new WLC API 2016-03-24 14:08:53 -04:00
Drew DeVault ca400e84f5 Merge pull request #525 from mikkeloscar/fix-clang-warning
Use correct type for keycode
2016-03-20 07:46:06 -04:00
Mikkel Oscar Lyderik c1f91c4f5e Use correct type for keycode 2016-03-20 12:41:26 +01:00
Mikkel Oscar Lyderik 2935e24cf5 Implement 'smart_gaps' feature from i3-gaps 2016-03-20 12:29:47 +01:00
Mikkel Oscar Lyderik bb32cba795 Make key handling less strict
Sway has been very strict when it comes to key handling. Only on an
exact match would a bindsym be triggered.

This patch makes it less strict by for instance allowing the key combo
`$mod+1+2` to act as `$mod+2` if 2 was the last pressed key and `$mod+1`
if 1 was the last pressed key.

The new key handling uses the following algorithm:

1. List of bindings sorted by number of keys in binding (already the
default)
2. Find all bindings covered by the current keyboard state and list them
by same order as in 1.
3. Select the first binding from the list where the last pressed key is
part of the binding.

Addresses #452
2016-03-19 14:06:46 +01:00
Mikkel Oscar Lyderik 8c7bdfc004 Allow legal non-x11 keycodes 2016-03-19 13:36:37 +01:00
Mikkel Oscar Lyderik 9a04f9d8d6 Add config option workspace_layout
This implements the config parsing of
`workspace_layout <default|stacking|tabbed>`

http://i3wm.org/docs/userguide.html#_layout_mode_for_new_containers
2016-03-19 00:54:33 +01:00
Mikkel Oscar Lyderik 99f26c61a5 Don't strip quotes from exec args
Before passing a command to a command handler the quotes are stripped
from each argument in the command. This is usually the wanted behavior
but causes a problem in the case of `exec` where quoted arguments can be
required when passing the exec command to `/bin/sh -c`.

This patch makes `exec` a special case and doesn't strip quotes from the
arguments. It will just pass the exec command verbatim to the exec
command handler.

Fix #518
2016-03-18 10:02:18 +01:00
Mikkel Oscar Lyderik f63512480c Remove unused panel_size (and fix rearrange)
desktop_shell.panel_size was only used to determine if sway should
rearrange the output when rendering the panel in the output_pre_render
hook. This is not needed since the output will have been arranged at
that point.
It also caused sway to rearrange all the time when running with two
or more different monitors/resolutions because panel_size kept changing
with every output_pre_render callback.

Should fix #514
2016-03-17 23:47:42 +01:00
Mikkel Oscar Lyderik c1d5791482 Focus correct swaylock view in multimonitor setup
Swaylock spawns and focuses a view for each output in sway. This can
sometimes move the focus to a new output after locking and unlocking the
screens.

This patch makes sure that the output which had focus when swaylock
was invoked, will regain focus once swaylock is closed/unlocked.

Fix #499
2016-03-17 17:02:17 +01:00
Mikkel Oscar Lyderik db7697b830 Document swaybar commands
Documents most of the bar commands in sway-bar(5) manpage.

The following command has not been document because they haven't been
fully implemented yet:
 * mode
 * hidden_state
 * modifier
 * tray_output
 * tray_padding

Close #375
2016-03-17 15:41:24 +01:00
Mikkel Oscar Lyderik 9faa4ba0a0 Schedule render when adding bg and panel.
This should be a real fix for #509

This schedules a render when a background or panel is added to sway
through the desktop shell interface, that makes sure the render isn't
scheduled before the bg or panel is ready and you don't end up with a
black screen until the cursor is moved.
2016-03-17 12:05:54 +01:00
Mikkel Oscar Lyderik 1349a44171 Revert "Render outputs as soon as wlc is ready"
This reverts commit 96458bf63c.
2016-03-17 12:05:32 +01:00
Mikkel Oscar Lyderik 96458bf63c Render outputs as soon as wlc is ready
This makes sure that the outputs are rendered when sway is launched, so
the user doesn't have to move the cursor before the background and bar
gets rendered on screen.

Fixes #509
2016-03-13 17:13:30 +01:00
Mikkel Oscar Lyderik eb82a500c8 Remove focus when switching to empty workspace
Fix #504
2016-03-05 15:39:28 +01:00
Drew DeVault 181b6b31a4 Merge pull request #502 from mikkeloscar/lock-reset-input
Reset input state when locking compositor
2016-03-04 13:47:08 -05:00
Mikkel Oscar Lyderik ceb0ef64c2 Reset input state when locking compositor
Fix #498
2016-03-04 17:10:43 +01:00
Mikkel Oscar Lyderik 8ddafeeaae Fix assigning workspaces to outputs
It's possible to assign workspaces to certain outputs using the command:

    workspace <name> output <output>

However, this did not work in some cases where the workspace was
assigned before the given output was made available to sway.

This patch fixes those cases.
2016-03-04 16:44:49 +01:00
Yacine Hmito 9437eca3eb Segregate between config and runtime cmds in doc
In anticipation for #375, reorganized and augmented slightly sway(5)
so it makes a difference between commands intended for configuration,
commands intended for control, and those that can serve as both.
2016-02-29 22:12:39 +01:00
progandy 33887e3955 sway: rearrange the whole ws on lock view setup 2016-02-28 21:24:12 +01:00
progandy 52ff89cecc sway: set lock view to floating after ws switch
This avoids calling swayc_active_workspace.
2016-02-28 21:22:57 +01:00
Mikkel Oscar Lyderik 6088c6cdf0 Correctly move focus from one output to a new one.
This patch aims to correctly handle moving focus <left|right|up|down>
between outputs.

For instance, if moving from one output to a new output at the left of
the current one, it should focus the right-most view/container on the
new output, and the opposite if moving from right to left. This should
happen regardless of the previously stored focus of the new output.

This also handles moving to a new output above or below the current one.
2016-02-28 18:20:18 +01:00
Drew DeVault 3453910c3e Merge pull request #492 from mikkeloscar/swaybar-multi-output
Display single swaybar on multiple outputs
2016-02-27 16:18:50 -05:00
Mikkel Oscar Lyderik 67bbcceba1 Free config before exiting sway.
Apart from freeing the sway_config struct, this also terminates the
swaybars spawned by sway, since they are linked by PID to the bar config
structs.
2016-02-27 22:13:15 +01:00
Mikkel Oscar Lyderik e15a8a0376 Improve how swaybars are spawned 2016-02-27 22:12:35 +01:00
Mikkel Oscar Lyderik 212c6a18a2 Add outputs to bar_config ipc response 2016-02-27 22:12:35 +01:00
Mikkel Oscar Lyderik bad4e22f3b Make sway spawn only one bar per bar config 2016-02-27 22:12:35 +01:00
Mikkel Oscar Lyderik 5ff3fb1c04 Set pointer pos before focusing view under it 2016-02-27 13:18:55 +01:00
Mikkel Oscar Lyderik 5e253fdd9a Correctly exit sway on errors.
Calling `exit` in sway_terminate prevents sway from correctly shutting
down (freeing data, cleanly terminating the ipc server, etc.).

A better way is to exit straight away if the failure occurs before
`wlc_run` and use sway_abort as usual if it occur when wlc is running.
2016-02-26 09:42:21 +01:00
Yacine Hmito c400ca8f88 Fix for when sway_abort doesn't exit
sway_terminate does an exit in case wlc_terminate doesn't
2016-02-25 23:46:27 +01:00
Yacine Hmito 8db417fafe Fixed swaymsg command name in sway(5) doc 2016-02-25 23:05:38 +01:00
Yacine Hmito e239fbbd88 No options when using sway as IPC client
Sway used to attempt sending an IPC command composed of every argument
after the first non-option argument encountered.
Now, raises an error if an option is encountered before the intended command.
Some options such as -h or -v take effect when parsing, so they still
apply.
2016-02-25 23:04:59 +01:00
Yacine Hmito 179192e222 Removed p as a valid CLI option
The get-socketpath long option had an undocumented short alternative
as `p`. It has been removed.
However, the code in the options array is still the 'p' char.
2016-02-25 21:50:24 +01:00
Mikkel Oscar Lyderik 89bb6a4a42 Don't rearrange views behind swaylock.
Fix #481
2016-02-25 14:42:48 +01:00
Mikkel Oscar Lyderik c9d9dd7516 Check for empty ws on view destroyed.
In some cases destroying a view can result in an empty and inactive
workspace, which should be destroyed.

This handles those cases.
2016-02-25 13:36:25 +01:00
Mikkel Oscar Lyderik ee32bc3aef Send workspace ICP event on ws destroy/empty.
There is no 'destroy' change type in the i3 IPC so this uses `empty` to
notify about empty workspaces (which will be destroyed from sway right
after).
2016-02-25 12:59:22 +01:00
Mikkel Oscar Lyderik 739ba902e0 Prevent crash when showing scratchpad on new ws.
Fix #469
2016-02-25 11:43:07 +01:00
Mikkel Oscar Lyderik 016a77424a Prefer named output config over wildcard config.
This makes sure that a named output config is applied before the
general wildcard config when a new output is created. This ensures that
the config:

    output * ...
    output NAME ...

behaves the same way as:

    output NAME ...
    output * ...
2016-02-12 13:45:47 +01:00
Mikkel Oscar Lyderik 6f7cbf2eac Replace deprecated function wlc_output_get_pixels.
This makes IPC GET_PIXELS use the new `wlc_pixels_read` call instead of
the deprecated `wlc_output_get_pixels`.

The old version worked by passing a callback function to wlc which would
grab the pixels and send them to the IPC client.
The new version works by maintaining a list of clients who have
requested the pixels of some output and then grap and send the pixels in
the output_post_render hook of the `wlc_interface`.
2016-02-08 12:39:07 +01:00
Mikkel Oscar Lyderik be6455b295 Squash trailing whitespace 2016-02-08 12:31:13 +01:00
Mikkel Oscar Lyderik bacd40d6db Fix clang warnings 2016-02-08 12:30:42 +01:00
Drew DeVault 4546ce1188 Add wlc-render.h to handlers.c 2016-02-08 12:20:24 +01:00
crondog 7916eb70b9 commands: move position mouse
Bounds checking works ok except it overlaps the bar. Just like with
normal floating. Should be fixed once swaybar is fixed.
2016-01-28 22:10:56 +11:00
crondog 0ee5547406 font: Allow adding font to the config. In prep for border titles
v2: Give default font and make bar use it if no bar font
2016-01-27 20:53:31 +11:00
Drew DeVault f1f4791a3b Fix returning to sway after swaylock completes 2016-01-26 18:33:50 -05:00
Mikkel Oscar Lyderik 32ae26e519 Add quotes to multiword arguments.
This adds quotes around multiword arguments before they are passed to
`/bin/sh -c` in an exec command.

Example:

I connect to irc like this:

    exec termite -e "mosh server tmux a"

Without this patch the arguments are passed to sh as:

    termite -e mosh server tmux a

When it should be:

    termite -e "mosh server tmux a"

For the command to work.
2016-01-25 00:14:13 +01:00
Drew DeVault fe35ea633a Merge pull request #457 from mikkeloscar/move-view-fix
Fix rendering of view when moving to new workspace
2016-01-23 16:48:00 -05:00
Drew DeVault ef407559e2 Add new wlc thing to views 2016-01-23 16:35:39 -05:00
Drew DeVault a416715372 Revert "s/numlen/log10/g"
This reverts commit 038bb8cc7c.
2016-01-23 16:35:32 -05:00
Drew DeVault 038bb8cc7c s/numlen/log10/g 2016-01-23 15:51:38 -05:00
Quentin Glidic 449617f104 commands: Fix memory allocation in assign
Also use the safer snprintf since we just computed the size.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-01-23 20:22:51 +01:00
Quentin Glidic 43483d8fee commands: Fix usage of arrow in assign
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-01-23 20:22:51 +01:00
Christoph Gysin 2341ae64ad sway-input: fix typo 2016-01-23 14:08:52 +02:00
Mikkel Oscar Lyderik 102719c7dd manpage: fix sway-input layout 2016-01-22 19:26:13 +01:00
Mikkel Oscar Lyderik 54111839a4 manpage: add references sway.5 <-> sway-input.5 2016-01-22 19:26:13 +01:00
Mikkel Oscar Lyderik e953f634d9 Fix generating sway-input.5 manpage 2016-01-22 19:26:13 +01:00
Mikkel Oscar Lyderik 4cbb09d566 cmake: fix libinput include dirs 2016-01-22 05:17:33 +01:00
crondog cd0eaf00da Prevent ipc from crashing sway 2016-01-22 12:29:18 +11:00
Mikkel Oscar Lyderik fa0526f3df Fix rendering of view when moving to new workspace
This is a possible fix for #384.

To be honest I don't fully understand why this bug is happening, but I
have narrowed it down to the view stack in wlc and how sway orders views
in very specific situations (those described in #384).

Anyway this should fix the problem by eliminating the call to
`wlc_view_bring_to_front` which isn't really needed anyway since sending
all invisible views to the back is the same as bringing all visible
views to the front (rotating the view stack).
2016-01-21 22:28:26 +01:00
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
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