Common Desktop Environment

Some contributions

by Antonis Tsolomitis

CDE Panel


Why CDE ? We are not in the nineties anymore...
Because it is fast and will not make modern hardware slow like computers of the nineties.
I expect that investment on modern hardware is followed by faster desktop response. Unfortunately this is most often not the case. But it is with CDE.
CDE can be downloaded and installed from it's sourceforge page under the GPL2 license.

Is it usable as a modern desktop? Where are my popular apps?
Yes it is if you make some adjustments.
About the apps, check first this screenshot.

If you want to have these apps installed on CDE get my desktop_approots.tgz and do (as root)
mv desktop_approots.tgz /etc/
tar -xzvf desktop_approots.tgz
cd desktop_approots
sh integrate_all_apps.sh

logout and login back again. Click on the Application Manager (third icon from the right end of the panel). Now you can populate the panel's submenus
with apps by dragging them from the Application Manager to the "Install Icon" entry on the subpanels.

If you do not want all my app groups you can de-integrate them. Say you do not want the XXXX group. Do as root:

cd /etc/desktop_approots/XXXX/
sh deintegrateXXXX.sh

logout and login.

Table of contents




Mouse scroll

With the exception of the file manager that does not scroll (I hope it gets fixed), all other apps can scroll. Non CDE apps (say firefox) scroll on their own.
CDE apps (say the terminal) needs to be setup with the proper declarations in .Xdefaults or .Xresources in your home directory.

Add the lines in one of the above files from this file

logout and login.

Save more lines in Terminal

Add this line

*DtTerm*saveLines: 10s

to .Xdefaults or .Xresources of your home directory in order to increase how many screens the terminal will remember to 10.
logout and login.

Window Focus Policy

I prefer the focus policy that a window gets the focus if the pointer is in it. From the Style Manager (right to the printer's icon on the panel) go to windows section and enable "Point In Window To Make Active" and disable "Raise Window When Made Active".

        Click to raise

       If you enable explicit focus you will notice that in order to raise a window you need to click on the frame of it. It is more convenient to be able to raise a window by clicking anywhere on the window. More than that the lines in this file added to

$HOME/.dt/dtwmrc

(if it does not exist create it) will
a. Raise a window when you click anywhere on it.
b. Lower a window when you middle click on its title and frame.
c. Restore a window from its iconized state with a single click. (double clicks hurt your fingers for no reason. If you want to move an iconized app keep the alt pressed and drag it.)

logout and login.

Sound control

There is no sound applet in CDE. Lets hope it will be added. Until then the keyboard sound keys can be used to raise, lower or mute the sound.
Add the next lines to your $HOME/.dt/dtwmrc file. In addition to sound control (we assume you use the pulse daemon as most modern desktops do) you get the keybindings of executing a terminal with Alt+t, and switch to other workspaces by Alt+→ and Alt+←

Keys DtKeyBindings
{
   Alt<Key>Menu                 root|icon|window        f.toggle_frontpanel
    Alt<Key>t                   root|icon|window        f.exec dtterm
    Alt<Key>Right               root|icon|window        f.next_workspace
    Alt<Key>Left                root|icon|window        f.prev_workspace
    <Key>XF86AudioLowerVolume   root|icon|window|ifkey  f.exec "amixer -D pulse sset Master 5%-"
    <Key>XF86AudioRaiseVolume   root|icon|window|ifkey  f.exec "amixer -D pulse sset Master 5%+"
    <Key>XF86AudioMute          root|icon|window|ifkey  f.exec "amixer -D pulse sset Master toggle"
}

logout and login.

Can I add menu items to the root menu? (right click on the root window)

Yes. Check this screenshot.

Edit $HOME/.dt/dtwmrc

Add the submenus (we will add Internet and Office)

Menu Internet
{
Firefox f.exec "firefox&"
Thunderbird f.exec "thunderbird &"
}
Menu Office
{
"LibreOffice Writer" f.exec "loffice --writer&"
"LibreOffice Impress" f.exec "loffice --impress&"
}

And now add these submenus to the root menu and separate them by the default entries by two horizontal lines, by adding the fllowing to $HOME/.dt/dtwmrc

Menu DtRootMenu
{
    "Workspace Menu"                    f.title
    "Internet"                f.menu    "Internet"
    "Office"                f.menu    "Office"
     no-label                           f.separator
     no-label                           f.separator
    "Shuffle Up"                        f.circle_up
    "Shuffle Down"                      f.circle_down
    "Refresh"                           f.refresh
    "Minimize/Restore Front Panel"      f.toggle_frontpanel
     no-label                           f.separator
    "Restart Workspace Manager..."      f.restart
     no-label                           f.separator
    "Log out..."                        f.action ExitSession
}

logout and login (or restart the workspace manager).


How to deal with USB drives CDs etc

You need to add an automounter. The simplest looks to be udevil. It is available for many distributions or you can get it from its homepage http://ignorantguru.github.io/udevil/
After installation add this line

devmon --info-on-mount --sync --exec-on-drive "/usr/dt/bin/dtfile -folder %d" --exec-on-video "vlc --verbose=-1 dvd://%f" --exec-on-audio "vlc --verbose=-1 cdda://%f" &

to your $HOME/.dt/sessions/sessionetc   (the --sync option is slower but safer)

and this line

killall devmon

to your $HOME/.dt/sessions/sessionexit
(both files should be executable: chmod +x $HOME/.dt/sessions/sessione*)

Add a keybinding to umount all removable devices by adding this line

Alt<Key>u root|icon|window|ifkey  f.exec "devmon --unmount-removable"

to your "Keys DtKeyBindings" section of your $HOME/.dt/dtwmrc

logout and login.

Plug a USB stick. The file manager will open on the mountpoint and an additional window will open to provide information (unfortunately in gtk (uses zenity) and not in Motif). Press Alt+u and a popup window will inform you of the unmount process. When it closes you may remove the drive.


How to manage ethernet and wifi networks?

You may install wicd and its clients wicd-gtk (included in wicd) (unfortunately, wicd-qt which will look better on CDE since qt can be themed to CDE using the package qt4-qtconfig and the command qtconfig-qt4 seems that it needs a tray). Wicd is integrated in CDE if you install my desktop_approots above. You will find it in the System apps.



Internationalization

All my examples will be using Greek as the alternate language. CDE supports a few languages other than english. Italian, Spanish, French, and German. We will be insisting on Unicode. So the first task is to switch the locale variables for CDE. As root create the script

/usr/bin/startcdesession.sh

with contents

#!/bin/sh
export PATH=$PATH:/usr/dt/bin
export LANG=el_GR.UTF-8
/usr/dt/bin/Xsession


Make it executable:

chmod +x /usr/bin/startcdesession.sh

Then copy the cde.desktop to /usr/share/xsessions/

cp /path/to/cdesktopenv-code/cde/contrib/desktopentry/cde.desktop /usr/share/xsessions/

Open the file /usr/share/xsessions/cde.desktop and change the line

Exec=/usr/dt/bin/Xsession

to

Exec=/usr/bin/startcdesession.sh

Fonts

Next we need to make sure we have fonts available to our Xserver in the specified language. Check if the file manager or the terminal showes properly the names of files/folders with non-latin names. For example Ubuntu will probably fall back to misc fonts which support Greek. Notice that CDE needs fonts to be installed on the Xserver with the standard (old) Unix way. Modern apps do not need this since they use another more modern mechanism. This is another point that CDE needs inprovement.

If you do not see the non-latin names properly, then you need fonts. For Greek get this package hellas.tgz. Move it in /usr/local/share/fonts/ and unpack them:

tar -xzvf hellas.tgz

Add the fonts to the Xserver by adding these lines to the file /usr/share/X11/xorg.conf.d/99-cde.conf (on old systems use /etc/X11/xorg.conf)

Section "Files"
FontPath "/usr/local/share/fonts/hellas/75dpi/"
EndSection

If you already have a "Files" section just add the FontPath line to it.

Last thing is to tell CDE how to replace it's default fonts. CDE uses some specific fonts for it's interface which do not exist on modern systems. So we alias them to existing fonts.

mkdir -p /usr/dt/config/xfonts/el_GR.UTF-8/

and now get the file fonts.alias and the file fonts.dir and put them in the above directory. Test by logout and login. Now all CDE apps should be able to show the files/folders with Greek names. In addition to this the panel's calendar should show the month in Greek (check the above panel's screenshot).


Keyboard

The following section in /usr/share/X11/xorg.conf.d/99-cde.conf (or /etc/X11/xorg.conf on old systems) will setup the Greek keyboard with eurosign at AltGr+5 and at AltGr+e. The keyboard will toggle with Alt+Shift and  when in Greek  the scroll led of the keyboard will light up. Ctrl+Alt+Backspace kills the Xserver

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "pc104"
        Option          "XkbLayout"     "us,gr"
        Option "XKbOptions" "terminate:ctrl_alt_bksp,grp:alt_shift_toggle,grp_led:scroll,eurosign:5,eurosign:e"
EndSection

If you want to set it up only for a user and not the whole system, the easier is to use the CDE mechanism that executes commands before the session startup. Startup commands go to the file $HOME/.dt/sessions/sessionetc This file is a script and should be made executable (A similar file $HOME/.dt/sessions/sessionexit executes commands after the CDE session is terminated and before the user logs out).

Add the following line to you sessionetc file (make sure it is written in one line):

setxkbmap -option grp:alt_shift_toggle -option terminate:ctrl_alt_bksp -option grp_led:scroll -option eurosign:5 -option eurosign:e -option ctrl:swapcaps -layout us,gr

and make it executable

chmod +x
$HOME/.dt/sessions/sessionetc

logout and login.

        Where is the keyboard indicator?

There is none, other than the scroll led on the keyboard. BUT there is a solution which is much better than any other keyboard indicator I have seen. First install xxkb. It is available for many distributions. With this you can have your keyboard to work on a per window basis and it adds an indicator on each window titlebar, making it easy to check your keyboard.

In the following screenshot you can see how my keyboard indicator is setup. I do not like all my desktop windows to have all kind of flags on them, so I have used an empty (transparent) xpm file in the place of the flag of an English speaking country. This way, most windows (for which the keyboard state will naturally be in English) will have no flag at all. When you switch to Greek in a specific widow (say an editor), this window only will show the Greek flag.




To set it up, install xxkb. Get this file xxkb.tgz which contains the default xxkb flags plus flags of Greece.

mv xxkb.tgz /usr/share/
tar -xzvf xxkb.tgz
rm -f xxkb.tgz

Now configure xxkb by substituting your /etc/X11/app-defaults/XXkb with this file
XXkb. This file includes modifications so that the CDE panel and the submenus of the panel will not get a keyboard indicator. You may need to adjust the last two numbers appearing in the line XXkb.button.geometry: 28x15-43+7 for proper alignment on the titlebar.

Finally add the two lines

killall xxkb
xxkb&

to your
$HOME/.dt/sessions/sessionetc

logout and login.

Can I have menus in my language?

Yes for the supported languages. For Greek get this file usr.tgz and do as root

mv usr.tgz /usr/
cd /
tar -xzvf usr.tgz
rm -f usr.tgz

and add this line

Dtwm*windowMenu: DefaultWindowMenu

to your $HOME/.Xdefaults or $HOME/.Xresources

This will add support for Greek for most desktop menus.

For the root menu in which we added the groups Internet and Office above you should not forget to translate any menu items declared in your $HOME/.dt/dtwmrc file. Check this screenshot on Greek.




LTSP

Fixing the mouse cursor at login

In LTSP the lightdm login manager expects that the desktop sets the default root cursor (the mouse pointer). Since CDE does not do this, the cursor stays in the "busy" state with a rotating icon when the cursor is on the background image. To fix this, add the following line in your $HOME/.dt/sessions/sessionetc file (and make sure this file is executable):

xsetroot -cursor_name left_ptr

and restart the session.


Fonts in LTSP



The Xserver must know of your fonts and font aliases. On a standalone system this is done automatically by CDE as it starts. But the problem with LTSP is that the Xserver runs on the thin client but CDE runs on the LTSP server, and the mechanism that sets the aliases does not work. So one solution is to manually add a FontPath line to the chroot tree of ltsp.

We install the fonts we are aliasing to and the fonts.alias, in the choot environment.
We assume that the chroot tree is an i386 one. Otherwise replace i386 with amd64 below.
For Ubuntu and using the default font aliases that point to mscore fonts, we do:

sudo /bin/bash
chroot /opt/ltsp/i386
apt-get install ttf-mscorefonts-installer
exit
mkdir -p /opt/ltsp/i386/usr/dt/config/xfonts/
cp -r /usr/dt/config/xfonts/* /opt/ltsp/i386/usr/dt/config/xfonts/

Modern systems do not have an /etc/X11/xorg.conf file. Instead the configuration is placed in /usr/share/X11/xorg.conf.d/

chroot /opt/ltsp/i386
cd /usr/share/X11/xorg.conf.d/      (on old systems: cd /etc/X11/)

create here a file named 99-cde.conf (on old systems xorg.conf) with contents:

Section "Files"
FontPath "/usr/share/fonts/truetype/msttcorefonts/"
FontPath "/usr/dt/config/xfonts/C/"
EndSection

where the C above can be changed to your language if its is supported (check the contents of /usr/dt/config/xfonts/)

For Greek we also need the "hellas" fonts (see installation of these fonts above) so this file should be:

Section "Files"
FontPath "/usr/share/fonts/truetype/msttcorefonts/"
FontPath "/usr/dt/config/xfonts/el_GR.UTF-8/"
FontPath "/usr/local/share/fonts/hellas/75dpi/"
EndSection

Having root priviledges we recreate the ltsp image:

ltsp-update-image

Now CDE should load properly on the thin clients (provided that your fonts.alias are tested to work on a standalone system).




Mount remote Media


The LTSP server mounts usb keys attached to the thinclient at the server's location
/media/$USER

We take advantage of the capabilities of the CDE panel's controls to watch for a file, in order to get notified that a usb key has been mounted and easily navigate to the correct directory.
First create the file

/etc/dt/appconfig/types/C/ltsp-usb.fp

(or use your language instead of C) with contents:

CONTROL MonitorUSBkeys
{
TITLE MonitorUSBkeys
TYPE file
CONTAINER_TYPE SUBPANEL
CONTAINER_NAME Home
POSITION_HINTS last
FILE_NAME /media/$USER
MONITOR_TYPE file
ICON USBdrivedisconnected
ALTERNATE_ICON USBdriveconnected
}

You obviously need the icons stated above. Get them from here and put the icons in

/etc/dt/appconfig/icons/C/

When a usb key is inserted in the thinclient, the arrow on the HOME subpanel becomes yellow. Thus you get notified that the state of the usb control inside the subpanel has changed. Opening the subpanel you may check the the icon also has changed, a yellow vertical bar has appearred to the left of the icon, and clicking on it Dtfile opens in /media/$USER location.
You may see the screenshots here and here