Commit graph

217 commits

Author SHA1 Message Date
Daniel Eklöf
f4f44d88fe
modules/sway-xkb: never *update* state without locking it 2019-08-15 19:12:08 +02:00
Daniel Eklöf
9aefa8df14
modules/sway-xkb: pull in string.h, for strdup() and strcmp() 2019-08-14 22:06:46 +02:00
Daniel Eklöf
d576802e49
modules/sway-xkb: new module, uses sway 'input' events to expose kbd layout
We subscribe to Sway's 'input' events, and use these to expose input
devices' active XKB layout.

The module is configured by specifying a list of 'identifiers'; these
are the input devices (keyboards, typically), that we'll be
monitoring. All other input devices are ignored.

'content' is a template, and the module will instantiate a dynlist
with a 'content' for each *existing* input found in the 'identifiers'
list.

We also monitor for device 'added' and 'removed' events, and update
our internal list of existing inputs.

This means the user can configure a set of identifiers, and only those
that are actually present will be displayed. If a device that is
listed in the 'identifiers' list is added, it will be displayed. If it
is removed, it will no longer be displayed.
2019-08-14 21:51:43 +02:00
Daniel Eklöf
1534e00236
module/mpd: don't try to strdup() NULL strings 2019-07-08 15:06:24 +02:00
Daniel Eklöf
89538f96fa meson: modules: dictionaries can be added 2019-05-06 22:03:19 +02:00
Daniel Eklöf
08e21a4d3b meson: assign get_option('core-plugins-as-shared-libraries') to variable 2019-05-06 21:49:20 +02:00
Daniel Eklöf
121b2f1575 meson: enable_x11 -> backend_x11, enable_wayland -> backend_wayland 2019-05-06 21:45:01 +02:00
Daniel Eklöf
ea9aea8daf cmake: remove build files (replaced with meson) 2019-05-04 11:48:20 +02:00
Daniel Eklöf
27a47a96ed module/mpd: check return value of write()
Fixes building with -D_FORTIFY_SOURCE=2
2019-05-04 11:28:25 +02:00
Daniel Eklöf
789cdd949b meson: use join_paths() 2019-05-03 23:10:01 +02:00
Daniel Eklöf
e563761093 meson: install plugins 2019-05-01 22:08:15 +02:00
Daniel Eklöf
ded98baa4e meson: don't reference xcb_stuff in wayland-only builds 2019-05-01 20:27:17 +02:00
Daniel Eklöf
3995464d49 meson: modules: make it data-driven 2019-05-01 20:24:31 +02:00
Daniel Eklöf
fdb9a9bc1c meson: initial support for building plugins as shared libraries 2019-05-01 18:21:35 +02:00
Daniel Eklöf
51e9d691e4 meson: initial build conf
Not that well tested yet, does not support plugins-as-modules
2019-05-01 12:39:59 +02:00
Daniel Eklöf
7dc5694965 module/i3: use our own copy of i3/ipc.h
The main advantage is when targeting sway/wayland instead of i3/x11;
sway doesn't package ipc.h. There *is* an ipc.h in the sway sources,
but it doesn't define e.g the header format, and has different names
for the constants.
2019-03-31 12:08:44 +02:00
Daniel Eklöf
cd28099ad8 module/i3: don't try to strdup() a NULL pointer 2019-02-20 18:21:58 +01:00
Daniel Eklöf
b4845a55fe module/i3: remove even more IPC related json error messages 2019-02-17 21:53:01 +01:00
Daniel Eklöf
11eff5b13b module/i3: one more malformed IPC error message removed 2019-02-17 21:51:48 +01:00
Daniel Eklöf
fd955fa3ac module/i3: use json_object_object_get_ex()
json_object_object_get() is deprecated.

At the same time, simplify code by removing error messages; it's
not *our* problem if someone is sending malformed IPC replies.
2019-02-17 21:50:01 +01:00
Daniel Eklöf
546a4b5009 module/i3: improve window event handling
* Only care about 'close', 'focus' and 'title' events
* Remove application/title on 'close'
* Ignore 'title' events if it's not for the currently active
  window (from the last 'focus' event)

This fixes an issue where we rendered a 'title' event just like a
focus event. Meaning that a non-focused window, perhaps even on a
different workspace, that changed its title, would cause us to refresh
with its title being used.
2019-02-17 20:05:44 +01:00
Daniel Eklöf
f959d96c17 module/i3-common: add LOG_ENABLE_DBG define, but leave it disabled 2019-02-17 20:05:30 +01:00
Daniel Eklöf
620d89319b module/i3: reset current window info on a "floating" window event 2019-02-17 12:32:27 +01:00
Daniel Eklöf
272a1bd2ed cmake: link i3-common against json and xcb-stuff 2019-02-15 22:48:01 +01:00
Daniel Eklöf
db211de70c modules/i3-common: add support for sway's IPC_GET_INPUTS 2019-02-15 22:30:12 +01:00
Daniel Eklöf
06ae704ded module/i3-commonh: I3_IPC_REPLY_TYPE_SYNC is relatively new
And is for example not present in our CI.
2019-02-15 22:06:24 +01:00
Daniel Eklöf
e40b50bf5e module/i3-common: add missing include
Needed for e.g strncpy() and strcmp()
2019-02-15 22:06:03 +01:00
Daniel Eklöf
ae7f554b8c module/i3: only call bar->refresh() from burst_done() callback
IPC reply and event handlers no longer call bar->refresh()
directly. Instead, they set a 'dirty' bit. Then, in burst_done(), we
call bar->refresh() when the dirty bit has been set.
2019-02-15 22:01:58 +01:00
Daniel Eklöf
f9044ec883 module/i3: add a 'burst_done()' callback
This callback is called after all received packets have been
processed, before going into a blocking poll() again.
2019-02-15 22:01:07 +01:00
Daniel Eklöf
5e97c77c24 module/i3: remove unneeded includes 2019-02-15 20:58:43 +01:00
Daniel Eklöf
e36ba56caf module/i3-common: being disconnected is usually not an error 2019-02-15 20:57:31 +01:00
Daniel Eklöf
fce37e86e4 module/i3: break out I3 IPC receive loop 2019-02-15 18:58:21 +01:00
Daniel Eklöf
6df68f1c23 module/i3-common: const:ify 2019-02-13 22:00:42 +01:00
Daniel Eklöf
92319714c7 module/i3: break out send_pkg() 2019-02-13 22:00:13 +01:00
Daniel Eklöf
76dc4f82cd module/i3-common: always disconnect from XCB on error 2019-02-13 21:58:20 +01:00
Daniel Eklöf
37d15096f9 module/i3: break out get_socket_address() 2019-02-13 21:55:03 +01:00
Daniel Eklöf
6e44d8e04e module/i3: fix crash when there is no "current" workspace template 2019-02-13 21:46:30 +01:00
Daniel Eklöf
97ff63044f module/i3: cleanup 2019-02-10 12:29:33 +01:00
Daniel Eklöf
d631e47a5e module/i3: detect 'current' workspace while iterating workspaces 2019-02-10 12:29:33 +01:00
Daniel Eklöf
330ad48dfd module/i3: handle 'label' like an extra workspace called 'current' 2019-02-10 12:29:33 +01:00
Daniel Eklöf
a3be2839e5 module/i3: avoid calling json_object_get_int() multiple times 2019-02-10 12:29:33 +01:00
Daniel Eklöf
83db675e01 module/i3: subscribe *before* requesting initial workspace list
This ensures we don't have a race, where we might miss workspace
changes between the initial list and subscribing.
2019-02-10 12:29:33 +01:00
Daniel Eklöf
be4765fadd module/i3: 'dynlist' -> 'workspaces' 2019-02-10 12:29:33 +01:00
Daniel Eklöf
4100922b7a module/i3: allow 'content' to also contain a regular 'label'
Previously, the 'content' of i3 was a map, where the keys where i3
workspace names, mapping to a particle template.

Now, that configuration type is still allowed. But we also allow a
variant where the 'content' is a list, of either 1 or 2 entries.

Both entries *must* be dictionaries. The key is either 'dynlist',
which is the same as the dictionary-only type of
configuration. I.e. it maps to a dictionary where the keys are
workspace names, mapping to particle templates.

If the key is *not* dynlist, then it is assumed to be a particle name,
and we treat that as a "regular" label, that will be appended after
the workspace dynlist when instantiating the content.

This particle will be instantiated with, for now, the title and
application of the _currently focused_ workspace.
2019-02-10 12:29:33 +01:00
Daniel Eklöf
d565fbe2f0 module/i3: track active window title and application name
This is done on a per-workspace basis.

Note that the initial state is currently not detected. I.e. we
retrieve the initial workspace list, but we don't get the currently
focused window.
2019-02-10 12:29:33 +01:00
Daniel Eklöf
5ed6e0acbc module/i3: look for I3SOCK env variable before reading X properties 2019-02-10 12:29:33 +01:00
Daniel Eklöf
b6e61f9c7e modules: use calloc() instead of malloc()
In cases where it makes sense, use calloc() instead of malloc():

* When allocating large objects with many members, many for which
  NULL/0 is a good default value.
* Arrays etc where we explicitly initialize to NULL anyway.
2019-02-09 11:11:31 +01:00
Daniel Eklöf
7ff0f5a2f3 cmake: need CMake >= 3.13 since we use target_link_options() 2019-02-07 12:26:05 +01:00
Daniel Eklöf
ae5029826b cmake: break out bar stuff to separate CMakeLists.txt 2019-02-07 12:06:16 +01:00
Daniel Eklöf
a831490462 modules: fix strncpy calls to ensure strings are NULL-terminated 2019-02-06 18:10:06 +01:00