Sound Applets for Notion
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:
gnome-sound-volume
, which seems to disregard icon themes and chooses a colour that may be unreadable on a dark status bar. I've tried to change the icon names in the source code to no avail.veromix
, which you can't seem to be able to use without having a main application window be displayed too. It's easily patched, however, with something along the lines of:But the applet isn't particularly reliable anyway. Sometimes it shows up, sometimes it doesn't. It might have to do with how I start it, mind you.--- veromix.orig/gtk/main.py 2012-06-14 08:32:37.000000000 +0200 +++ veromix/gtk/main.py 2013-06-15 15:22:30.725587597 +0200 @@ -21,6 +21,7 @@ import os, gettext, dbus, dbus.service from gi.repository import Gtk, Gdk from gettext import gettext as i18n +import argparse from Veromix import Veromix from Indicator import Indicator @@ -36,7 +37,7 @@ class VeromixWindow(dbus.service.Object): - def __init__(self, bus): + def __init__(self, bus, nowin): dbus.service.Object.__init__ (self, bus, "/", DBUS_INTERFACE) self.window = Gtk.Window(title=i18n("Veromix"),type =Gtk.WindowType.TOPLEVEL) @@ -47,7 +48,8 @@ veromix = Veromix(self.window, bus) self.window.add(veromix) self.create_indicator(veromix) - self.window.show_all() + if not nowin: + self.window.show_all() @dbus.service.method (DBUS_INTERFACE, in_signature='', out_signature='') def show_window(self): @@ -71,6 +73,10 @@ gettext.textdomain(name) if __name__ == '__main__': + p = argparse.ArgumentParser() + p.add_argument('--nowin', action='store_true', help="Don't show window") + args = p.parse_args() + # Veromix is dedicated to my girlfriend Véronique init_locales() Gdk.set_program_class("veromix") @@ -88,7 +94,8 @@ else: createDbusServiceDescription(VEROMIX_BASEDIR + VEROMIX_SERVICE, False) LADSPAPresetLoader().install_ladspa_presets_if_needed() - win = VeromixWindow(bus) - win.show_window() + win = VeromixWindow(bus, args.nowin) + if not args.nowin: + win.show_window() Gtk.main() config().save()
volumeicon
, which supports icon themes and which I got to work reliably without effort.volti
, which crashes the moment I run it, complaining it can't open a control for my card. I didn't insist.
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.