XFCE in Debian does not notify the user of available updates. In this post I'm going to show two methods of getting update notifications. Before using either of these methods, it's necessary to configure Debian's package manager APT to check for available updates, as described in my previous post.
It's also necessary to install aptitude, which is a text-based terminal front end for APT.
Method 1: using Conky
Conky is a system monitor which can be used to output the result of a terminal command to the desktop. Here, it is writing the output of the following command to the desktop:aptitude search "~U" | wc -l
Which tells aptitude to search APT for updatable packages, count and list them. (Found on the bunsenlabs forum.)
The line in my Conky config file is:
${color grey}Available updates:$color ${execi 3600 aptitude search "~U" | wc -l}
Which tells Conky to execute the command every hour. Add Conky to Application Autostart in XFCE. The command conky -d -p 12 runs Conky as a daemon with a 12 second delay - Conky can get buried if a non-system wallpaper is applied after the desktop starts.
The full Conky script is at the bottom of the post for reference.
Method 2: using Genom in the XFCE panel
The disadvantage of the first method is that many people don't see their desktop very often. With the second method, the notification is in the panel, so it's easy to notice.
Genmon is an XFCE plugin that monitors terminal commands and outputs the result to the XFCE panel. So in this case, Genmon is monitoring the output of the same command we used in Conky but showing the result in the panel, alongside an icon which only appears when updates are available.
Genmon can also use the XFCE tooltip to display a list of available updates from the output of this command:
aptitude -F%p search '~U'
Which returns the names of updatable packages.
The panel icon is also clickable and can be configured to update the system.
Credit for the Genmon script goes to alkusin.net, where an XFCE update script is mentioned, although I had to use waybackmachine to find it.
I modified the script to work with Debian, and added the <iconclick> command, which was added to Genmon recently and allows the script to use system icons. Most icon themes have a software update icon in the Status folder somewhere, although the name may vary.
Here is the Genmon script:
#!/bin/bash
updates=$(aptitude search '~U' | wc -l)
details=$(aptitude -F%p search '~U')
PANEL="<icon>software-update-available</icon>"
PANEL+="<iconclick>./update-script.sh</iconclick>"
PANEL+="<txt><span size='6000' rise='8000'>$updates</span></txt>"
TOOLTIP="<tool>"
TOOLTIP+="<span weight='bold'>Available updates: $updates</span>\n"
TOOLTIP+="$details\n"
TOOLTIP+="<span weight='bold'>Click icon to update</span>"
TOOLTIP+="</tool>"
if [ $updates -gt 0 ]; then
echo -e "${PANEL}"
echo -e "${TOOLTIP}"
else
echo ""
fi
The script has to be saved as a text file with the .sh suffix and made executable (Properties > Permissions in Thunar). Then enter the path to the script in Genmon properties:
Command: /path/to/your/genmon-script.sh
Label: unticked
Period (s): update interval in seconds - eg 3600 (1 hour)
I have put the <iconclick> actions in a separate script, so I could get the terminal to update the system and refresh Genmon so the icon disappears after updating - I don't think it's possible for an XML <click> command to do this.
So, if you want to update with a click, put something similar in an .sh executable file:
#!/bin/bash
xterm -e "pkcon update && sleep 5s && xfce4-panel --plugin-event=genmon-7:refresh:bool:true"
[Edit: You will need to change genmon-7 to the Genmon ID number in your panel. Go to Panel>Panel Preferences>Items and hover over the Genmon instance in the list - you will see the ID number for your panel.]
exo-open --launch TerminalEmulator works too, but I like the cute Xterm terminal.
I hope these methods are useful to somebody. If I have left out any necessary information, please let me know in the comments!
Here are the modifications to the Conky script. Get the default Conky script from etc/conky/conky.conf and copy to ~/.config/conky/conky.conf and edit.
gap_x = edit to suit
gap_y = your monitor
own_window_transparent = true,
own_window_argb_visual = true,
conky.text = [[
${execi 86400 lsb_release -sd}
$kernel${time %A %d %B %Y}
${color grey}Uptime:$color $uptime
${color grey}Available updates:$color ${execi 3600 aptitude search "~U" | wc -l}
]]
[Update: amended Conky script so it checks for Debian release information daily and not every second.]
No comments:
Post a Comment