switchdesk?

Place to discuss Fedora and/or Red Hat
Post Reply
dishawjp
administrator
administrator
Posts: 334
Joined: Thu Jan 23, 2003 9:05 am
Location: Central NY
Contact:

switchdesk?

Post by dishawjp » Fri Apr 08, 2005 6:10 pm

Hi All,

Unlike most of my posts here, this should be a simple question to answer. When a user gives the command "switchdesk XXX" with XXX being kde, gnome or whatever, what file is modified to change the user's desktop to XXX?

I did check the man page on switchdesk, but it provided no clues as to the actual file modified. It seems like it should be a "." file somewhere in the user's home directory, but I'll be darned if I can find it.

Thanks (as always) in advance for any pointers.

Jim

worker201
guru
guru
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Post by worker201 » Fri Apr 08, 2005 6:20 pm

This is my /~/.Xclients-default

Code: Select all

#!/bin/bash
# (c) 2001 Red Hat, Inc.

WM="gnome-session"
WMPATH="/usr/bin /usr/X11R6/bin /usr/local/bin"

for p in $WMPATH ; do
   [ -x $p/$WM ] && exec $p/$WM
done

exit 1
This was listed (along with .Xclients) as the files modified in the manpage for switchdesk. Of course dotfiles are hidden by default, so you can't see it when ls-ing normally. Use "ls -a".

dishawjp
administrator
administrator
Posts: 334
Joined: Thu Jan 23, 2003 9:05 am
Location: Central NY
Contact:

Post by dishawjp » Fri Apr 08, 2005 6:44 pm

Hey Worker201,

Thanks for the prompt reply, but on my FC3 install, a ls-a .X* gives the following:

Code: Select all

[dishawjp@eunix ~]$ pwd
/home/dishawjp
[dishawjp@eunix ~]$ ls -a .X*
.Xauthority
[dishawjp@eunix ~]$
And a "man switchdesk" gives the following very useless info:

Code: Select all

[dishawjp@eunix ~]$ man switchdesk >nnn
[dishawjp@eunix ~]$ more nnn
SWITCHDESK(1)                                                   SWITCHDESK(1)



NAME
       switchdesk  -  graphical  and text mode interface for choosing desktop
       environment

SYNOPSIS
       switchdesk [desktop name]

DESCRIPTION
       switchdesk provides a simple method of choosing  between  the  various
       desktop  environments  available under Red Hat Linux, including GNOME,
       KDE, and FVWM2.  If X Windows is running, switchdesk will bring  up  a
       dialog box which allows the user to choose between the available desk-
       tops installed on the system.  This dialog follows the  appearance  of
       the  user’s  current desktop as closely as possible. If a desktop name
       (KDE, GNOME, XFce4, FVWM, WINDOWMAKER) is supplied as an argument,  or
       X is not running, switchdesk can be used from the command line.


RETURN CODES
       switchdesk returns 0 on success, 1 on error.


FILES
       ~/.Xclients, ~/.Xclients-default
                           Stores the currently selected desktop.



AUTHOR
       Than Ngo <than@redhat.com>
       Preston Brown <pbrown@redhat.com>



4th Berkeley Distribution      Mon Feb 14 2000                  SWITCHDESK(1)
[dishawjp@eunix ~]$
So I have a .Xauthority, but no .Xclients or .Xclients-default. So what is the file that "switchdesk XXX" changes in FC3 that selects my desktop?

It's not that anything isn't working properly, and I can change desktops with the "switchdeck" command, but I am curious about the actual file changed by the command.

Jim

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Apr 08, 2005 6:55 pm

Why not just look at the /usr/bin/switchdesk command? It's just a small script that calls another small python script in /usr/share/switchdesk directory. Also in that directory you will find the Xclients scripts for each window manager that switchdesk. I think you should be able to follow through the scripts and get the idea of what they do.

worker201
guru
guru
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Post by worker201 » Fri Apr 08, 2005 6:57 pm

Weird. There's probably some config thing going on here. I have the desktop switcher app installed, and I pretty much use Gnome exclusively. I don't even think I have any kde stuff installed.

dishawjp
administrator
administrator
Posts: 334
Joined: Thu Jan 23, 2003 9:05 am
Location: Central NY
Contact:

Post by dishawjp » Fri Apr 08, 2005 8:32 pm

Voidmain,

Well, I am not a programmer or even much of a scripter..., I just do a bit of perl and I suck at that. But looking the script over, it looks like it refers to /usr/bin/switchdesk-helper, also a shell script.
That script seems to point at ~/.xsession or to ~/,xinitrc and then sets up a ~/Xclients file with the variable $DNAME (as selected by the user allowing gnome, kde, fvwm, enlightenment and etc. as choices) as the window manager. The "DESKTOP=`echo $1 |tr a-z A-Z`" line looks like it is permitting lower case letters instead of uppercase for the window manager selection in the DNAME variable.

But I don't have either a ~/.xsession or a ~/.xinitrc file.

Code: Select all

 
[dishawjp@eunix ~]$ ls .x*
.xscreensaver

.xmms:
config  menurc  Plugins  Skins  xmms.m3u
[dishawjp@eunix ~]$
I always thought that this was in the ~/.xsession file, but when I went to look for the file, it wasn't there.

Anyway, thanks again Worker and Voidmain for the assistance.

Jim

Linux Frank
administrator
administrator
Posts: 239
Joined: Fri Jan 10, 2003 2:06 pm

Post by Linux Frank » Fri Apr 08, 2005 8:50 pm

Try this file

Code: Select all


/etc/sysconfig/desktop

I'm not sure if this is the global or local setting.

I recall that there is another file that is either global or user specific, obviously it would be the opposite of this one.

dishawjp
administrator
administrator
Posts: 334
Joined: Thu Jan 23, 2003 9:05 am
Location: Central NY
Contact:

Post by dishawjp » Fri Apr 08, 2005 10:27 pm

Linux Frank,

Thanks,

That file does at least exist on my machine and does specify Gnome as the dektop environment . It would seem to be a global given its location. I thought that the ~/.xsession would have contained this information, but on my box that file doesn't exist.

Thanks,

Jim

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sat Apr 09, 2005 6:40 am

When I type "switchdesk KDE" it's pretty obvious what it does:

Code: Select all

[void@laplinux ~]$ switchdesk KDE
Red Hat Linux switchdesk 4.0
Copyright (C) 1999-2004 Red Hat, Inc
Redistributable under the terms of the GNU General Public License
saving /home/void/.Xclients as /home/void/.Xclients.switchdesk
Desktop now set up to run KDE.

Code: Select all

[void@laplinux ~]$ ls -alp .Xcl*
-rwxr-xr-x  1 void void 189 Apr  9 07:35 .Xclients
-rwxr-xr-x  1 void void 189 Apr  9 07:35 .Xclients-default
-rwxrwxr-x  1 void void  20 Dec 18  2003 .Xclients-default.old
-rwxr-xr-x  1 void void 188 Dec 18  2003 .Xclients.switchdesk

Code: Select all

[void@laplinux ~]$ more .Xclients
#! /bin/bash

# Created by Red Hat Desktop Switcher

if [ -e "$HOME/.Xclients-$HOSTNAME$DISPLAY" ]; then
    exec $HOME/.Xclients-$HOSTNAME$DISPLAY
else
    exec $HOME/.Xclients-default
fi

Code: Select all

[void@laplinux ~]$ more .Xclients-default
#! /bin/bash
# Created by Red Hat Desktop Switcher

WM="startkde"
WMPATH="/usr/bin /opt/bin /usr/local/bin /usr/X11R6/bin"

for p in $WMPATH ; do
        [ -x $p/$WM ] && exec $p/$WM
done

exit 1
If yours isn't doing that I would have to guess something is broken. The /etc/sysconfig/desktop contains the "default" Window manager for when a user hasn't picked one.

When I do a "switchdesk KDE" I end up with an .Xclients-default that contains "WM=startkde" as you can see and if I did a "switchdesk GNOME" it contains "WM=gnome-session". startkde is the startup script for KDE and gnome-session is the startup script for GNOME.

dishawjp
administrator
administrator
Posts: 334
Joined: Thu Jan 23, 2003 9:05 am
Location: Central NY
Contact:

Post by dishawjp » Sat Apr 09, 2005 7:26 am

Ah-ha!

Thanks Voidmain!

That's the answer. Although I have used "switchdesk kde" for my daughter's account on this machine to set her up with KDE, I have always used Gnome in my account. Since the files aren't created until a non-default WM is used for that account, I didn't have the files and was defaulting to the /etc/sysconfig/desktop WM. I never thought to run switchdesk from the command line in my account and follow the output.

Thanks again!

Jim

Post Reply