You are not logged in.
Pages: 1
Hi,
I'm currently trying out different window managers and thought I'd share what I came up with. I seached the forum and found a zenity one and another one choosing your wm manually by "xinit yourChoise", but neither was quite what I wanted. My idea was to choose a wm before starting X. So here is my current working version of a dialog menu based wm chooser when logging in from VC/1.
The wmchooser.sh script
#!/bin/sh
#
# A script to choose your WM
#
#------------------------ ----------- - ---- -
# First a few thigs we want to know..
#-------------------------------------- - ---- -- -
# List your WMs here. Use executable names!
LIST=(fvwm musca ion3 scrotwm)
# Window height/width and menu height
# Defaut 0=auto
W_HEIGHT=0
W_WIDTH=0
M_HEIGHT=0
#-------- ---------------------- - - ---- --
# And here goes the script
#------------------------------- - -
COUNT=0
# Create menu entries
MENU=$(while [ $COUNT -lt ${#LIST[@]} ]; do
echo -ne "$COUNT ${LIST[$COUNT]} "
let COUNT=COUNT+1
done)
WM=$(dialog --stdout \
--ok-label "StartX" \
--cancel-label "Logout" \
--menu "Select Window Manager" \
$W_HEIGHT \
$W_WIDTH \
$M_HEIGHT \
$MENU)
# Set WIN_MGR
# choosewm=0, cancel=1, esc=255
case $? in
0) clear; WIN_MGR="${LIST[$WM]}" startx;;
*) clear; exit 1;;
esac
~/.*sh_profile (currently .zprofile)
When exiting X, I want to run the menu again so I won't have to logout/login each time
# Start X if logging in at VC/1
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/vc/1 ]]; then
while [ $? -eq 0 ]; do
/home/sm4tik/.scripts/wmchooser.sh
done
logout
fi
And finally ~/.xinitrc
#!/bin/sh
# Set default WM
DEF_WM=fvwm
# ...
# Rest of the xinitrc stuff
# ...
# Execute WIN_MGR of your choise
if [ ! -n "$WIN_MGR" ]; then
WIN_MGR="$DEF_WM"
fi
exec "$WIN_MGR"
The If startx is run from clean console, the DEF_WM gets executed.
I really don't know much about shell scripting and I'd like this to be any working in any *sh, so any help/suggestions are welcome. Also, if you have suggestions for a more correct/better/easier way of doing this, I'd appreciate it!
Last edited by sm4tik (2009-07-19 11:56:13)
Offline
Nice one
I made a similar script for myself but I deleted it after realizing I never used it
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Nice one
I made a similar script for myself but I deleted it after realizing I never used it
Me too.. I made that zenity one... but got bored of it within days
Offline
I didn't bother. Just defined some simple aliases:
# Some startup and shutdown conveniences
alias _X='startx'
alias _G='xinit /usr/bin/ck-launch-session gnome-session'
alias _K='xinit /usr/bin/ck-launch-session startkde'
Where startx (_X) is set to start IceWM.
A simple /etc/issue prompt is all I need to remind me.
To know or not to know ...
... the questions remain forever.
Offline
Pages: 1