Cinnamon 2.4.5 & Ubuntu 14.04: stop it from crashing & battery notification fixes (xmobar, cronjob, notify-send), fix pidgin

Cinnamon is a “desktop manager” that is visually similar to Gnome 2 while incorporating new features from Gnome 3. It does not have an official Ubuntu package.

key features

these are the reasons why I don’t use whatever came with Ubuntu 14.04 and sink time into my own setup

  • Edge Tiling and Snapping: I can drag a window to the sides tile it, or use Win-[arrowkeys]
  • Workspaces and hot corners: Allow me to add more workspaces, title them. Using cinnamon-settings, I put my hotcorner in the bottom right
  • Switching windows: If I have a lot open, “Expo view” lets me see open windows quickly (ctrl-alt-down)
  • Built-in panel applications: Supports the normal stuff (tomboy notes, pidgin, volume, notifications) as well as custom applications (pomodoro timer, timer). Cinnamon panel has its own “app store”-like interface (I don’t show it here) where you can add other people’s applications painlessly
  • Top panel (cinnamon panel): Shows me which windows are open in my current workspace
  • Big frequently-used icons: Using docky, I put my most frequently used applications to the left side and can easily see how many instances of each application I have open across all my workspaces
  • Search across applications: Similar to Windows 7, I can type in a keyword and Cinnamon Start Menu will pull up the appropriate program, so I don’t have to hunt for the command-line name for infrequently used programs

stop crashing

A few days ago, I accidentally updated my cinnamon install. I thereby spent the next half-day hating myself.

I had been using the nightly package from Gwendal Le Bihan. Upon closer inspection, that repo was discontinued. I tried to follow to upgrade my Cinnamon to a newer version, but cinnamon still flat-out refused to start (“Cinnamon crashed, would you like to restart Cinnamon?”).

Eventually, I installed Gnome 3 in a fit of trying out desktop environments that would be “good enough.”

$ sudo apt-get install gnome-session

When I rebooted, I no longer had any gnome options to select from, although the “user login” screen had definitely turned into some gnome 3 thing. But I could select cinnamon and it no longer crashed!

what. -___- Oh, the woes of linux customizations.


Upgrading did fix things. I no longer get lots of “Ubuntu detected an error in your system” pop-ups when I reboot. Tomboy appears in the panel again (yay!! I really like Tomboy). There is a “hotcorners” GUI editor now. Oh, and I have pidgin tray icon, except I have manually toggle it on and off for it show up instead of a blank space 🙁 (see

EDIT: I fixed pidgin system tray notifications! Cinnamon > Panel Settings > Check “Use customized panel size”  & “Allow scale icons”. My top panel is set at the default font size.

If that doesn’t work for you, try this: I can confirm that editing the icons in “/usr/share/pixmaps/pidgin/tray/hicolor/16×16/status” changes the icons in cinnamon’s status bar.

Sadly, restarting is still slower than it should be, and feels even slower now. I swear when I first installed the SSD my boot-time was at least 5 seconds faster, which may not sound like much, but makes rebooting feel a lot less painful (for instance, when switching between Windows and Ubuntu, because **** xbees and their windows-only gargantun XCTU, that’s why)

My wifi will suddenly die for no reason, and I have to

$ sudo restart network-manager

Cinnamon itself will freeze sometimes, I haven’t figured out why. Then I have to Ctrl-Alt-F1, log-in, and run

$ sudo killall Xorg

My suspend still doesn’t work, so I just shut-down the computer (the fan is loud and I have perhaps forty minutes of battery life).

Shutting down takes on the order of a minute :/ I want to leave already. Also, my zombie computer’s fan keeps going & hard-drive monitor LED keeps going for several seconds after my screen blanks out on shutdown… :/

Worst of all, power management no longer worked. Not only did the battery indicator not update, my laptop would just instantly die with no warning when it ran out of battery.

This is because Cinnamon switched how it checked battery status:

This looked promising, but I could not get anything to show up in my Cinnamon panel bar:

version info

$ cinnamon --version
Cinnamon 2.4.5
$ lsb_release -a
Ubuntu 14.04.1 LTS
$ gnome-session --version
$ docky
Docky version: 2.2.0 Release

create battery status indicator

This was straight-forward-ish. I used another program entirely,  xmobar.

$ sudo apt-get install xmobar

Cinnamon does not respect keeping xmobar on top (windows will cover xmobar), so I just stuck it behind my semi-transparent Docky (Theme: HUD), since Cinnamon never tries to cover up docky. Hence, the “fixed-width bottom left” position. I increased the font-size (to 20).

full battery
full battery. 100% = percent remaining, f = fully charged

Then there’s a mess of battery commands — basically, defining the colors when high, normal, or low battery, defining the thresholds (% remaining) for high, normal, or low battery, and then defining the “acstatus” (charging/discharging status) characters — I chose “-!” to indicate discharging, “f” to indicate full battery, and “+” to indicate charging (xmobar does not support fancy unicode arrows by default).

The template goes “battery percent left” and then “acstatus”.

$ cat ~/.xmobarrc 
Config { font = "-*-Fixed-Bold-R-Normal-*-20-*-*-*-*-*-*-*"
, position = BottomW L 3
, bgColor = "black"
, fgColor = "#f3f3f3"
, commands = [ 
 Run Battery ["-t", "<left><acstatus>"
 , "-L","49","-H","75","--high","green","--normal","yellow","--low","red"
 , "--", "-o", "-!", "-O", "+", "-i", "f"
 , "-f", "ADP1/online" ] 20
, sepChar = "%"
, alignSep = "}{"
, template = "%battery% "

The last “template” line just adds a “space” after the battery template is rendered.

Oh, about the -f option, that’s another possibly ubuntu-specific or laptop specific thing…

Q: In the git version of src/Plugins/Monitors/Batt.hs , in the haveAc function, we try to find out whether the computer is on AC power by checking “/sys/class/power_supply/AC/online” . On some computers this is instead located in “/sys/class/power_supply/ADP1/online”.

A: i’ve added a new config argument (-f) to specify the online file.

While you’re setting this up, you can use

upower -d

to check your battery state manually.

Finally, add xmobar to startup: Ubuntu comes with “startup application preferences” GUI. Click “Add” and put in command “xmobar”. Done!

create low battery warning

example notify-send notification
example notify-send notification

Thanks to Essentially, I use notify-send to pop-up a low-battery notification using a shell script that I run every 5 minutes using a cron job.

It turns out cron hates notify-send so this ate up way too much time.

(I think crontab -e does persist across reboots by default, fortunately). I followed several guides, I’m not sure what exactly fixed it in the end, but here is my full setup for running the checker every 5 minutes:

$ crontab -e

*/5 * * * * sh /home/nrw/.notify-send_setup
*/5 * * * * sh /home/nrw/.battnotif

$ cat .notify-send_setup

touch $HOME/.dbus/Xdbus
chmod 600 $HOME/.dbus/Xdbus
env | grep DBUS_SESSION_BUS_ADDRESS > $HOME/.dbus/Xdbus
echo 'export DBUS_SESSION_BUS_ADDRESS' >> $HOME/.dbus/Xdbus

exit 0

$ cat .battnotif

export DISPLAY=:0

if [ -r "$HOME/.dbus/Xdbus" ]; then
    . "$HOME/.dbus/Xdbus"

battery_level=`acpi -b | grep -P -o '[0-9]+(?=%)'`

# I tried to only notify when not charging, but could not get it to work
# STATUS=$(cat /sys/class/power_supply/ADP1/online)
# if [ $battery_level -le 15 ] && [ $STATUS == "0" ]

if [ $battery_level -le 15 ]
    /usr/bin/notify-send -u critical "Battery low" "Battery level is ${battery_level}%!"
    echo 'batt low' >> /home/nrw/cron.log

echo 'ran batt' >> /home/nrw/cron.log

Make sure to chmod +x the bash scripts.