Commit graph

47 commits

Author SHA1 Message Date
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
5e97c77c24 module/i3: remove unneeded includes 2019-02-15 20:58:43 +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
92319714c7 module/i3: break out send_pkg() 2019-02-13 22:00:13 +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
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
Daniel Eklöf
dbce871d27 module/i3: dynamically grow receive buffer when needed 2019-02-06 16:30:46 +01:00
Daniel Eklöf
70499654a3 module/i3: delay bar refresh until all received events have been processed
This fixes an issue where switching between empty workspaces (or one
empty, one non-empty) momentarily flashed two workspaces.

I.e. we immediately rendered the new workspace, and then re-rendered
when the first workspace was destroyed.
2019-02-06 15:39:11 +01:00
Daniel Eklöf
727d7b343f cmake: initial support for building wayland-only, or x11-only 2019-02-03 20:05:44 +01:00
Daniel Eklöf
8e769b491a module/i3: try SWAYSOCK before falling back to I3_SOCKET_PATH 2019-02-03 12:20:59 +01:00
Daniel Eklöf
452c4b6015 plugins: export a const function pointer interface struct 2019-01-26 18:32:04 +01:00
Daniel Eklöf
18ba3723d4 module/i3: avoid stack-allocating large buffers
This fixes a stack-overflow issue with musl (which uses small stacks).
2019-01-26 13:19:02 +01:00
Daniel Eklöf
dff3104c85 misc: make use of the xcb-aux library 2019-01-19 18:47:34 +01:00
Daniel Eklöf
9d5bbe0566 misc: xcb_connect() always returns a non-NULL pointer
Instead, we need to check if xcb_connection_has_error() says something
went wrong. We also need to call xcb_disconnect() on the disfunctional
XCB connection object.
2019-01-19 18:45:15 +01:00
Daniel Eklöf
85d1971ac3 module/i3: read socket path from root window's I3_SOCKET_PATH property
This way, we don't have to execute another process just to get the
path.
2019-01-16 17:22:13 +01:00
Daniel Eklöf
0d591fe5a1 allow plugins to be compiled into the f00bar main binary 2019-01-14 20:57:03 +01:00
Daniel Eklöf
4a26664d8d particles: remove config-verify.h from particle.h 2019-01-13 17:41:39 +01:00
Daniel Eklöf
bc62843c91 modules: get rid of struct module_info
Since this struct only contained function pointers, make all modules
export those functions directly.

The plugin manager now defines a module interface struct, and fills it
it by dlsym:ing the functions that used to be in module_info.
2019-01-13 17:09:11 +01:00
Daniel Eklöf
76d135e257 module: remove module_run_context
Store abort_fd directly in the module struct instead. This then allows
us to pass the module pointer as-is to the modules' run functions.
2019-01-13 15:34:59 +01:00
Daniel Eklöf
acdeff3b6e module: remove ready_fd
All modules are expected to handle a call to content() after having
been instantiated.

I.e. modules *cannot* even expect run() to have started running.
2019-01-13 15:25:39 +01:00
Daniel Eklöf
a425378576 config: allow font/foreground attributes on modules too
Previously we allowed it on the bar, and on all particles. Now we also
allow it on all modules.

This allows us to specify a "default" font/foreground on a per-module
basis, having it applied to all the modules particles.
2019-01-13 14:24:44 +01:00
Daniel Eklöf
8dc278aaf2 config: pass a struct with inheritable values
For now, font and foreground color
2019-01-13 14:13:14 +01:00
Daniel Eklöf
9944a8f972 modules: don't assume module content is a dictionary
This is done by having each module implement a top-level verifier
function.
2019-01-13 11:54:57 +01:00
Daniel Eklöf
71515e4079 config: conf_verify_dict() now assumes attr list is NULL-terminated 2019-01-13 11:37:05 +01:00
Daniel Eklöf
ec4a47e5db modules: rename module_info -> plugin_info
This is the same name used by particles.
2019-01-13 11:18:32 +01:00
Daniel Eklöf
42104db1ca modules: move files back to a common directory (again) 2019-01-12 21:24:20 +01:00
Daniel Eklöf
8809cbb481 Put each module in its own subdirectory 2019-01-12 11:19:57 +01:00
Daniel Eklöf
7b2dfd1399 module/i3: implement 'urgent' event handling 2019-01-11 20:05:38 +01:00
Daniel Eklöf
b9b90d8b9e module/i3: 'reload' events don't have a 'current' element 2019-01-11 20:01:36 +01:00
Daniel Eklöf
128716c8aa module/i3: if there's no specific workspace template, try a default one
If the user hasn't specified a specific template for a workspace, try
to lookup a default one (the empty string).

This allows the user to configure a "fallback" template to be used for
"extra", or not-often-used workspaces.
2019-01-09 18:50:26 +01:00
Daniel Eklöf
af13df3045 module/i3: trigger a bar refresh after a workspace event 2019-01-07 18:31:55 +01:00
Daniel Eklöf
072a508291 module/i3: add more debug logging 2019-01-07 18:31:47 +01:00
Daniel Eklöf
552739fa20 module/i3: fix gcc warning
Gcc (correctly) figured out that we may end up truncating the socket
path. In practice, it's something that should never happen.

Never the less, silence the warning by writing the socket path
directly into the sockaddr_un object.
2019-01-07 18:30:30 +01:00
Daniel Eklöf
45e5f11fea modules: remove "connected to " prefix from info logs 2019-01-02 18:14:49 +01:00
Daniel Eklöf
b7e7ad522f remove module subfolders 2018-12-29 22:18:08 +01:00
Renamed from modules/i3/i3.c (Browse further)