Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

Sound Applets for Notion

16 Jun 2013

Notion comes with a nice status bar where you can have text be displayed as well as system trays with applets. This post describes picking a good sound applet.

Then I'll explain choosing a solid system tray and a suitable Notion configuration which makes it all work together nicely.

1 Choosing a Sound Applet

Notion conveniently lets you insert text in the status bar and it was very tempting at first to display the sound volume this way. This would however have meant periodically running a command to collect its value, which I found a mite off-putting. So I chose to use an applet instead. I've considered several of them:

Opting for an applet which lets you choose an icon theme is no luxury and is a case of making the icons readable depending on the colour of your status bar. For instance, Breathe is a good choice for dark status bars. Edit the ~/.gtkrc-2.0 file:

include '/home/you/.gtkrc.mine'

And edit the ~/.gtkrc.mine one:

gtk-icon-theme-name = "Breathe"

2 Choosing a System Tray

Without trying alternatives to it, I quickly settled on stalonetray without further ado, as it just does the business. A possible configuration can be set up in ~/.stalonetrayrc:

background "#333333"
icon_size 16
slot_size 16

Note that these sizes will make the status bar slightly larger than it should be, but 16 px is the minimum. This results to a 20-pixel status bar. While it would have been tempting to use a transparent background to naturally blend into the Notion status bar, this option doesn't quite cut the mustard. If your status bar has a homogeneous colour, you might as well just explicitly set the stalonetray background colour to it.

3 Configuring Notion to Glue It All Together

Winprops have to be defined for the status bar to swallow the system tray. The ArchWiki page on stalonetray suggests to use the following winprops for Ion and it works well for Notion too:

mod_statusbar.create{
    screen=0,
    pos='bl',
    fullsize=true,
    systray=true,
    template="[ %date || %load || ... ] %systray%filler%systray_stalone",
}

defwinprop{class="stalonetray",instance="stalonetray",statusbar="systray_stalone"}
defwinprop{instance="stalonetray",statusbar="systray_stalone"}
defwinprop{class="stalonetray",statusbar="systray_stalone"}

See how it seems that you have to set a winprop for the class alone, for the instance alone, and for both. Another, alternative suggestion I've read from the stalonetray documentation is to define the winprops for Ion as follows instead:

defwinprop{class="stalonetray",instance="stalonetray",target="*dock*"}
defwinprop{instance="stalonetray",target="*dock*"}
defwinprop{class="stalonetray",target="*dock*"}
defwinprop{is_dockapp=true,target="*dock*"}

You might be wondering whether it's best to start stalonetray and applets after Notion has completely started up to ensure they pick up the correct sizes and show up properly. While it doesn't appear to matter too much in practice for most other applets such as the NetworkManager one, Volume Icon seems to be more sensitive to this and you might be better off starting it up from within Notion. Try for instance the very end of cfg_notion.lua. If you choose to do so, you'll want to ask yourself the question of what happens when you restart Notion, whether it will cause the applet to be spawned again.

4 References