====== Migrate from FLWM to LXDE ======
[[http://en.wikipedia.org/wiki/LXDE|LXDE]] is a light-weight [[http://en.wikipedia.org/wiki/Desktop_environment|Desktop Environment]] based on the Window Manager [[http://en.wikipedia.org/wiki/Openbox|OpenBox]]. It includes, among other things, a comfortable panel and a set of [[https://en.wikipedia.org/wiki/LXDE#Software_components_of_LXDE|helper applications]], the most prominent being its file manager [[http://en.wikipedia.org/wiki/PCManFM|PCManFM]], terminal LXPanel and editor [[http://en.wikipedia.org/wiki/Leafpad|Leafpad]].
The full of LXDE desktop environment does not work out of the box on dCore. For among other things, it contains session management tools which are unnecessary on dCore. The approach chosen here is to create a functionally equivalent set-up by adding the necessary tools from LXDE to a regular Openbox environment. A bonus will be that the mechanisms for dealing with *Core's OnDemand applications will work nicely.
===== Version =====
These instructions are known to work on ...
* dCore-bionic64 --- //[[sm8ps-tcl1@yahoo.com|sm8ps]] 2018/07/10//
An older version with a focus towards a full integration of LXDE is available for [[http://wiki.tinycorelinux.net/dcore:migrating_from_flwm_to_lxde?rev=1531215558|dCore-trusty]]. --- //[[sm8ps-tcl1@yahoo.com|sm8ps]] 2015/07/21//
=====Installing=====
We shall split the installation into two extensions. The base packages shall be loaded upon boot whereas additional tools shall be made available on demand. The distinction depends on personal taste and so one may want to include frequently used or even all packages into the base extensions.
Create a list file 'lxde-base-LIST', containing ...
openbox
lxpanel
obconf
... and 'lxde-tools-LIST', containing (cf. [[https://packages.ubuntu.com/bionic/lxde]] for short descriptions) ...
lxterminal
pcmanfm
gpicview
leafpad
arandr
clipit
Then ''sce-import'' these two extension lists, having the first one depend upon the X-server extension and the latter on the first. Include the entry "lxde-base-LIST" in 'tce/sceboot.lst' so as to have it loaded at boot-time.
In order to have LXPanel show, create a file '~/.X.d/lxde-base.sh', containing
#!/bin/sh
lxpanel &
Setting the ''desktop'' boot-code to "openbox" in your boot-loader will boot into a regular Openbox desktop with a LXPanel.
===== Menus =====
The *Core main menu, containing the Ondemand sub-menu, is available through right-clicking on the desktop. There is another "start" menu available through LXPanel, also containing the System Tools sub-menu but not any other *Core-menu.
For the interaction with the *Core main menu, maximized windows must leave a tiny bit of the desktop visible. Launch "Openbox Configuration Manager" from the "System" menu and set the left margin to 1 pixel.
====Usage====
An entry in the OnDemand sub-menu will call the respective script under 'ondemand/' in the tce-folder; its default content being a call to ''ondemand -e'' for the selected extension. The menu entries correspond to the file names which may be chosen at will. Loaded applications can be found in the Applications sub-menu as well as in the categorized sub-menus of the "start" menu in LXPanel.
===Comment===
The procedure for loading ondemand-applications may seem a bit round-about; however it is more convenient, indeed, than having to load them from the terminal. Of course, one would [[dcore:contributing|wish]] for a fully automated process.
==== Accessing the menus via keyboard ====
It is useful to have access to either menu via a keyboard short-cut. This is especially helpful in case that LXPanel should become invisible due to different monitor sizes.
Add the following to the ''''-section of '~/.config/openbox/rc.xml':
lxpanelctl menu
This will bind Ctrl-Escape to the Openbox main menu and Ctrl-F1 the "start" menu of LXPanel.
===== Compatibility with FLWM =====
In case one has followed the [[dcore:basic_desktop_installation|instructions]] for setting up a basic desktop installation, a Wbar window will pop up and possibly Trayer will be running in the background. For the moment, use ''killall wbar trayer'' to get rid of them.
dCore runs any shell script under '~/.X.d/', among others the starter scripts for Wbar and Trayer. These scripts are unnecessary as Openbox provides the functionality by itself.
Either remove these scripts together with their respective extensions or wrap the respective commands with the following if-clause so that they do not get executed unless FLWM is used.
#!/bb/sh
if [ $(cat /etc/sysconfig/desktop) = openbox ]
then
fi
If one wants to start a terminal by default then the following change in '~/.xinitrc' will work in both situations.
#xterm &
/etc/alternatives/x-terminal-emulator &
===Special cases===
Some applications do not work well with the default ondemand-script and complain that "neither freedesktop file nor wireless executable exists". One notable such case is the ''wireless'' extension.
Edit the respective file under 'ondemand/' in the tce-folder and make it follow some working procedure. For the case mentioned, the following does work.
#!/bin/sh
sce-load wireless
cliorx sudo wifi.sh
===== LXPanel settings =====
By right-clicking on the panel, on gains access to the panel settings. From there, one may choose to add, remove or configure panel items.
==== Log-out ====
The Logout entry in the "start" menu can be set to *Core's exit in the advanced settings to "/usr/local/bin/exittc".
====Localization====
LXDE provides a comfortable tool for switching the keyboard layout by one of its panel items called Keyboard Layout Handler.
(It is necessary to de-activate its setting "Keep system layouts" before one can configure additional keyboard layouts.)
Thus there is no need to manually call ''setxkbmap'' through a file under '~/.X.d/'. Such a file may be wrapped like above to restrict its action to the FLWM-desktop.
However, the file manager PCmanFM (or rather GTK as mentioned in the [[http://forum.tinycorelinux.net/index.php/topic,7025.msg37148.html#msg37148|forum]]) needs to be explicitly told about filename encoding. Include the following into '~/.profile'.
export G_FILENAME_ENCODING=@locale
==== Resource monitor, LXTask ====
LXPanel provides a resource-monitor add-in which is quite useful by itself. Furthermore, its standard action upon clicking is to launch LXTask which give a quite complete over-view of running processes. It is installed through the ''lxtask'' package. Alternatively, one may want to link the clicking action to the System Stats entry from *Core's main menu. This is achieved by adding "/usr/local/bin/stats" in the settings.
==== LXPanel menu entries and buttons for suspending to RAM or disk ====
If [[dcore:suspending|suspending to RAM or disk]] works then one may want to make it easily available through a panel button. For that matter, one must first create suitable menu entries.
First, create the directory '~/.local/share/pixmaps/' and download a [[http://wiki.tinycorelinux.net/_media/dcore:exittc_green.png|green]] and [[http://wiki.tinycorelinux.net/_media/dcore:exittc_red.png|red]] variant of the original blue icon file for the exit button into it.
Then create two files ''~/.local/share/applications/pm-{suspend,hibernate}.desktop'' with the following content, respectively. Adapt the path if a different user name applies. If applicable, one may want to use ''pm-suspend-hybrid'' instead of simple ''pm-suspend''.
[Desktop Entry]
Name=Suspend
Exec=sudo pm-suspend
Icon=/home/tc/.local/share/pixmaps/exittc_red.png
Type=Application
Categories=System;
[Desktop Entry]
Name=Hibernate
Exec=sudo pm-hibernate
Icon=/home/tc/.local/share/pixmaps/exittc_green.png
Type=Application
Categories=System;
LXPanel should automatically recognize the changes and show the new menu entries. If not so, then ''lxpanelctl restart'' will force the panel to re-read its configuration files.
Afterwards, it is a trivial task of adding an application starter to the LXPanel items with these menu entries.
==== LXPanel button for quick shutdown with automatic backup ====
In the same light, one may want to creat a blue exit button in the panel that performs a backup of 'mydata.tgz' and shuts the machine down.
First, create an //executable// file '~/.local/bin/backup-exittc.sh' with the following content:
#!/bin/sh
filetool.sh -b
exitcheck.sh shutdown
Then create a menu entry via '~/.local/share/applications/backup-exittc.desktop', again adapting the path to the home folder if applicable.
[Desktop Entry]
Name=Exit w/ Backup
Exec=/home/tc/.local/bin/backup-exittc.sh
Icon=/usr/local/share/pixmaps/exittc.png
Type=Application
Categories=System;
Finally, add the menu entry to the application launcher in LXPanel.
===== Openbox settings =====
It may be helpful to consider one of the many Openbox guides available over the internet. As usual, the [[https://wiki.archlinux.org/index.php/openbox|Arch Wiki]] features a very complete over-view.
==== Disabling the scroll wheel switching desktops ====
Scrolling on the desktop with either mouse wheel or (inadvertedly) the touchpad is interpreted as a command to switch desktops. This can be changed by commenting out (enclose by '''') or deleting the following lines from the section of '~/.config/openbox/lxde-rc.xml'.
That same action is still available through Alt+scrolling which some may find better suited. Furthermore that action allows for cycling through the desktops without boundaries.
**[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore Wiki Welcome page]]**