Folks, how can I set up different .Xdefaults configurations depending on the wm I'm using?
EDIT: nevermind. Sorry. I was just tired of search engines. solved. ignore this. etc.
Printable View
Folks, how can I set up different .Xdefaults configurations depending on the wm I'm using?
EDIT: nevermind. Sorry. I was just tired of search engines. solved. ignore this. etc.
O_o
Can you give us a little more information about your setup and what you want to achieve?
For me, this is as easy as adding an appropriate `xrdb' line to my `.xinitrc'.
I just have a tiny bit of shell code that examines a few environment variables to add the relevant defaults and execute the manager specific `.xinitrc.VM_COMMON_NAME' script.
Soma
Yeah. I think I still need help with this, after all. I don't like my solution much. There must be a simpler way.
I use Openbox as my wm. But for sometime, because of the way I set it up and have been using it, I've been realizing that what I really want when I'm programming in Linux is a tiling window manager. For some time I've been using i3 and like it a lot. But every time I switch between them I'm forced to edit my .Xdefaults resources file.
I've set this script:
By default it sets up i3 resources file. And only if I specify openbox, will it do it.Code:# home/marfig/startx
#!/bin/sh
case "$1" in
'openbox')
WM=openbox-session
ln -sf ~/.Xdefaults.openbox ~/.Xdefaults
;;
*)
WM=i3
ln -sf ~/.Xdefaults.i3 ~/.Xdefaults
;;
esac
export WM
/usr/bin/startx
In .xinitrc I did this:
So, everything works. i3 starts by default, and openbox only if i pass the 'openbox' argumentCode:if [ -n "${WM+x}" ]; then
exec "$WM"
else
exec i3
fi
But I really don't like having to type "./" to launch a script. I feel what I did is sloppy. Can you suggest me something better?
Look, I'm just tired and dumb. Of course the solution is to move my own /home/marfig/startx script to the top of /usr/bin/startx!
/usr/bin/startx does have code for a $1, but I never used it before, and this doesn't seem to have any influence on it. I'm so tired from this that the obvious solution only comes when I finally decided to take my mind off it.
Well, after a good night sleep I came up with better. It's my newbiness...
Editing /usr/bin/startx isn't that of a good idea either. So I created a bin folder in my home folder, set my path to $HOME/bin:$PATH and:
Code:# ~/bin/startx
#!/bin/sh
# Set env for openbox or i3. Later processed by .xinitrc
case "$1" in
'i3')
WM="$HOME/bin/start.i3"
ln -sf ~/.Xdefaults.i3 ~/.Xdefaults
;;
*)
WM="openbox-session"
ln -sf ~/.Xdefaults.openbox ~/.Xdefaults
;;
esac
# Run wm
export WM
/usr/bin/startx "$2"
Code:# ~/bin/start.i3
# called from ./startx
#!/bin/bash
/usr/bin/i3 -V >>$HOME/.i3/i3log >&1
I was having problems with it before I created start.i3. With a bit of help I learned that the redirection was confusing bash and evaluating the whole thing as one command. So start.i3 is necessary to avoid that behavior.Code:#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
# Initiate vmware integration
vmware-user&
# Execute WM
if [ -n "${WM+x}" ]; then
exec "$WM"
else
exec openbox-session
fi
It's working beautifully now. And I can now easily expand it to other configuration files or, if necessary, to other wms. Who said we need login managers...
You are getting pretty near what I've done.
About the only difference is that my script (installed in `/usr/bin') only sets an environment variable based on content pulled from a simple "CSV" file. I only need to call the usual `startx'--with no parameters.
The only necessary changes are local files (`.login' or `.profile'). I need to add a call to setup the default "WM" for the given user.
SomaCode:lgxwst.wm --switch openbox