mikshaw
Group: Members
Posts: 4856
Joined: July 2004 |
|
Posted: Jan. 03 2006,21:35 |
|
GUI Desktop Chooser
Here's a little flua script that will present you with a list of desktops from which to choose. It has fluxbox and jwm in it, but more can be added as a line-separated list called $HOME/.desktops.lst (the list overwrites the built-in list, so jwm and fluxbox need to be included in that file as well, at least for now). It works with the default .xinitrc in DSL2.1.
To use it, add the path to the script to the top of .xinitrc, before the .desktop file is checked.
IMPORTANT: 1) Do not add '&' after the command in .xinitrc because it won't work if you allow .xinitrc to continue while the script is loaded. 2) If you add any window managers to .desktops.lst, you will need to include them in the 'case' command in .xinitrc as well. 3) The script will currently run every time you start X, which means that if you switch from one desktop to another using the window manager's menu, you'll still get the GUI chooser. I just made this as a toy, to see if there is any interest in something more complex.
Code Sample | #!/bin/flua ------------------------------------------------------------------------ -- desktop_chooser.flua -- simple thing to let you pick a desktop as X loads -- mikshaw 2006 -- Changelog (yyyy-mm-dd) -- 2006-01-03 First version ------------------------------------------------------------------------
execute("xsri --color2=brown --color=black") dofile("/etc/init.d/functions.lua") UseIcons = getOption(getenv("HOME").."/.desktop","icons") Default_WM = getOption(getenv("HOME").."/.desktop","wm") rcfile = getenv("HOME").."/.desktops.lst" ww = 160 wh = 120 w_main = Window{ww,wh,"desktop_chooser"} chooser = Hold_Browser{0,0,ww,wh-20} listfile = openfile(rcfile,"r") if listfile then chooser:load(rcfile) else chooser:add("fluxbox") chooser:add("jwm") end for whichwm = 1,chooser.size do if Default_WM == chooser:text(whichwm) then active_WM = whichwm break else active_WM = 1 end end chooser:select(active_WM) doit = Return_Button{0,wh-20,ww,20,"continue";box=Boxtype.flat} function doit.callback() if chooser.value > 0 then execute("echo \"wm: "..chooser:text(chooser.value).."\" > $HOME/.desktop") if UseIcons then execute("echo \"icons: "..UseIcons.."\" >> $HOME/.desktop") end exit(0) end end w_main:show()
|
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|