Commit graph

1447 commits

Author SHA1 Message Date
Mykyta Holubakha a2bc6f3bfd Arrange backgrounds only when required 2016-07-21 22:47:35 +03:00
Mykyta Holubakha 2029fef6b8 More progress on window events 2016-07-21 21:51:20 +03:00
Mykyta Holubakha 976e48d79f Initial work on window events 2016-07-21 21:51:20 +03:00
Mykyta Holubakha 0b5391ed77 Properly construct event bitmasks 2016-07-20 00:47:57 +03:00
Drew DeVault 6d971af5c3 Turn swaybg into a shell surface 2016-07-17 11:55:05 -04:00
Drew DeVault 3bb880bf20 Implement configurable wrapping on bar ws scroll 2016-07-17 11:26:38 -04:00
D.B ad7605675e refactor swayc_tabbed_stacked_parent into _ancestor and _parent and use where needed 2016-07-16 15:34:43 +02:00
Drew DeVault 147a88260a Fix #753 2016-07-16 09:09:22 -04:00
David Eklov c0b7610c26 Enable windows to register to get notified when the mouse wheel is scrolled 2016-07-15 19:14:31 -05:00
David Eklov 250ddc66c6 Rename pointer_input::notify to indicate that is called on button clicks 2016-07-15 19:14:31 -05:00
David Eklov a0c8799c80 Compute what workspace button is clicked
This commit does not do anything with this information other than logging it.
2016-07-14 17:18:01 -05:00
David Eklov 679c7b397c Use int instead of wl_fixed_t for mouse coordinates 2016-07-14 17:18:01 -05:00
David Eklov c805e42635 Extract workspace size computation from render_workspace_button()
Also remove some unnecessary strtup()s and rename a few variables and functions.
2016-07-14 17:18:01 -05:00
David Eklov 5c4f52f953 Set panels' geometries correctly and don't render them explicitly
Panels were explicitly rendered by calling wlc_surface_render in
handle_output_pre_render. Calling wlc_surface_render does not set the
surface's geometry (like wlc_view_set_geometry does). Sway did not call
wlc_view_set_geometry for panels, so wlc defaulted their geometry to be at
the origin. This is not correct for bars unless their location is top.

Furthermore, for a surface to receive pointer events, its mask has to be
set to visible. This causes wlc to render these surfaces, causing panels
and backgrounds to be rendered twice.

This commit makes panels and surfaces visible, sets the correct geometries
and removes the code that explicitly rendered them.
2016-07-14 17:18:01 -05:00
David Eklov 4bb45abc46 Don't treat backgrounds as shell surfaces
This code had some issues. Remove it now so that we can start clean and fix
it later.
2016-07-14 17:15:31 -05:00
Mykyta Holubakha c503bf1342 Suspend destruction of wss when creating views 2016-07-15 00:22:53 +03:00
D.B ee67cd0ba1 Fix tabbed/stacked corner case #742
Tabbed/stacked containers are now created only if a view is present on
the workspace. If a view is created on previously empty tabbed/stacked
workspace, it gets wrapped in a container.
2016-07-07 22:28:57 +02:00
David Eklov b9d8cbabdd Fix formatting guide violations (spaces instead of tabs) 2016-07-06 01:08:54 -05:00
David Eklov c8a64305fd Enable windows to register to get notified of pointer button events 2016-07-06 01:03:04 -05:00
David Eklov d9bcea381a Fix formatting guide violations (spaces instead of tabs) 2016-07-04 22:18:56 -05:00
David Eklov bb35960e65 Move code to make a window a shell surface into seperate function 2016-07-04 21:58:41 -05:00
David Eklov 51204b33c1 Enable backgrounds and panels to be shell surfaces
Prior to this commit all windows (e.g. shell surfaces) were handled the same
way in handle_view_created. Since backgrounds and panels have to be treated
differently, they could not be shell surfaces. This changes checks whether
a client is a background or a panel in handle_view_created and exists to
let them be dealt with elsewhere.
2016-07-04 21:58:07 -05:00
Zandr Martin e07b8c8d7c Merge branch 'master' into get-tree-command 2016-07-04 13:53:49 -05:00
Zandr Martin 15a324b0d3
implement get_tree command 2016-07-04 13:34:44 -05:00
Zandr Martin a7b94f1324
typo in focus.h 2016-07-03 12:22:10 -05:00
Zandr Martin d5e4fff345
resize command updates (#713) 2016-07-03 12:11:21 -05:00
David Eklov 26842ff383 Add get_log_level() to encapsulate v (current log level)
This patch also makes all global variable in log.c static.
2016-06-27 18:56:50 -05:00
Zandr Martin 889618d3ee
implement resize command for absolute dimensions 2016-06-11 17:02:16 -05:00
Zandr Martin 2298143d09
cleanup + add timeouts for pid_workspace list 2016-06-11 12:43:34 -05:00
Zandr Martin beaa03344e
clean up pid/workspace stuff 2016-06-11 09:20:09 -05:00
Zandr Martin 03d79b41c7
semi-working (only non-client/server wayland apps) 2016-06-10 06:08:59 -05:00
Zandr Martin 0f1859ed25 messy, unfinished version 2016-06-06 06:58:53 -05:00
Zandr Martin 9ccc92705e implement stable sort for lists
also change sort_workspaces() to use it
2016-06-02 15:48:14 -05:00
Denis Doria 009eaccd42 Clean up not used variables 2016-06-01 14:44:02 +02:00
Denis Doria 0ad7857f90 Included option floating_minimum_size
Values cannot be negative or 0; if so uses the default 75x50.
Uses the same syntax as i3: floating_minimum_size <width> x <height>, although the x can be anything.
2016-06-01 13:37:50 +02:00
Denis Doria f1d5b89d3e Initial work for floating view with sane values 2016-05-31 14:59:33 +02:00
Zandr Martin c6c3a8e758 Implement sort_workspaces() function for outputs.
This seems to have resolved issue #669 for me.
2016-05-27 17:37:56 -05:00
Tomáš Čech eda741d177 Match definition with declaration 2016-05-23 14:42:03 +02:00
Mykyta Holubakha e73dde3b10 Support floating_scroll sideways 2016-05-14 23:42:02 +03:00
Mykyta Holubakha 0c495eecde Remove FSB_GAPS_INNER and FSB_GAPS_OUTER 2016-05-08 17:17:35 +03:00
Mykyta Holubakha 0423c41a0f Implemented configurable floating scroll behavior 2016-05-07 20:49:51 +03:00
Eric Engestrom cc9d1cacbb common: refactor sway_log()
This removes most preprocessor logic, leaving it only it the header.
2016-05-02 18:30:04 +01:00
Jasen Borisov de007c9b58 Add input cmd for setting pointer accel profile. 2016-05-01 11:02:44 +01:00
Mikkel Oscar Lyderik ddd5b69b99 border: clear buffer on fullscreen views
This patch makes sure to clear the border buffer of fullscreen view so
the border doesn't get drawn behind a fullscreen view, which would be
visible if the view was transparent.
2016-04-27 11:24:28 +02:00
Mikkel Oscar Lyderik 856ac7d5cc Remove unused function 2016-04-25 00:00:49 +02:00
Mikkel Oscar Lyderik 3e1f78ab26 Add support for nested tabbed/stacked containers 2016-04-25 00:00:49 +02:00
Mikkel Oscar Lyderik e226b20bd8 Reapply prev layout when exiting tabbed/stacked 2016-04-25 00:00:49 +02:00
Mikkel Oscar Lyderik d26658fb35 Correctly determine default layout 2016-04-25 00:00:49 +02:00
Mikkel Oscar Lyderik 8d700fe008 Fix problems with floating windows
Makes any tabbed/stacked layout a container to separate from floating
windows which may be attached to a workspace.
2016-04-25 00:00:49 +02:00
Mykyta Holubakha 0f1cfdec61 Renamed to pango_markup 2016-04-24 20:35:21 +03:00
Mykyta Holubakha 53b53dd8c2 Added plaintext markup configuration 2016-04-24 19:57:35 +03:00
Drew DeVault e5d2efbfc9 Style issue 2016-04-17 11:38:12 -04:00
Drew DeVault 84fae94ab9 Flesh out pango markup implementation 2016-04-17 11:36:03 -04:00
Eric Engestrom 3e8081514d Fix spelling mistakes 2016-04-02 16:00:05 +01:00
Mikkel Oscar Lyderik 7be476c115 Add cmds new_window and new_float
Makes it possible to set default layout style for new windows and new
floating windows.

Close #556
2016-03-31 12:42:20 +02:00
Drew DeVault a12850444d New feature: adjust gaps with floating_mod+scroll
I made this configurable but I didn't make the command for it. That's
left as an exercise to an eager contributor.

    mod_scroll_behavior [gaps inner|gaps outer]

Would merge implementions of more behaviors for mod+scroll, if anyone
has some neato ideas.
2016-03-30 08:34:32 -04:00
Mikkel Oscar Lyderik 7878de5ccc Mark focused view focus_inactive on unfocused output 2016-03-30 00:47:58 +02:00
Mikkel Oscar Lyderik 5a13cb0ed1 Implement borders
The borders are implemented as a surface/buffer attached to each view
which is sent to and rendered by wlc in the view_pre_render callback.

All the drawing logic is handled in sway/border.c and all the logic for
calculating the geometry of the border/view is handled in
`update_geometry` in sway/layout.c (same place as gaps are calculated).
2016-03-30 00:47:58 +02:00
Mikkel Oscar Lyderik 3b05f92f76 Add border <none|normal|toggle|pixel> config 2016-03-30 00:47:58 +02:00
Mikkel Oscar Lyderik 86ea79ea6d Implement parsing of hide_edge_borders 2016-03-30 00:47:58 +02:00
Mikkel Oscar Lyderik cefcce48aa Make client/pango.h not depend on client/window.h 2016-03-30 00:47:58 +02:00
Mikkel Oscar Lyderik e2774aee3c Add default border colors 2016-03-30 00:47:58 +02:00
Drew DeVault b903f7f655 Implement some more on borders
Note that this segfaults ALL THE TIME in wlc code. Paging @Cloudef for
help, I'm at a loss.
2016-03-30 00:47:58 +02:00
Drew DeVault 4611bba3db Initial setup of window border rendering
Please don't complain to me about the performance of this
2016-03-30 00:47:58 +02:00
Mikkel Oscar Lyderik 71a5350b68 Implement include command
The include command (`include <path>`) makes it possible to include sub
config files from the main config file (or from within other sub config
files).

The include command uses the following rules for including config files:

* the `path` can be either a full path or a path that is relative to the
  parent config. Shell expansion is supported, so it's possible to do
  `include ~/.config/sway.d/*`.
* The same config file can only be included once (to prevent include
  cycles). If a config is included multiple times it will just be
  ignored after it has been included once.
* Including a sub config file is the same as inserting the content of
  that file into the parent config, thus rules about overwriting
  bindsyms etc. works the same as for a single config.

Implement #542
2016-03-26 16:37:50 +01:00
Kevin Hamacher fb6dcce2ad Add graphical feedback to swaylock (#526) 2016-03-25 15:24:41 +01:00
Drew DeVault 5c85c018b4 Update to new WLC API 2016-03-24 14:08:53 -04:00
Mikkel Oscar Lyderik 2935e24cf5 Implement 'smart_gaps' feature from i3-gaps 2016-03-20 12:29:47 +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 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
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 e4c1176b72 Differentiate between all or no outputs 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 6d57f03028 Make single bar handle multiple outputs 2016-02-27 22:12:35 +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
Mikkel Oscar Lyderik b107fc6e5a Fix ipc event bit masks 2016-02-21 22:49:20 +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
Drew DeVault e5bb08cc18 Print /proc/<pid>/maps on segfault 2016-01-28 07:57:07 -05: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
Christoph Gysin a5345e807e extract cairo_set_source_u32() 2016-01-25 22:44:33 +02: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
Mikkel Oscar Lyderik ed227f5664 swaybar: move headers to include/bar 2016-01-24 15:55:58 +01:00
Mikkel Oscar Lyderik c6fc0033e1 swaybar: move core functionality to state.c 2016-01-24 14:22:19 +01: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
Cole Mickens 28081b7689 libinput 2016-01-19 06:51:36 -08: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 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
Drew DeVault 7614cb0373 Add keyboard handling shims to registry 2015-12-10 08:32:56 -05:00
Drew DeVault 067ac6cfa7 Discover swaylock extension in registry 2015-12-10 08:05:27 -05:00
Drew DeVault 080a263785 Refactor gdk pixbuf code into shared client lib 2015-12-10 07:57:46 -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
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
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
Drew DeVault 82d464bb90 Add text rendering support to wayland clients 2015-11-29 15:27:28 -05:00
Drew DeVault e59cffcea2 Support desktop shell panels in compositor 2015-11-29 12:03:13 -05:00
Drew DeVault 4c1fad95b9 Remove trailing semicolon 2015-11-29 09:07:50 -05:00
Christoph Gysin 7d82cd9c0a cmd_output: Use list_seq_find() to find matching config 2015-11-29 15:29:06 +02:00
Drew DeVault e0cb8284fb Rearrange logging headers
Ref #270
2015-11-28 08:49:02 -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
Drew DeVault 062c74b7d0 Add command line to swaygrab
Also modifies IPC client so that we can work with persistent
connections.
2015-11-27 10:10:29 -05:00
Drew DeVault 27f03c705d Move IPC client into common, refactor IPC 2015-11-27 09:50:04 -05: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
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
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 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
S. Christoffer Eliesen a33e3badad list: Add list_seq_find.
Sometimes one has to traverse a list to find out if some data already
exists there in order to avoid dupilcates in the list, and this function
facilitates in that without requiring that the data is ordered.
2015-11-21 22:22:08 +01:00
Drew DeVault 79b277fe9b Parse output background config 2015-11-19 18:25:15 -05:00
Drew DeVault b4e5e1381f Refactor the crap out of wayland clients
And create a background surface on every output when invoking swaybg.
2015-11-19 07:58:57 -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 7a40eb6de6 Support cursors over wayland clients
Apparently wayland has fucking client-side cursors, too
2015-11-18 19:38:42 -05:00
Drew DeVault 86372d00db Fix SIGBUS from wayland clients 2015-11-18 09:55:55 -05:00
Drew DeVault 665d4baaf1 Normalize indentation 2015-11-18 08:44:08 -05:00
Drew DeVault 9a1e95b7da Clean up memory pool files better 2015-11-18 08:36:08 -05:00
Drew DeVault 399220f14b Fix up wayland client implementation
Now it receives frame callbacks and renders properly, and is double
buffered and such.
2015-11-18 08:22:53 -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 c43ef2aedd We don't need to implement strdup
After defining _GNU_SOURCE
2015-11-12 19:43:03 -05:00
Drew DeVault 11b1ba397f Further refinement of wayland client support 2015-11-12 19:35:39 -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 d729032ba2 Add file and line number to log in Debug build 2015-11-11 08:32:32 -05:00
Drew DeVault edb3e4b5ab Add some documentation comments
This is mostly setting a precedent, I hope that others will continue to
write docs for more headers.

Ref #218
2015-11-08 12:06:51 -05:00
S. Christoffer Eliesen abc5fbfaec Learn "gaps edge_gaps <on|off|toggle>".
When yes, the old behaviour of adding half the inner gap around each
view is used.

When no, don't add any gap when an edge of the view aligns with the
workspace. The result is inner gap only between views, not against the
workspace edge.

The algorithm is not perfect because it means the extra space is
distributed amongst edge-aligned views only, but it's simple, looks good
and it works.
2015-11-04 13:21:10 +01:00
S. Christoffer Eliesen af31a3f04a commands: Learn 'move workspace to output <direction|name>'. 2015-11-03 22:38:53 +01:00
S. Christoffer Eliesen 515ed86f4d container.h: Remove unused. 2015-10-29 19:13:52 +01:00
S. Christoffer Eliesen 5ba47d4a44 input_state: Remove mouse_origin (x&y). Query wlc instead. 2015-10-29 18:02:02 +01:00
S. Christoffer Eliesen 78ca619769 commands: Learn mouse_warping.
Place mouse at center of focused view when changing to a workspace on a
different output, if option is enabled. (This replicates existing i3
option.)

This can be triggered in multiple ways:
A) via `workspace <name>` which changes output
B) via `focus <direction>` which changes output
C) via `focus output <name>` which (obviously) changes output
2015-10-29 17:41:33 +01:00
S. Christoffer Eliesen 4799d07ac1 input_state: Extract 'pointer_position_set' function from handlers. 2015-10-29 16:37:19 +01:00
S. Christoffer Eliesen 865b30f138 container: Move container_under_pointer here from handlers. 2015-10-29 16:37:19 +01:00
Drew DeVault 6cd106d23c Merge pull request #208 from minus7/ipc_subscribe
implemented IPC subscribe for workspace event
2015-10-27 17:19:18 -04:00
minus 9925554ea4 implemented IPC subscribe for workspace event 2015-10-27 21:59:17 +01:00
S. Christoffer Eliesen 9f02b0bf16 commands: Learn 'debuglog'.
Replicates i3 option. Verbosity level given as command line argument
becomes default log level, and using 'debuglog toggle' switches back and
forth between default and debug (or L_ERROR and debug if default is also
L_DEBUG).
2015-10-27 14:37:44 +01:00
S. Christoffer Eliesen 5a70853253 log: Add swayc_log, use at a few key places.
swayc_log works just like sway_log, but appends type and name from given
container to the log output.
2015-10-25 13:14:28 +01:00
S. Christoffer Eliesen c6bb23b7dd sway/output: Create, move code from handlers.c here. 2015-10-25 13:14:23 +01:00
S. Christoffer Eliesen c1479701de seamless_mouse: Move pointer only if successfully changed workspace.
If e.g. a window has a popup open then that will lock the current focus,
making a workspace switch denied.

So don't move the mouse pointer in such cases.
2015-10-23 16:35:48 +02:00
S. Christoffer Eliesen 362413bd50 commands: cmd_results->input is duplicated/freed. 2015-10-23 13:03:14 +02:00
S. Christoffer Eliesen af30a1b67c ipc,commands,config: Replace cmd_status enum with cmd_results struct.
In i3 the ipc reply will contain a human readable error message, and
this patch replicates that behaviour.

However, that error message is also useful for logging, which this
patch takes advantage of.

E.g. instead of logging errors directly in commands.c/checkargs, it is
fed back to the caller which eventually ends up logging everything with
maximum context available (config.c/read_config).

So instead of logging e.g. "Error on line 'exit'" it will now log:
"Error on line 'exit': Can't execute from config."
2015-10-22 23:36:24 +02:00
S. Christoffer Eliesen edf33aad29 config: Add "seamless_mouse" to decide if pointer crosses output edges. 2015-10-22 01:39:12 +02:00
S. Christoffer Eliesen ca862a5bd4 config: Apply output config also during config reload. 2015-10-21 23:24:06 +02:00
S. Christoffer Eliesen 3be11a08e6 main: Implement --get-socketpath switch. 2015-10-18 19:53:56 +02:00
taiyu 0d51f62224 merge + no c_extensions 2015-09-18 07:23:04 -07:00
Drew DeVault 318e1be240 Fix warnings introduced by prior commit 2015-09-18 07:27:35 -04:00
taiyu 0bea2e2122 multi command keybinds 2015-09-14 19:59:25 -07:00
Drew DeVault e505abfe75 Revert "new_workspace null behavior + testmap functions + regex"
This reverts commit e1d18e42a8.

Fixes #180

cc @taiyu-len
2015-09-13 19:46:16 -04:00
taiyu f76f9e2eea visible values 2015-09-12 02:52:18 -07:00
taiyu e1d18e42a8 new_workspace null behavior + testmap functions + regex 2015-09-12 02:38:03 -07:00
taiyu aaa0923bc4 cmd status + workspace ws output op 2015-09-10 11:07:40 -07:00
taiyu 6388241abb mode supports multi token names 2015-09-08 10:53:15 -07:00
taiyu aa22dc3113 var replacement changes 2015-09-08 10:27:09 -07:00
taiyu d673a72705 set variable changes 2015-09-08 08:54:57 -07:00
taiyu 71af5b7dde config modes 2015-09-07 14:29:40 -07:00
taiyu f25c6b312b gap resize 2015-09-05 20:48:52 -07:00
taiyu 2ef83664f5 remove outdated comment 2015-09-04 17:10:10 -07:00
taiyu afa6747145 enum for command type 2015-09-04 17:09:07 -07:00
taiyu 4cd18449d2 better handling of commands during config 2015-09-04 16:57:03 -07:00
taiyu dbeca88dee default gap value 2015-09-04 16:14:59 -07:00
Luminarys 12e96f0f9e Added in workspace_auto_back_and_forth 2015-08-30 21:34:24 -05:00
Luminarys fe2ec8a676 Added in workspace back_and_forth 2015-08-30 19:59:14 -05:00
Luminarys 28e937020a Made scratchpad handling identical to i3 2015-08-29 21:14:13 -05:00
Luminarys 7eefecf479 Added in scratchpad adding 2015-08-28 23:39:12 -05:00
taiyu 1820b3f0bb move function redone 2015-08-28 11:03:10 -07:00
taiyu 5678d824e4 update visibility + container info functions 2015-08-27 23:18:28 -07:00
taiyu da79bd65de use previous outputs 2015-08-27 20:32:56 -07:00
Luminarys acb3fbdfb5 Added in default_orientation handling 2015-08-27 21:52:59 -05:00
taiyu 357af228d6 some function documentation, fixed gaps on config reload 2015-08-26 13:35:22 -07:00
taiyu 1fa7a91bfb move_container_to fixup 2015-08-26 11:01:26 -07:00
taiyu 225c2fbe5b fixed segfault on exit + a little fixup of that floatfocus pr 2015-08-25 13:29:33 -07:00
minus ca89ba83a8 changed view visibility to be bool
view_visibility enum remains with one constant that is the mask to wlc's view masking
2015-08-25 20:13:35 +02:00
minus e533014201 added missing util.h/c stuff 2015-08-25 19:53:59 +02:00
minus e854a54e96 changed workspace_{outout_,}{next,prev} to return workspace
so it can be reused for "move container to workspace next"
2015-08-25 19:00:20 +02:00
minus 03e4a97dbe added "move container to workspace"
makes the previous commit actually testable
2015-08-25 18:25:36 +02:00
minus f22c937953 refactored view visibility
- replace visibilty mask integers with an enum
- set output's visibilty mask on creation
- added update_visibility to manually update a containers visibility (e.g. when it moved to an invisible workspace)
2015-08-25 18:24:15 +02:00
minus 1efda79bf2 refactored workspace_next/prev 2015-08-25 15:17:18 +02:00
Luminarys 7c5b6f8c52 Added in backtrace printing 2015-08-24 15:44:58 -05:00
taiyu dbad30a409 add limit to swayc_in_direction 2015-08-24 01:11:21 -07:00
taiyu c8415d7fef split_string memory leaks cleanedup 2015-08-23 19:09:18 -07:00
taiyu 51ab3c9180 merge 2015-08-23 12:34:18 -07:00
Drew DeVault 1ac0c8cd47 Refactor keyboard to consider modified keysyms
Press Shift
Press 0       # Reads as ')'
Release Shift
Release 0     # Reads as '0' but we now recognize it as the same
2015-08-23 15:28:49 -04:00
Luminarys a65dca04e8 Style fix 2015-08-23 13:19:47 -05:00
Luminarys 98fad060e2 Added in glitchy disabling 2015-08-23 12:23:01 -05:00
taiyu d72cc92541 style 2015-08-23 07:59:18 -07:00
taiyu f24b78898a dont swap view with workspace... 2015-08-22 21:54:39 -07:00
taiyu 42d5d9a177 mouse tile resize mode done 2015-08-22 21:03:45 -07:00
taiyu e139de0857 floating/tiling move + floating resize cleaned and fixed 2015-08-22 18:01:38 -07:00
Drew DeVault b7f4607544 Implement output configuration through config
Do not use `output res WIDTHxHEIGHT` yet, wlc has issues with it (cc
@Cloudef)
2015-08-22 11:18:55 -04:00
Luminarys f6b16ca089 Refactored resizing functions into resize.c 2015-08-21 22:26:11 -05:00
taiyu 5a67628ad9 Merge branch 'master' of https://github.com/SirCmpwn/sway
merge
2015-08-21 10:28:49 -07:00
taiyu 1a1ac64662 bugfixes, renames 2015-08-21 10:28:37 -07:00
Drew DeVault 1c38b7a8d2 Merge pull request #111 from Luminarys/master
Added in proper resize locking
2015-08-21 12:23:53 -04:00
Luminarys a8eab5492a Added in proper resize locking 2015-08-21 11:19:06 -05:00
minus 8dfaf6265b fixed #108 signed/unsigned comparison 2015-08-21 16:53:11 +02:00
Luminarys 7ecb55f218 Minor style fix 2015-08-21 09:29:52 -05:00
Luminarys 97bd548456 More minor fixes 2015-08-21 09:26:22 -05:00
Luminarys de86c5f4ea Cleanup and minor fixes 2015-08-21 09:24:26 -05:00
Drew DeVault a436fc17ff Merge pull request #105 from Half-Shot/master
Basic 'move' functionality.
2015-08-21 07:24:17 -04:00
Drew DeVault 464b49eda2 Merge pull request #101 from Luminarys/master
Added in basic resizing command.
2015-08-21 07:12:05 -04:00
Luminarys 96ab21b276 Fixes to resizing and added in resize lock once boundaries are exceeded 2015-08-21 00:49:47 -05:00
Luminarys 461da7f87f Added in bspwm like mouse resizing 2015-08-21 00:17:26 -05:00
Luminarys f589731f29 Rewrite of resize command to make it more sane 2015-08-20 21:37:59 -05:00
Drew DeVault 3a5fce339f Reset key buffer on reload
To preserve my sanity
2015-08-20 17:14:46 -04:00
Half-Shot 713bf29ec9 Few stray bits 2015-08-20 21:45:00 +01:00
Half-Shot 5a9ba261bc Merge branch 'master' of https://github.com/SirCmpwn/sway 2015-08-20 21:32:08 +01:00
Half-Shot 2a62c5c7fb Basic left right move command implemented. 2015-08-20 21:29:40 +01:00
minus 754793aad4 added IPC messages get_workspaces and get_outputs
No escaping on container names is done yet, as well as some values are
hardcoded because they don't exist yet.
2015-08-20 21:13:01 +02:00
taiyu 36e07e9ebc find_parent_by_type 2015-08-20 09:52:54 -07:00
Luminarys bc3babf566 Added in basic resize command 2015-08-20 11:30:32 -05:00
Luminarys 15d9f1edcb Added in basic resize command 2015-08-20 11:30:11 -05:00
minus f8787ce69e added missing header file 2015-08-20 15:27:59 +02:00
minus f26ed32e46 added sway_terminate to exit cleanly 2015-08-20 15:27:56 +02:00
minus 91c0877264 properly exit sway
- wlc_terminate() instead of exit(0)
- unlink IPC socket
2015-08-20 15:24:33 +02:00
minus 773e85c681 properly handle IPC clients 2015-08-20 15:24:33 +02:00
minus 5d99215469 added i3-ipc support/parsing 2015-08-20 15:24:33 +02:00
minus 8981b48cd2 very basic IPC implementation
simply executes the received data as command
2015-08-20 15:24:33 +02:00
Drew DeVault 579fe70ed9 Add command line parsing
Closes #6
2015-08-20 08:37:24 -04:00
taiyu f5fde7c45c style 2015-08-20 05:06:22 -07:00
taiyu fbaa9111a8 setup for resizable windows, drop weight 2015-08-20 04:47:36 -07:00
taiyu 5ff0619ca1 input state, find_container_in_direction 2015-08-19 20:22:15 -07:00
taiyu 470b4dfbae key_state.ch, and command conflicts resolved 2015-08-19 18:59:27 -07:00
taiyu c5a6982893 fixed some more bugs, moved layout_log into log.ch, restored focus_parent 2015-08-19 01:06:15 -07:00
taiyu e16a4015ff fixed focus key handler 2015-08-19 00:28:53 -07:00
Luminarys 3c430688a8 header update 2015-08-18 21:06:41 -05:00
KoffeinFlummi c75d5ceba4 Merge remote-tracking branch 'upstream/master' into gaps 2015-08-19 00:05:18 +02:00
KoffeinFlummi 4c688cba4e Add support for gaps option 2015-08-18 23:53:57 +02:00
minus faccaf6112 added sway_assert function
returns false on a failed assertion in release mode and raises SIGABRT in debug mode
2015-08-18 23:38:34 +02:00
Drew DeVault 85a573dab7 Revert "enhanced whitespace remover"
This reverts commit abd0afb03a.
2015-08-18 08:39:26 -04:00
Drew DeVault 2139001c9f Coding style enforcement
This was done by hand, so I might have missed things. If anyone knows of
a good C style enforcement tool, let me know.
2015-08-18 07:20:34 -04:00
Drew DeVault 2f6dd0687b Merge pull request #65 from taiyu-len/focus_v2
Focus v2
2015-08-18 07:02:31 -04:00
taiyu b132f67e7b minor fixes 2015-08-18 03:48:41 -07:00
taiyu abd0afb03a enhanced whitespace remover 2015-08-18 03:22:31 -07:00
taiyu 63bc0d3b54 more changes 2015-08-18 02:46:14 -07:00
taiyu 4606fb1ee3 merged Luminarys resizing code 2015-08-18 01:07:12 -07:00
taiyu 11321ca2dd changed handling of focus, handling of view by type 2015-08-18 00:28:44 -07:00
Luminarys e541ba3d87 Added in basic, but semi-broken moving/resizing functionality to floating windows 2015-08-18 01:33:15 -05:00
Drew DeVault 780893a933 Add support for workspace [name] output [name] 2015-08-17 20:34:53 -04:00
Luminarys c9ce8bf1bd Style and other minor fixes 2015-08-17 10:34:39 -05:00
Luminarys 47ec999e71 Fixes to floating and umanaged views 2015-08-17 10:18:06 -05:00
Luminarys 05f969074e Added in basic floating toggling 2015-08-17 00:38:34 -05:00
taiyu f1d5305dc6 fix 2015-08-16 19:06:31 -07:00
taiyu c024f06631 handle_view_state_request 2015-08-16 17:28:06 -07:00
Luminarys 0a0fe18fd6 Added in workspace next/prev and workspace output_next/prev 2015-08-16 14:50:01 -05:00
Drew DeVault 7f8ebb7d0d Move headers to include/ 2015-08-16 11:02:56 -04:00