eww icon indicating copy to clipboard operation
eww copied to clipboard

[FEATURE] Add systray class when it is empty

Open jlo62 opened this issue 1 year ago • 3 comments

Description of the requested feature

This would allow to completely hide the systray (via css) if it is empty.

I have not been able to do this otherwise, also not via reveal.

Proposed configuration syntax

.systray_empty {padding: 0}

Additional context

No response

jlo62 avatar May 02 '24 06:05 jlo62

I think that instead of the class it is worth adding the visible-empty property, I wanted to do this but could not install the dependencies с:

error: could not compile `winnow` (lib) due to 3149 previous errors

vnva avatar May 05 '24 08:05 vnva

~~I implemented it in this PR~~

vnva avatar May 05 '24 15:05 vnva

#!/bin/bash

count=0

dbus-monitor --session "interface='org.kde.StatusNotifierWatcher'" |
while read -r signal; do
    if [[ $signal == *"StatusNotifierItemRegistered"* ]]; then
      count=$(($count + 1))
    elif [[ $signal == *"StatusNotifierItemUnregistered"* ]] then
      count=$(($count - 1))
    fi

    echo $count
done
(deflisten systray-items-count :initial 0 "path-to-script")
(systray :visible "${systray-items-count > 0}")

vnva avatar May 05 '24 20:05 vnva