haideralipunjabi / polybar-kdeconnect

KDEConnect module for Polybar
https://blog.haideralipunjabi.com/posts/making-modules-for-polybar-shell-python/
163 stars 11 forks source link

Unclosed action blocks #18

Closed GideonWolfe closed 4 years ago

GideonWolfe commented 4 years ago

When this module is enabled, i get the following output:

error: Failed to parse contents (reason: 1 unclosed action block(s))
error: Failed to parse contents (reason: 2 unclosed action block(s))
error: Failed to parse contents (reason: 3 unclosed action block(s))
error: Failed to parse contents (reason: 4 unclosed action block(s))
error: Failed to parse contents (reason: 5 unclosed action block(s))
error: Failed to parse contents (reason: 6 unclosed action block(s))
error: Failed to parse contents (reason: 7 unclosed action block(s))
error: Failed to parse contents (reason: 8 unclosed action block(s))
error: Failed to parse contents (reason: 9 unclosed action block(s))
error: Failed to parse contents (reason: 10 unclosed action block(s))
error: Failed to parse contents (reason: 11 unclosed action block(s))
error: Failed to parse contents (reason: 12 unclosed action block(s))
error: Failed to parse contents (reason: 13 unclosed action block(s))
error: Failed to parse contents (reason: 14 unclosed action block(s))

and so on.

GideonWolfe commented 4 years ago

It seems like the following lines were causing it:

COLOR_DISCONNECTED=$(xrdb -query | grep "*color2" | cut -f 2)       # Device Disconnected
COLOR_NEWDEVICE=$(xrdb -query | grep "*color6" | cut -f 2)          # New Device
COLOR_BATTERY_90=$(xrdb -query | grep "*color2" | cut -f 2)         # Battery >= 90
COLOR_BATTERY_80=$(xrdb -query | grep "*color4" | cut -f 2)         # Battery >= 80
COLOR_BATTERY_70=$(xrdb -query | grep "*color3" | cut -f 2)         # Battery >= 70
COLOR_BATTERY_60=$(xrdb -query | grep "*color10" | cut -f 2)         # Battery >= 60
COLOR_BATTERY_50=$(xrdb -query | grep "*color1" | cut -f 2)         # Battery >= 50
COLOR_BATTERY_LOW=$(xrdb -query | grep "*color9" | cut -f 2)        # Battery <  50

How can I make this work?

GideonWolfe commented 4 years ago

It seems like some of those lines were returning more than one color, so it was really messing up the output. Fixing the command to include a colon makes it return one color every time.

COLOR_BATTERY_LOW=$(xrdb -query | grep "*color9:" | cut -f 2) # Battery < 50