Editing GUI Settings in Linux or UNIX
Today a friend sent an email with a Gnome helper app to setup a panel so remote ssh logins could be added to the Gnome Panel. There are lots of applications, or applets, like this out there. They all read and edit config files and provide a GUI to do something that has been possible for years and years. I guess if you are new, then having a program that edits configuration files before you’ve learned to use a UNIX editor is a good thing. Noob-friendly editing is good and reduces the perceived learning curve for Linux. Long-time users know that having a program to edit simple configuration files isn’t needed. You can edit them yourself and accomplish amazing things.
Some background reading on X/Windows. Here’s an architecture image as a reminder:
Recall that the X-Server runs on the desktop and that the X-client runs on the other, sometimes remote, machine sending requests for to the specific screen to be displayed. Also, you can run many X-servers on a single machine, even if they are not physically displayed.
Nothing is New
Do a google search on “fvwm screenshots” to see what I mean. This one or one very similar has been displayed as long as I can recall using fvwm. fvwm has been around since before I started using UNIX/Linux in 1993. I didn’t find it until 1995 when it was a pioneer in virtual desktop capable window managers. At that time, people were still using wmw and twm, yes, people actually used twm. When you first started using FVWM, you wanted to configure the menu for your local needs. It was easy to get going quick and setup remote logins to other systems for everything, including telnet, ssh, email, web browsing, editing files, running desktop word processors … whatever. Today the GUI settings are still maintained inside text files and these can be customized manually. Sometimes there are a few more steps since GUI programmers today like to take a simple concept and turn it into an environment that requires many, many more config files. Still, manually adding menu items to a panel for Gnome, KDE, XFCE, or LXDE is relatively easy.
Edit Configuration Files
If, you are not afraid of editing some files with a text editor, you can unleash amazing power for your environment and make it your own. If you’ve ever watched a UNIX guru work on his personal machine, you’ll see why we don’t really like mice. They are too slow most of the time and not needed, but many of us will make a few apps mouse-able for convenience when we aren’t tied to the keyboard. I have email, web browsing and and a few other programs directly click-able on the lxpanel on my desktop too. That list of programs includes a few remote shells to servers I use weekly.
LXWM Example
Since I don’t run Gnome, the article panel editing tool is not very useful to me, but for the sake of others that also run lxwm (from LXDE), you can quickly setup the same thing by manually editing some files – it is much quicker than pointing-n-clicking for 10 minutes to add a few commands.
First you need to create a “desktop” file for every command you want to use. I keep my custom xxx.desktop files together. Here’s an example to remote into another server.
$ more xt-dms44.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=dms44-root
Comment=Xterm to root@dms44
Exec=/usr/bin/xterm -u8 -class UXTerm pre -sb -e ssh root@dms44
Icon=/usr/share/pixmaps/xterm_32x32.xpm
Categories=System;Settings;
Then we just need to edit the lxpanel file here: /home/uid/.config/lxpanel/LXDE/panels/top_ and add it our menu.
Button {
id=/usr/share/applications/xt-dms44.desktop
}
You can make menus, launchbars, and other types of entries. Check our the man page for more details.
Control Fonts, Colors or anything known to X/Windows as a widget
The X/Windows system was designed to allow customization of almost everything you can see on the display. Everything. The width of handles that you can grab with a mouse, the color of those handles, where menus are displayed, how check boxes look, and even the fonts for every different text area that gets displayed. These settings are stored in resource files and can be set globally for all X/Windows programs or go down to the title font for a single program. There’s a hierarchy to the precedence that you’ll need to learn for more advanced uses. We’ll start easy with an xterm and controlling the fonts and forcing a scrollbar to be displayed.
Drop these settings into your $ vi ~/.Xdefaults
XTerm*font: 10x20
XTerm*background: Black
XTerm*foreground: Yellow
XTerm.vtMenu: set-scrollbar
Then force a reload of the resources with
$ xrdb -load ~/.Xdefaults
Kick off a new xterm to see the changes.
Rather than redo what others have covered many times, here’s a link that will be helpful to those unfamiliar with X/Windows resource files. The configuration options are nearly endless. Don’t take too much time tweaking your settings and always make a backup of the file you are editing first. You can easily lose months tweaking.
OpenBox
If you are like me, you want a lite-weight GUI. I’m running LXDE which uses OpenBox under the covers. The right-click menu is connected to /usr/share/lxde/openbox/menu.xml, so some very simple edits there will add applications to the popup menu. I added my core apps with just these lines:
<item label="Xterm">
<action name="Execute"><command>xterm -sb</command></action>
</item>
<item label="Thunderbird">
<action name="Execute"><command>thunderbird</command></action>
</item>
<item label="Firefox">
<action name="Execute"><command>firefox</command></action>
</item>
<item label="Miro">
<action name="Execute"><command>miro</command></action>
</item>
<item label="KeePassX">
<action name="Execute"><command>keepassx</command></action>
</item>
Notice how options can be passed in. To see your updates/changes, just use the Reload Config Files option on the menu. Life is good.
Trackbacks
Use the following link to trackback from your own site:
https://blog.jdpfu.com/trackbacks?article_id=695