Various *.desktop files to (re)start various WMs

Core libraries and systems
Post Reply
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Various *.desktop files to (re)start various WMs

#1 Post by musher0 »

Hello all.

The old wmswitcher script from 2011 was mentioned in the waimea thread here.
I said I'd try modernize it and I will try.

But as a "side-thought", I thought an approach through *.desktop files could do the
job too. It's entirely optional, of course, but some people may find this handy.

The pet archive includes *.desktop restart files for the following WMs:
echinus fluxbox icewm jwm kde
openbox pekwm waimea wmx xfce
If you use them, they will show up in the Utilities section of your menu.

Merry Christmas!

~~~~~~~~~~
(Please download second version from post below.)
Last edited by musher0 on Mon 25 Dec 2017, 03:42, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello all.

This 2nd version will only copy in /usr/share/applications the restart*.desktop files
for the window managers you have, excluding your "main" WM (the one you are in
when you install this pet). I think that this is more "intelligent" (said the resident
dummy..., i.e. moi ) ;) than a dozen of restart files showing up in the Utilities
section of a menu -- which was the situation with my first version.

At install time, it does the job from the pînstall.sh script.

After you have installed another WM which is in the list, you can (re)run the script
< restartWMs-gnl.sh > at /root/my-applications/restartWMs/. If the name of that
WM is in the list, its restart*.desktop file will be copied to the
/usr/share/applications directory. (You can also copy it by hand.)

Finally, you can add the name of a WM to the list in your text editor, should the
need arise.

I'm including the script. Please read the comments.

Code: Select all

#!/bin/sh
#  /root/my-applications/restartWMs/restartWMs-gnl.sh
# (For general use. If you install a new WM that is
# already listed in list WM.lst2, re-run this script.)
# and
# pinstall.sh # which is run at time of install.
# (c) )musher0, Dec. 24, 2017
####
cd  /root/my-applications/restartWMs
while read line;do
	if [ "`which $line`" ];then
		if [ "$line" != "`cat /etc/windowmanager`" ];then
		# The *.desktop file for your main WM is not copied.
			cp -f restart_$line.desktop /usr/share/applications
		fi
	fi
done <  /root/my-applications/restartWMs/WM.lst2
# You can add other WMs to this list if you wish and
# create a restart*.desktop file for it using an existing
# one as template. Once done, rerun this script.
Feedback welcome. BFN.
Attachments
restartWMs-0.2.pet
(1.23 KiB) Downloaded 359 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Edit, Jan. 2 2018. My apologies to those who downloaded this previously. I discovered
some errors in version 2, in the paths. Version 3a corrects this oversight. Again, sorry.


~~~~~~~~~~~~~~~~~~~~~~
Hello all.

Still another version. My apologies to those who have downloaded the previous ones.

This version 0.3 does not include any *.desktop files. It generates them.
I should have thought of this before...

Here is an example of a *.desktop file it creates:

Code: Select all

[Desktop Entry]
# Warning -- For use with PuppyLinux only.
# Avertissement -- Utiliser seulement avec PuppyLinux.
Encoding=UTF-8
Icon=/usr/share/pixmaps/puppy/startup.svg
Comment=Replaces your current window manager with this one.
Comment[fr]=Remplace votre gestionnaire de fenêtres actuel par celui-ci.
Name=Restart jwm
Name[fr]=Redémarrer jwm
Exec=restartwm jwm
Terminal=false
Type=Application
Categories=Utility
GenericName=WM Switcher
GenericName[fr]=Changeur de gestionnaire de fenêtre
Please heed the warning, oh ye people of other distros? ;)

This is the script that generates it:

Code: Select all

##!/bin/sh
#  /usr/bin/restartWMs-gnl3a.sh
#
# Requiert : | Requires: restartwm
# Goal: create *.desktop files to launch various window managers. |
# Objectif: créer des fichiers *.desktop pour lancer divers gest. de fen.
#
# -- Notes (EN) --
# 1) For use only with PuppyLinux or its derivatives. Other distros may NOT
# --- have the required < restartwm > script.
# 2) You can add one or more WM(s) to the WM.lst2 file. Check how it launches,
# --- however. If it launches as "startthingy", you will need to alter line 47 below.
# 3) In all cases, simply re-run this script to create a restart*.desktop file for it.
#
# -- Notes (FR) -- (...)
#
# © Christian L'Écuyer,Gatineau (Qc), Canada,  Dec. 24 2017. GPL3
# (Alias musher0 [forum Puppy].) # Rév. Dec. 28 2017, Jan. 1st 2018.
################# # https://opensource.org/licenses/GPL-3.0
# (GPL3 License) (...)
####
Top="[Desktop Entry]
# Warning -- For use with PuppyLinux only.
# Avertissement -- Utiliser seulement avec PuppyLinux.
Encoding=UTF-8
Icon=/usr/share/pixmaps/puppy/startup.svg
Comment=Replaces your current window manager with this one.
Comment[fr]=Remplace votre gestionnaire de fenêtres actuel par celui-ci."

Bottom="Terminal=false
Type=Application
Categories=Utility
GenericName=WM Switcher
GenericName[fr]=Changeur de gestionnaire de fenêtre"

cd  /root/my-applications/restartWMs

while read line;do
	if [ "`which $line`" ];then # Only if you have this WM | Seulement si vous avez ce gest. de fen.
		RestartFile="/usr/share/applications/restart_$line.desktop"
		# "/mnt/ram1/restart_$line.desktop" # test

		case "$line" in fluxbox|kde|xfwm4) ExecLine="Exec=restartwm start$line" ;;
			*) ExecLine="Exec=restartwm $line" ;;
		esac

		echo -e "$Top\nName=Restart $line
Name[fr]=Redémarrer $line\n$ExecLine\n$Bottom\n" > $RestartFile
	fi
done <  /root/my-applications/restartWMs/WM.lst2

fixmenus # New in v. 3a
restartwm

Please read these Notes:
# Goal: create *.desktop files to launch various window managers. |
# [...]
#
# -- Notes (EN) --
# 1) For use only with PuppyLinux or its derivatives. Other distros may NOT
# --- have the required < restartwm > script.
# 2) You can add one or more WM(s) to the WM.lst2 file. Check how it launches,
# --- however. If it launches as "startthingy", you will need to alter line 47 below.
# 3) In all cases, simply re-run this script to create a restart*.desktop file for it.
#
There is no pinstall script in this version. You have to go through the trouble of
creating these *.desktop files yourself. :(

However, this script itself has a *.desktop entry under the name
"WM_Switches.desktop". To encourage user laziness just a little bit! :)

BFN.
Attachments
restartWMs-0.3a.pet
Please use this one
(2.46 KiB) Downloaded 356 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Hello all.

I updated the message and the script in my previous post.
There was an error in the paths. Sorry about that.

To whoever downloaded it, please download the edited version. Thanks.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply