You are not logged in.

#1 2009-05-05 02:09:22

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

How do you manage your X envirenment with different WM/DEs (one user)

I'm using XFCE and Openbox,

1.
I'm wondering how to make different configure/initial-setting files get excuted in different WM/DE
say, I have two sets of settings for .Xdefaults, and i want two files, say ".Xdefaults.XFCE" and ".Xdefaults.Openbox", put in each a set of .Xdefaults settings, and
when i choose to login into XFCE,  .Xdefaults.XFCE is read as if it is .Xdefaults
when i choose to login into Openbox,  .Xdefaults.Openbox is read as if it is .Xdefaults

i think this is something like environment variable??

2.
Also, i think maybe just create two directories in $HOME, say, "/home/myuser/XFCE.D" and "/home/myuser/OpenBox.D",and
when i choose to login into XFCE, just set HOME=/home/myuser/XFCE.D
when i choose to login into OPenBox,just set HOME=/home/myuser/OpenBox.D
In this case,   should .Xdefaults be read differently?? one is /home/myuser/.Xdefaults, the other, /home/myuser/OpenBox.D/.Xdefaults

Edit::As for .Xdefaults i think it's ok to put 'xrdb .Xdefaults.XFCE' under the case Xfce4 in .xinitrc
        But this ain't common solusion at all anyway
Edit::As for urxvt you can run 'urxvt -name URxvt_OB' and accordingly set resources in .Xdefaults like::  URxvt_OB.background:black

Last edited by lolilolicon (2009-05-05 04:35:39)


This silver ladybug at line 28...

Offline

#2 2009-05-05 10:06:49

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: How do you manage your X envirenment with different WM/DEs (one user)

In the login script for either, add:

xrdb -load ~/.Xdefaults.whicheveryouwant

That will load the specified file. Useful for messing with different colours/settings too.

Use ~/.config/openbox/autostart.sh for openbox, I think XFCE has a GUI where you can add it ("Sessions"?)

Last edited by iphitus (2009-05-05 10:08:05)

Offline

#3 2009-05-05 10:10:16

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: How do you manage your X envirenment with different WM/DEs (one user)

1. I use an environment variable WM that contains the name of the window manager binary. My ~/.xinitrc contains:

[... merge Xresources, set background, start xscreensaver, etc... anything that I want for any WM...]

# Exec windowmanager
if [ -f .xinitrc.$WM ]; then
    exec /bin/sh .xinitrc.$WM
else
    exec $WM
fi

# Fallback
exec xmessage "Can't exec $WM or source .xinitrc.$WM."

This will first look for a file ~/.xinitrc.$WM file, and, if it exists, it is used to start the chosen $WM. If no such file exists, the $WM is executed directly. If this fails, xmessage is used to inform me about this. So, if i want to try ratpoison real quick, I drop back to the console, set WM=ratpoison and run startx again. If I want anything special to happen before ratpoison is started, i create a dedicated .xinitrc.ratposion.

You could probably use a similar method to merge an additional .Xdefaults.$WM file if it exists, or merge a special Xdefaults file from the dedicated .xinitrc.$WM.

2. I'm not sure whether having two different home directories like that is practical and whether all programs can be trusted to use $HOME to resolve the current user's home directory.

If you want to use different config files for certain applications (say conky) depending on the current WM, you might use a method similar to the above. An alias might be sufficent, sth like

alias conky='conky -c ~/.conkyrc.$WM'

This works nicely with conky since it seems to fall back to using .conkyrc if the given config file doesn't exists. For a program that fails when given a nonexistent config file, you might use sth like

alias someprog='someprog -c ~/.someprog.rc.$WM || someprog'

Which will make that program use your dedicated config file if it exists, and fall back on the default if it doesn't. Note that in order to use aliases from scripts, you'll have to

shopt -s expand_aliases

This may or may not be what you're looking for... there's probably other ways to achieve similar results.

Note that xrdb -merge will just merge the given file with the existing settings. Thus you might use a global .Xdefaults file and additionally -merge in a file dedicated to a specific WM.

Offline

#4 2009-05-05 10:40:49

HashBox
Member
Registered: 2009-01-22
Posts: 271

Re: How do you manage your X envirenment with different WM/DEs (one user)

I like the look of your method hbekel.
My method was rather primitive, I set up my different session names under /etc/slim.conf (xmonad, openbox, xfce etc), and edited my .xinitrc to use a switch statement to launch different stuff depending on the session argument it got. Unfortunately I can't give an example as I recently overwrote it :\ (echo "blah" > .xinitrc instead of >>, doh, hooray no backups)

Offline

#5 2009-05-05 22:12:21

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How do you manage your X envirenment with different WM/DEs (one user)

hbekel:
$ conky -c

this is nice, and you explained so much in detail, about the fallback and shopt, thank you!

i also have the same doubt about $HOME var interpretation of different applications
it would be nice if every application's got a -c option to load the given config file instead of the default one, but they don't, right? Say, if i want firefox to start with different addons/themes/configs etc... under different WM but the same USER. I don't know how to do that with an option..?

actually, although it seems unnecessary, i initially wanted to load all dotfiles in $HOME.$WM dir instead of load those in $HOME, just like $HOME is set to $HOME.$WM, which contains all configure files for this WM... hope i said it clear...

Last edited by lolilolicon (2009-05-05 22:13:26)


This silver ladybug at line 28...

Offline

#6 2009-05-06 02:14:26

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: How do you manage your X envirenment with different WM/DEs (one user)

Exit firefox and run

firefox -ProfileManager

Create a profile or rename existing ones for each of your wms, then use

alias firefox='firefox -P $WM'

Offline

#7 2009-05-06 05:25:37

Wra!th
Member
Registered: 2009-03-31
Posts: 342

Re: How do you manage your X envirenment with different WM/DEs (one user)

I just use one huge ~/.xinitrc. I define the WM on top, then I run the common stuff (background setting etc) then a lot of `if` statements. depending on the $WM I can run different aplications

Last edited by Wra!th (2009-05-06 05:26:02)


MacGregor DESPITE THEM!
7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00

Offline

#8 2009-05-06 10:19:26

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: How do you manage your X envirenment with different WM/DEs (one user)

You could use symlinks to manage multiple configs. e.g.:

lrwxrwxrwx 1 chenno chenno  29 2009-05-06 12:15 .conkyrc -> /home/chenno/.conkyrc.openbox
-rw-r--r-- 1 chenno chenno 948 2009-05-06 12:14 .conkyrc.fluxbox
-rw-r--r-- 1 chenno chenno 948 2009-05-06 12:15 .conkyrc.openbox

and update the symlinks in your ~/.xinitrc:

ln -sf ~/.conkyrc.$WM ~/.conkyrc

Offline

Board footer

Powered by FluxBB