I'm not sure why applications launched through gksudo
aren't using your user's theme. It works for me on a full Lubuntu system. (But that uses Openbox, not Blackbox.) Fortunately:
- The best solution for a program like the Update Manager is probably to install polkit (which is normally present) and run the Update Manager without
gksudo
. (See Way 1 below.)
- For applications that do have to be started as root, or if you don't want polkit installed, a workaround is to specify the theme you want with
GTK_THEME
(see Way 2 and Way 3).
Way 1: Install polkit (a.k.a. PolicyKit).
The best solution for utilities like:
- Software Updater / Update Manager (
update-manager
)
- Ubuntu Software Center (
software-center
)
- Lubuntu Software Center (
lubuntu-software-center
)
- Software & Updates (
software-properties-gtk
)
...and many of the other system administration utilities in Ubuntu, is to just not run them as root at all.
Normally you don't need to run these utilities as root because they integrate with polkit and use it (instead of sudo
) to perform authentication (just) when neccessary. Since the program showing you the user interface actually runs as you and not as root, it displays in accordance with your user account's configuration.
Typically nothing special must be done to achieve this, even on a Lubuntu system. Ubuntu is designed so that these utilities can just be run as a non-root user, without any special configuration.
But since your system is especially minimal, you probably don't have polkit installed. You can get it by installing the policykit-1 and policykit-1-gnome packages.
sudo apt-get update
sudo apt-get install policykit-1 policykit1-1-gnome
With polkit installed, these utlities should automatically use it and won't need to be launched as root.
However, this may not be suitable:
- if you don't want to install polkit, or
- for running GTK+ programs as root that haven't been written to use polkit (such as Leafpad or Gedit).
Way 2: Set the desired GTK+ theme when you run gksudo
.
Suppose you wish to run gedit
as root. Note that this technique works the same way for other GTK+ programs (such as the Update Manager).
Instead of running gksudo gedit
, you can run:
gksudo env GTK_THEME=HighContrast gedit
Replace HighContrast
with the name of the desired theme.
(I use env
because although sudo
supports sudo VARIABLE=name command
syntax, gksu
/gksudo
does not.)
Way 3: Make a launcher that that sets the desired theme.
This is the same as Way 2, just running your program through a launcher rather than typing a command each time.
To make a shortcut to run a program (like gedit
) with a particular GTK+ theme (like HighContrast
) as root in LXDE, run:
lxshortcut -o ~/Desktop/'gedit (as root)'
In place of gedit (as root)
, put whatever you want as the launcher's display name.
In the File Properties window that comes up when you run that command, click the Desktop Entry tab. In the text box labeled command, put:
gksudo env GTK_THEME=HighContrast gedit
You can leave everything else blank and just click OK.
If you want, you can use the full paths of the executables being run (/usr/bin/gksudo
and, in this example, /usr/bin/gedit
.) But this is not generally necessary.
Making a launcher for gksudo env GTK_THEME HighContrast gedit
. (The left part of the command is not visible.)