sway tray status - Swaybar Tool

Posted on
software wayland software engineering compositor sway

A while ago I was testing sway as a wayland compositor. The goal was to make the switch to wayland for my daily work. Unfortunately, this didn’t quite work out. I have the feeling, that wayland isn’t quite there yet. A lot of things work, but it still feels cumbersome at times.

Anyway, while testing sway, I noticed that the tray wasn’t working. When looking for the reason I stumbled upon the planned swaybar tray features. A bit disheartened I thought about what are the essential things I need. The most important things for me are battery information and the current date and time.

Both things are not the hardest things to accomplish. As a result I played around and wrote a little tool in Rust to display exactly this information. The result can be found in the Github Repository. Maybe it is useful for someone else. In action it looks like this:

Swaybar tray status

It can be easily configured in the sway config file (~/.config/sway/config):

#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
    position bottom
    #status_command while date +'%d %m %Y %H:%M:%S'; do sleep 1; done
    status_command /usr/bin/sway_tray_status BAT0 BAT1
    colors {
        statusline #ffffff
        background #323232
        inactive_workspace #32323200 #32323200 #5c5c5c
    }
}

I also noticed a very promising pull request from ianyfan which enhances the sway experience and makes it possible for sway to become the driver for my daily work.