PCLinuxOS 2020.01 and XFCE

My favourite Linux distribution is PCLinuxOS, and I have been using it for years. My favourite Desktop is XFCE. More recently, I discovered another Linux Distro, MX Linux, which specialises in the XFCE desktop. So, the aim of this article is to get XFCE working in PCLinuxOS, as well as, or better, than it does in MX Linux, so I can return home. I shall be listing, in this article, a number of tips to do this. Some will be straightforward and others might need some digging into the system. I hope you can make use of them!

 

Contents

(I’ll be adding more as I go along!)

  1. Making the desktop more attractive
  2. Adding System Sounds
  3. Using Screensavers from XScreenSaver
  4. Using oblong icons for Start Menu
  5. Folder Icons in Thunar
  6. Making Use of Orage Calendar

A little about XFCE

The XFCE4 desktop is a lightweight, fast, functional desktop, yet it has many features. It has a Panel, which has a number of applets available, not as complex or as many the KDE Panel, but all that most people will ever need. Screenshot_2016-07-23_13-59-12 The Launcher is the most flexible I have seen, it can appear as a single icon to launch one program, or as an icon with a small arrow, which can have a drop-down menu, and this is done simply by adding more than one program to the Launcher. The top launcher will be the main icon, and if you want the program to re-appear in the drop down, just add it again.

As you can see from the screenshot here, I have put all parts of LibreOffice onto a single launcher.

And there’s more… unlike some desktop panel program launchers, you are not totally tied to menu items. When you add an item, it can be from your usual startup menu, but you can also create it from scratch if you know where to find the executable file, icon, and you can use your own text in the name and the description. Or you can create your own by amending it from the standard entry.

Making the desktop more attractive

XFCE Panel Preferences dialogue

XFCE Panel Preferences dialogue

The initial panel layout in PCLinuxOS XFCE is not to my liking. I prefer my main panel at the bottom, and if I have a secondary one, I prefer it at the top, and self-hiding when not needed. Fortunately XFCE makes this really easy.

As you can see, there is a dialog box easily available from either panel, (right-click > Panel > Panel Settings), and a pull-down that enables you to switch between Panel 1 and Panel 2. On both panels, uncheck Lock panel, and a little drag handle appears at both ends of each panel, drag one half way up the screen, drag the other all the way to where it’s going, and then drag the first to its new home. Lock both panels. Easy!

If you click on the tab “Items” on Panel 1, the first item should be Applications Menu. There’s a nicer version of this called Whisker Menu. 

Non-square icon

Non-square icon

If it’s not an option, you need to run Synaptic and install “xfce4-whiskermenu-plugin“. It gives you a more modern style of Start Menu, whilst not being overcomplicated like some of that type. In both menus, you can set an icon and text, or even a non-square icon. Here are some that might work.

You can make the top menu hide itself by setting Automatically Hide to “Intelligently”. If the selected window on screen overlaps, it hides. If it doesn’t it shows. When hiding, just move the mouse pointer to the edge of the screen, and it will pop down. Neat!

Of course, you can change the Wallpaper, and have separate wallpapers on each desktop, a feature no longer supported by many desktop environments, including some of the “big boys”. The same goes with icon sets and mouse pointers. If you don’t like those provided, there are loads available on line.

Adding System Sounds

With the arrival of XFCE4.14, it’s now possible for you to select, in Settings > Session and Startup, apps/commands to run when you end your session, as well as when you start it. Such commands can easily be used play a musical sound, so it makes it a simple matter to set a login and logout sound for your desktop.

While your desktop is running, you can also have a sound theme, though it’s not as obvious as to how you set it. It can be done using XFCE Settings Editor. After running it, you select xsettings in the left hand column headed Channel, and under the group of properties headed Net, you can check EnableEventSounds, EnableInputFeedbackSounds, and type in a SoundThemeName (this is not a drop down menu, so you’ll have to know what Sound Theme Names are available).

On my own computer, I have downloaded a few themes, and written a couple of scripts so that they can be easily selected and used. I am suggesting that, to begin with, you install a theme called Smooth, which you can find at this location. Download the file showing version 1.2 and size 1.51Mb.

When you extract it, it will be inside a folder called Smooth. Just use a Root file manager to move that folder inside the folder /usr/share/sounds/.

Now you can use the XFCE Settings Editor, as above, to set it as your sound theme. Provided your sound system generally is working properly, you will get system sounds in response to clicking on icons and doing stuff generally! All you need to do now is to add your Start and Finish sounds and you have system sounds!

There was an error in the 2020.10 release of PCLOS XFCE mini which may be present in other versions. If, after carrying out the above procedure, you do not get any system sounds, try this:

As root, create a file in the folder /etc/profiles.d/ called canberra.sh, and copy these contents into it:

#
# /etc/profiles.d/canberra.sh
# To set canberra
#
GTK_MODULES="canberra-gtk-module"
export GTK_MODULES

Reboot your computer and all should be well.

Of course, you’ll want some login/logout sounds. Here is a script that will find the corresponding script in your selected sound theme. Put it in /usr/local/bin and call it xfce4-play-sound:

#!/bin/bash
# $1 will normally be desktop-login or desktop-logout —
# the file will be played irrespective of extension,
# provided it's a valid sound file.

#check if the sound exists
getthename=`xfconf-query -c xsettings -p /Net/SoundThemeName`
if [ $getthename != "None" ] ; then
if [ $getthename != "" ] ; then

getit=/usr/share/sounds/$getthename
play -v 1.0 --magic $( find $getit | tac | grep -m1 $1 ) &

fi
fi

What this script does is to look for a matching script in the currently-selected System Sound. So, for example, xfce4-play-sound logout would match files names including desktop-logout.ogg or logout.wav, it will play the last one it finds if there’s more than one. Usually there will only be one, desktop-logout.oga (but it might be ogg, wav or mp3 — this finds it anyway). Where there is more than one potential match in a sound set, move the unwanted ones to another folder. In Smooth there are three alternate login sounds, for example. 

So in your Session and Startup list in your XFCE Settings Manager, you’ll need to add a startup command, xfce4-play-sound desktop-login & and three exit commands, one each for logout, reboot and shutdown, which will all be the same: xfce4-play-sound desktop-logout &. You could even have different sounds for each way of exiting!

Pull-down menu 

You might want a pull-down menu to select the system sound. I’ve written a script here to carry this out. Create the file /usr/local/bin/xfce4-set-sound-theme and paste in these contents:

#!/bin/bash

# We need to create a list of soundfile directories with
# an "index.theme" file.

# start up a file with the names, plus the option "None"
echo -n "None" > ~/tmp/soundlist.txt

# look in the system sounds theme area.
cd /usr/share/sounds

for g in *; do

if [ -d ${g} ]; then
cd $g
# folders without an "index.theme" file are ignored.
if [ -f "index.theme" ]; then
echo -n "!""${g}" >> ~/tmp/soundlist.txt
fi
cd ..
fi
done

# we now have a list of entries for yad, with None,
# then system sounds in order. we will pass text to XFCE4.

soundset=$(echo `cat ~/tmp/soundlist.txt`)
abc=`yad --width=450 --title="Select System Sounds" \
--image="/usr/share/icons/sound_section.png" \
--text="Current Sound Theme is: $( xfconf-query -c xsettings -p /Net/SoundThemeName )" \
--form --item-separator="!" \
--field="Select New Theme":CBE \
"$soundset" `

#test for "cancel"...
if [ "$abc" != "" ] ; then

# yad returns a string with an extra "|" at the end,
# so we have to remove it.
chosensound=$(echo -n "$abc" | rev | cut -c 2- | rev )

#Turn sounds off if "None" selected
if [ "$chosensound" == "None" ] ; then

xfconf-query -c xsettings -p /Net/EnableEventSounds -s false
xfconf-query -c xsettings -p /Net/EnableInputFeedbackSounds -s false

else

#Turn sounds on if one selected
xfconf-query -c xsettings -p /Net/EnableEventSounds -s true
xfconf-query -c xsettings -p /Net/EnableInputFeedbackSounds -s true

fi

# Set your chosen sound. I have used the command that forces
# a new Property to be created #if there's not one already.

xfconf-query -c xsettings -p /Net/SoundThemeName -n -t string -s "$chosensound"

fi

In order to make an icon for this script appear in the XFCE Settings Manager, you need to add this file as /usr/share/applications/xfce4-soundthemes.desktop:

[Desktop Entry]
Name=Sound Theme
Comment=Select a new Sound Theme
Exec=xfce4-set-sound-theme
Icon=multimedia-player
Terminal=false
Type=Application
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-PersonalSettings;X-XFCE;X-Xfce-Toplevel;
OnlyShowIn=XFCE;
GenericName=Sound Theme Selector

You may need to change the line Icon= to an icon which is present on your system.

Screenshot_2020-01-23_17-59-14-cropped

 

Using Screensavers from XScreenSaver

It is possible to use individual screensavers in the XFCE screensaver applet. As PCLinuxOS is not primarily an XFCE distro, it requires a little work to set them up to work. I’m about to make this job a lot simpler.

First, you add all the packages in Synaptic, that start with xscreensaver, except xscreensaver itself.

As root, create the following file /usr/local/bin/xfce4-set-up-screensavers, with the following contents:

#!/bin/bash

##Declare locations
dirsource=/usr/share/xscreensaver/config
dirdest=/usr/share/applications/screensavers
direxec=/usr/libexec/xscreensaver

##go to screensaver config folder
cd $dirsource

##for each file, extract the screensaver's filename and public name
##and build a desktop file
##Remember that a single > begins a new file, possibly erasing an
##existing one, and >> adds a line to a file.

##1. Get the line that contains the names.
##2. They are between double quotes, so using " as a delimiter
##   splits the line into 5 strings, we want the 2nd and 4th.
##3. The last line has to be single-quoted because there is a semicolon
##   character in it.

for f in ./*.xml; do
    gg=`cat "$f" | grep "screensaver name"`
    ggfile=`echo $gg | cut -d'"' -f2`
    ggname=`echo $gg | cut -d'"' -f4`
    echo [Desktop Entry] > $dirdest/"$ggfile".desktop
    echo Type=Application >> $dirdest/"$ggfile".desktop
    echo Name="$ggname" >> $dirdest/"$ggfile".desktop
    echo Exec=$direxec/"$ggfile" -root >> $dirdest/"$ggfile".desktop
    echo TryExec=$direxec/"$ggfile" >> $dirdest/"$ggfile".desktop
    echo 'Categories=Screensaver;' >> $dirdest/"$ggfile".desktop
done

Make the file executable. Once you have done that, run it. Hey Presto, you have a huge list of screensavers available in the XFCE screensaver applet.

If, at a later date, you add more Screen Savers meant for xscreensaver, just run the script again!

I’ve hardcoded the various system folders at the beginning, so that they are easy to alter if there’s a change, or if anyone knows how to read them from the system, they can change those lines accordingly.

Using oblong icons for Start Menu

Non-square icon

Non-square icon

Another neat thing in XFCE4.14 is that both the “official” start menu, and the Whisker start menu, accept non-square icons. I’ve used this old one from kbfx to show. It’s far from perfect, and you have to use certain panel sizes for it to look right. Mine is 36 pixels, if I make it smaller, the icon is scaled down to “much smaller”! It doesn’t feature the multiple icons for mouseover and click though. The way to give it a small effect is to set the whole panel’s opacity to 92%, 100% when the mouse goes over it. That works nicely for me.

Folder Icons in Thunar

I found these scripts at the XFCE4 website. Between them, they cause an image called folder.jpg or .folder.jpg to be displayed as the folder’s icon in Thunar. There were two more lines in the first one which I deleted, to allow for the icons to be saved as cover.jpg and folder.png. The two other lines were identical except for the filename of the image. It’s better to keep it simple, and the first two were all I wanted…

This first one is saved in /usr/bin and called folder-thumbnailer. It needs to be marked executable :

#!/bin/bash

convert -thumbnail "$1" "$2/folder.jpg" "$3" 1>/dev/null 2>&1 ||\
convert -thumbnail "$1" "$2/.folder.jpg" "$3" 1>/dev/null 2>&1 ||\
rm -f "$HOME/.cache/thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
rm -f "$HOME/.thumbnails/normal/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
rm -f "$HOME/.cache/thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
rm -f "$HOME/.thumbnails/large/$(echo -n "$4" | md5sum | cut -d " " -f1).png" ||\
exit 1

And the following file should be called folder.thumbnailer and placed in /usr/share/thumbnailers

[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=Folder Thumbnailer
MimeType=inode/directory;
Exec=/usr/bin/folder-thumbnailer %s %i %o %u

For this to work, ImageMagick needs to be installed. And that’s it!

Connecting to online or shared calendars using Orage

Orage is a very powerful Calendar App, but has been abandoned by its writers. It runs in XFCE4.14, but may no longer run in future versions. It loads and saves calendars in *.ics format, and this can match up with a number of services on line. It’s outside my knowledge to speak of all of them, but I have linked my Orage calendar to my Google Calendar. And I have written about it in another article, Linking Orage to your Google Calendar. Of course, for a standalone setup, you just need to make a filename and link Orage to it. I hope it still works, or I can still get it to work somehow in the next version of XFCE. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: