Commit graph

16 commits

Author SHA1 Message Date
Jordan Isaacs
6113f9b94e
particles/icon: init
Introduce a new icon particle. It follows the icon
spec (https://specifications.freedesktop.org/icon-theme-spec/latest/index.html).
Rendering logic is taken from fuzzel (using nanosvg + libpng), while loading
logic is taken from sway. Standard usage is with `use-tag = false` which expands
the provided string template and then loads the string as the icon name. There
are settings to manually override the base paths, themes, etc. The second usage
which is required for tray support is a special icon tag that transfers raw
pixmaps. With `use-tag = true` it first expands the string, and then uses that
output to find an icon pixmap tag. To reduce memory usage, themes are reference
counted so they can be passed down the configuration stack without having to
load them in multiple times.

For programmability, a fallback particle can be specified if no icon/tag is
found `fallback: ...`. And the new icon pixmap tag can be existence checked in
map conditions using `+{tag_name}`.

Future work to be done in follow up diffs:
1. Icon caching. Currently performs an icon lookup on each instantiation & a
   render on each refresh.
2. Theme caching. Changing theme directories results in a new "theme collection"
   being created resulting in the possibility of duplicated theme loading.
2024-07-23 22:58:23 -07:00
Delgan
b85ba99980 Apply "clang-format" preferences globally 2024-04-07 10:05:10 +02:00
Leonardo Gibrowski Faé
2b103b7acd Implement conditions on tag
A condition is formed by:
    <tag> <op> <value>

<tag> is the normal yambar tag. <op> is one of '==', '!=', '<', '<=', '>', or
'>='. <value> is what you wish to compare it to.

'boolean' tags must be used directly. They falsehood is matched with '~':

    <tag>
    ~<tag>

Finally, to match an empty string, one must use ' "" ':
    <tag> <op> ""
2022-04-23 17:13:24 -03:00
Daniel Eklöf
c79ffbe057
Add support binding on-click handlers to other buttons than LEFT
One can now bind the left/middle/right mouse buttons to on-click. In
fact, you can have all three buttons bound to different handlers for
the same particle. The new syntax is

    on-click:
        left: <command>
        middle: <command>
        right: <command>

Leaving one out is the same thing as not mapping it at
all. Furthermore,

    on-click: <command>

is still valid, and is a shorthand for

    on-click:
        left: <commsnd>
2021-07-01 17:15:53 +02:00
Daniel Eklöf
1cce649f06 Reduce header intra-dependencies 2019-01-13 19:42:16 +01:00
Daniel Eklöf
ab67d036ae tags: break out string formatting from particle/string 2018-12-29 17:03:41 +01:00
Daniel Eklöf
b0f0a1e942 tag: add realtime unit MSECS (milliseconds) 2018-12-28 14:05:02 +01:00
Daniel Eklöf
13cc11e200 tag: refresh_in() *must* use the realtime unit 2018-12-28 14:04:35 +01:00
Daniel Eklöf
20b3299afd tag: add a refresh_in() interface function
E.g. particles may use this to force a refresh after a certain amount
of time.

Note that it can only be used with 'realtime' tags.
2018-12-28 12:43:02 +01:00
Daniel Eklöf
904f9ff8e1 tag: all tag constructors must now be passed a module 'owner' 2018-12-28 12:40:41 +01:00
Daniel Eklöf
025c6991a3 tag: add a new variant of int tags, with a realtime unit property
The idea is, consumers of a tag, can check the realtime property, and
if set to something other than TAG_REALTIME_NONE, schedule a realtime
update.

For example, it could be used to track song progress.
2018-12-27 11:43:27 +01:00
Daniel Eklöf
2218bd1583 tag: allow integer tags to have a minimum and maximum value 2018-12-16 15:58:40 +01:00
Daniel Eklöf
1712362da9 tag: add as_int(), as_bool() and as_float() 2018-11-18 11:11:50 +01:00
Daniel Eklöf
44a2dbb201 tag: rename tag.value() -> tag.as_string() 2018-11-18 11:02:21 +01:00
Daniel Eklöf
12e9304612 tag: add a boolean tag 2018-11-18 11:00:01 +01:00
Daniel Eklöf
8bf8a398b9 initial commit: wip 2018-11-17 11:30:33 +01:00