0

I have an icon on the panel that I'd like to hide, but only temporarily, i.e. my mail check icon. There are times I'd like to hide it, so I can focus on work, ignoring E-mails until later.

Removing the icon results in the settings being deleted, which is not a good solution, as re-adding the icon then takes many steps.

How can I temporarily hide an icon in XFce4?

1 Answer 1

1
+400

Solution

Add the following line to ~/.config/gtk-3.0/gtk.css (create the file if it is missing):

#mailwatch-7 image{-gtk-icon-transform: scale(0);}

Create the script toggle-panel-mail:

#!/bin/sh
gtkfile="$HOME/.config/gtk-3.0/gtk.css"
tmp="$HOME/.config/gtk-3.0/tmpfile"
sed '/#mailwatch/y/01/10/' "$gtkfile" > "$tmp" && mv "$tmp" "$gtkfile"
xfce4-panel --restart

Make it executable with chmod +x toggle-panel-mail and run it to toggle the icon's visibility.

Background

The topic XFCE4 forum: How can I remove the icons from the panel suggests to tweak the GTK3 style-sheet to suppress icons; unfortunately it uses a .tasklist identifier, while you want the mail widget identifier. How do we find it out? XFCE forum: GTK3 customization explains it:

[Right click the panel], go to Panel Preferences > Items tab and hover your mouse over the plugin (the name will appear in the tooltip).

Thus I've found mailwatch-7. The integer is likely the version number, so do repeat these steps to find out yours.

The script

That's essentially a Sed line that flips 0 to 1 and vice-versa only for lines that contain #mailwatch (so that it won't mess up other lines if you do use that file for tweaking GTK) and then restarts the panel. Some Seds have a -i flag for in-place editing, which could simplify the script. E.g., with GNU Sed, we could simplify it to

#!/bin/sh
sed -i '/#mailwatch/y/01/10/' "$HOME/.config/gtk-3.0/gtk.css"
xfce4-panel --restart

Extra resources

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .