Commit graph

566 commits

Author SHA1 Message Date
Drew DeVault
5728307520 Add wallpapers to output command 2015-11-19 18:55:17 -05:00
Drew DeVault
79b277fe9b Parse output background config 2015-11-19 18:25:15 -05:00
Drew DeVault
4a1584be53 Fix background extensions
Thanks @Cloudef, it works great
2015-11-19 07:23:11 -05:00
Drew DeVault
65b8a5c3ce Add background handling
This does not work as expected. I think the problem is on the wlc side.
Please review, @Cloudef. To reproduce the issues:

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

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

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

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

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

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

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

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

Fixed warnings on strict aliasing and cleaned up relevant code in
general.
2015-11-11 08:43:36 -05:00
Drew DeVault
d729032ba2 Add file and line number to log in Debug build 2015-11-11 08:32:32 -05:00
Mikkel Oscar Lyderik
d5b5d92b30 Include header declaring ipc_event_workpace(2) 2015-11-04 21:12:25 +01: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
eeec0fda8a commands: gaps: Re-arrange windows after changing default gaps. 2015-11-04 01:32:38 +01:00
S. Christoffer Eliesen
936f8c24e0 commands: gaps: Always apply default gaps config. 2015-11-04 01:32:37 +01:00
S. Christoffer Eliesen
5c1e20b6ff commands: gaps: Accept zero value. 2015-11-04 01:32:37 +01:00
S. Christoffer Eliesen
820681965d commands: gaps: Refactor, expected_syntax. 2015-11-04 01:32:37 +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
9c8394022e commands: Learn 'move <container|window> to output <direction|name>'. 2015-11-03 22:38:53 +01:00
taiyu
65d71d0a5e put ipc_event_workspace in update_focus 2015-11-02 11:28:51 -08: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
S. Christoffer Eliesen
3c250e78be layout: get_swayc_in_direction: Properly find adjacent outputs. 2015-10-29 16:20:48 +01:00
S. Christoffer Eliesen
5fa8f91655 commands: Learn 'focus output <direction|name>' 2015-10-28 20:06:48 +01:00
S. Christoffer Eliesen
fede354a3d layout: Don't reset container size if it's a floating window. 2015-10-28 20:06:48 +01:00
S. Christoffer Eliesen
fabcf7c678 handlers: Pass workspace to workspace_switch, not output. 2015-10-27 23:22:57 +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
83ca7d3a5c output: Fix code style. 2015-10-25 13:57:11 +01:00
S. Christoffer Eliesen
c49e5340db commands: cmd_move: Fix "move container to workspace _number_ n"
This is an undocumented feature (the word "number" is just ignored
anyway), but it exists to be compatible with i3 config syntax.

Plus some code cleanup at the same time.
2015-10-25 13:19:48 +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
Drew DeVault
010368150b Update set_origin to match wlc changes 2015-10-23 14:29:35 -04: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
1f08106b0a handlers: Don't switch output when mouse button is pressed.
(E.g. if the user is using a scrollbar at the edge of the screen then
switching workspace would cancel the scroll.)
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
88a2ddbe83 commands: Code formatting. 2015-10-23 12:55:48 +02:00
S. Christoffer Eliesen
187f0ab1c4 commands: Allow 'floating_modifier' & 'focus_follows_mouse' at runtime. 2015-10-23 12:45:46 +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
544c6c412a ipc: Return correct status in ipc reply. 2015-10-22 23:36:24 +02:00
S. Christoffer Eliesen
b093a5d16f handlers: Fix swapped top/bottom for seamless transitions. 2015-10-22 23:07:27 +02:00
Drew DeVault
2c100105bf Move pointer during seamless transitions 2015-10-22 16:44:29 -04: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
fc1bacf034 Switch to adjacent output when hitting output edge.
(Currently, after switching output the relative position of the mouse
stays the same.)
2015-10-22 01:18:51 +02:00
S. Christoffer Eliesen
9b271573a9 commands: Allow changing resolution outside config load. 2015-10-22 00:16:10 +02:00
S. Christoffer Eliesen
4fea92ef0c config: Don't try to apply bad output resolution. 2015-10-21 23:59:01 +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
6eb8da0e14 commands,container: Tweak debug output to better reflect reality. 2015-10-21 22:22:01 +02:00
S. Christoffer Eliesen
e3837ba634 commands: Gracefully handle empty commands.
Before this patch sway would proceed into find_handler which would cause
a crash trying to parse a NULL string.

This could be triggered via e.g. `i3-msg -s $(sway --get-socketpath)`.
2015-10-19 19:45:35 +02:00
Drew DeVault
83c23f274c Merge pull request #195 from sce/get_socketpath
main: Implement --get-socketpath switch.
2015-10-18 14:25:57 -04:00
S. Christoffer Eliesen
3be11a08e6 main: Implement --get-socketpath switch. 2015-10-18 19:53:56 +02:00
S. Christoffer Eliesen
71ebe8c36b commands: Catch empty exec with --no-startup-id cases. 2015-10-18 19:14:49 +02:00
S. Christoffer Eliesen
71bcee4f96 commands: Ignore exec switch "--no-startup-id".
When using an i3 config verbatim in sway this switch to exec or
exec_always might appear.

Before this patch the switch would be passed to /bin/sh, causing
an error, and the command would not be run.
2015-10-17 14:28:38 +02:00
S. Christoffer Eliesen
783290e81a sway/ipc: Use sway_abort instead of returning NULL. 2015-10-16 13:23:08 +02:00
S. Christoffer Eliesen
7cb0732030 sway/ipc: ipc_user_sockaddr: Use sway_assert instead of assert. 2015-10-16 13:07:50 +02:00
S. Christoffer Eliesen
382b4e425a sway/ipc: Fix whitespace. 2015-10-16 13:06:30 +02:00
S. Christoffer Eliesen
26beb66eb5 sway/ipc: Free ipc_sockaddr upon termination. 2015-10-16 12:16:18 +02:00
S. Christoffer Eliesen
f94f8fde7e sway/ipc: Support multiple users. 2015-10-16 12:16:16 +02:00
S. Christoffer Eliesen
ae93c6e6fe sway/ipc: Dynamically assign ipc_sockaddr. 2015-10-16 12:15:11 +02:00
taiyu
18f4905e62 #187, let init handle child processes 2015-10-08 08:12:31 -07:00
Drew DeVault
5bcecbb751 Revert "#187 cleanup zombies properly" 2015-10-08 06:24:35 -04:00
taiyu
5539fd89be #187 cleanup zombies properly using default 2015-10-07 16:18:57 -07:00
taiyu
c963aa7ced return after disconnect ipc client and minor checks 2015-09-29 07:19:10 -07:00
taiyu
4944996170 Merge branch 'master' of https://github.com/taiyu-len/sway
merge
2015-09-22 09:41:32 -07:00
taiyu
6c33f8122a #184 2015-09-22 09:41:01 -07:00
taiyu
72aaffcf5b fix config search paths 2015-09-20 10:56:22 -07:00
taiyu
9fd2d635a1 container_move check 2015-09-18 11:34:57 -07:00
taiyu
7672886cb5 dont log empty config lines 2015-09-18 08:33:28 -07:00
taiyu
0d51f62224 merge + no c_extensions 2015-09-18 07:23:04 -07:00
taiyu
d2e2b04bfd minor fix 2015-09-18 06:52:04 -07:00
Drew DeVault
318e1be240 Fix warnings introduced by prior commit 2015-09-18 07:27:35 -04:00
Drew DeVault
8e25ce4e57 Fix build for debian stretch
Fixes #182
2015-09-18 07:16:20 -04:00
taiyu
a04f645d7c style, safer fork 2015-09-15 06:56:51 -07:00
taiyu
a18caf6706 nomacro 2015-09-15 06:39:24 -07: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
2093d4ddee cmd_for_window dummy function 2015-09-12 02:45:03 -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
799ff640f8 remove old things 2015-09-08 10:28:53 -07:00
taiyu
aa22dc3113 var replacement changes 2015-09-08 10:27:09 -07:00
taiyu
fd6d06ff61 fix missing symbol bug 2015-09-08 09:52:33 -07:00
taiyu
da76ecb5f8 escape check fix 2015-09-08 09:10:36 -07:00
taiyu
d673a72705 set variable changes 2015-09-08 08:54:57 -07:00
Thomas Wouters
c3f76f8785 fix outut typo 2015-09-08 14:37:20 +02:00