On i3, users are currently greeted with:
err: modules/i3.c:94: workspace reply/event without 'name' and/or
'output', and/or 'focus' properties
This patch makes ‘focus’ an optional attribute. When missing, we
assume a node-count of 0, which means the workspace’s ‘empty’ tag will
always be true. Document this in the i3 man page.
This is a boolean option. When set, “N:” prefixes will be stripped
from the workspaces’ name tag, *after* having been sorted (if the
‘sort’ option is being used).
This makes it useful to arrange the workspaces in a fixed order, by
prefixing the names with a number in the Sway config:
set $ws1 “1:xyz”
set $ws2 “2:abc”
Then, in the yambar config:
i3:
sort: ascending
strip-workspace-numbers: true
Set to true for empty (no windows) workspaces.
Mostly useful with persistent workspaces, to be able to differentiate
between invisible non-empty workspaces and actually empty
workspaces (the latter not being possible with non-persistent
workspaces).
Add ‘persistent’, a list-of-strings specifying workspace names that
should be persistent. That is, workspaces that should never be
removed, even if empty.
Note that the workspaces _are_ still destroyed (in i3/Sway), but
yambar keeps abstractions for them around. This is useful to e.g. keep
a strict order between your “core” workspaces.
Closes#72
When sorting workspaces in ascending order, put numerical
workspaces *after* non-numerical ones.
When sorting in descending order, put numerical workspaces *before*
non-numerical.
In both cases, sort numerical workspaces using a numerical comparison,
rather that doing a lexicographical sorting.
Closes#30
Don't fail (and terminate the i3 plugin) if we receive a window event
where the 'container' doesn't have a 'pid' property.
This means we won't be able to determine the application the window
belongs to.
Closes#2
We previously used the 'pid' property of the 'container' object in a
window event to lookup the application name under /proc/<pid>/comm.
In many cases, the application name is already available in the window
event itself, in the 'app_id' property.
Use this, if available, and fallback to the old PID method otherwise.
A quick experiment suggests 'app_id' is set for all Wayland native
applications, but not for X11 applications running under XWayland.
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.
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.
* 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.
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.
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.
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.
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.
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.