window managers - the hotswap option

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
`f00
Posts: 807
Joined: Thu 06 Nov 2008, 19:13
Location: the Western Reserve

window managers - the hotswap option

#1 Post by `f00 »

With some window managers there is an option to 'hotswap' or restart to another wm directly, without closing the X 'desktop' environment or loaded applications. While this may seem quite convenient, it's important to be aware of various factors that can make for complications if you do so. Almost always is it preferable to make a 'clean break' by exiting X and starting a wm fresh, but this howto is for those who may wish to try the convenience of the hotswap option (and also find the limitations by experience).

Among the wms that I'ved tried that support a full hotswap interchange (you can freely swap back and forth between them) are blackbox, cwm, fluxbox, startfluxbox (option), fvwm, fvwm-themes-start, icewm, pekwm, twm and wmakerº. It's fairly simple for most of these to make a submenu in the base part of the rootmenu (or alternate menu) for the commands. Follow each wm's menu rules for doing this (syntax and so on).

Example snippets (your setup may vary!)

in blackbox:
[submenu] (hotswap) {to..}
[restart] (cwm) {cwm}
[restart] (fluxbox) {fluxbox}
[restart] (startfluxbox) {startfluxbox}
[restart] (fvwm) {fvwm}
[restart] (fvwm-themes) {fvwm-themes-start}
[restart] (icewm) {icewm}
[restart] (pekwm) {pekwm}
[restart] (twm) {twm}
[restart] (wmaker) {wmaker}
[end]

in cwm (kybd-only so far):
CM(Ctrl+Alt)-w .. gives the 'dialogue', next key input gives list ('b', for example)
.. select from the list ('blackbox', for example) .. enter<key> to hotswap
(other variations may be doable, see the docs on cwm&cwmrc)

in fluxbox with icon(symlink) support:
[submenu] (hotswap) {to..} </root/.fluxbox/ico/mini-run.png>
[restart] (blackbox) {blackbox} </root/.fluxbox/ico/mini-start.xpm>
[restart] (fvwm) {fvwm} </root/.fluxbox/ico/mini-start.xpm>
[restart] (fvwm-themes) {fvwm-themes-start} </root/.fluxbox/ico/mini-start.xpm>
[restart] (icewm) {icewm} </root/.fluxbox/ico/mini-start.xpm>
[restart] (pekwm) {pekwm} </root/.fluxbox/ico/mini-start.xpm>
[restart] (twm) {twm} </root/.fluxbox/ico/mini-start.xpm>
[restart] (wmaker) {wmaker} </root/.fluxbox/ico/mini-start.xpm>
[end]

in fvwm (section of .fvwm2rc):
DestroyMenu MenuFvwmQuitVerify
AddToMenu MenuFvwmQuitVerify "$[gt.quit fvwm?]" Title
+ "&Q. $[gt.def quit]" Quit
+ "" Nop
+ "&r. $[gt.reload]" Restart
+ "" Nop
+ "&b. $[gt.hotswap to] blackbox" Restart blackbox
+ "&f. $[gt.hotswap to] fluxbox" Restart fluxbox
+ "&s. $[gt.hotswap to] startfluxbox" Restart startfluxbox
+ "&v. $[gt.hotswap to] fvwm-themes" Restart fvwm-themes-start
+ "&i. $[gt.hotswap to] icewm" Restart icewm
+ "&k. $[gt.hotswap to] pekwm" Restart pekwm
+ "&t. $[gt.hotswap to] twm" Restart twm
+ "&w. $[gt.hotswap to] wmaker" Restart wmaker
+ "" Nop
+ "&P. $[gt.plogout]" Exec exec "plogout"

in fvwm-themes (it gives some in the menu, change as needed)

in icewm (template):
menu "hotswap to.." mini-run.png {
restart "blackbox" mini-start blackbox
restart "fluxbox" mini-start fluxbox
restart "startfluxbox" mini-start startfluxbox
restart "fvwm" mini-start fvwm
restart "fvwm-themes" mini-start fvwm-themes-start
restart "pekwm" mini-start pekwm
restart "twm" mini-start twm
restart "wmaker" mini-start wmaker
}

in pekwm:
Submenu = "hotswap" {
Entry = "blackbox" { Actions = "RestartOther blackbox" }
Entry = "fluxbox" { Actions = "RestartOther fluxbox" }
Entry = "startfluxbox" { Actions = "RestartOther startfluxbox" }
Entry = "fvwm" { Actions = "RestartOther fvwm" }
Entry = "fvwm-themes" { Actions = "RestartOther fvwm-themes-start" }
Entry = "icewm" { Actions = "RestartOther icewm" }
Entry = "twm" { Actions = "RestartOther twm" }
Entry = "wmaker" { Actions = "RestartOther wmaker" }
}

in twm (section of system.twmrc):
menu "change"
{
"change" f.title
"showiconmgr" f.showiconmgr
"reload twm" f.restart
"hotswap to blackbox" f.startwm "blackbox"
"hotswap to fluxbox" f.startwm "fluxbox"
"hotswap to startfluxbox" f.startwm "startfluxbox"
"hotswap to fvwm" f.startwm "fvwm"
"hotswap to fvwm-themes" f.startwm "fvwm-themes-start"
"hotswap to icewm" f.startwm "icewm"
"hotswap to pekwm" f.startwm "pekwm"
"hotswap to wmaker" f.startwm "wmaker"
"plogout" f.exec "plogout &"
}

in wmaker (excerpt-edit of Dima's wm-xdgmenu):
("session",
("save session", SAVE_SESSION),
("clear session", CLEAR_SESSION),
("reload wmaker", RESTART),
("hotswap to blackbox", RESTART, blackbox),
("hotswap to fluxbox", RESTART, fluxbox),
("hotswap to startfluxbox", RESTART, startfluxbox),
("hotswap to fvwm", RESTART, fvwm),
("hotswap to icewm", RESTART, icewm),
("hotswap to pekwm", RESTART, pekwm),
("hotswap to twm", RESTART, twm),
("plogout", EXEC, "plogout")
)
ºnote! fvwm-themes-start will NOT work in wm-xdgmenu,
it will corrupt and reset to Dima's OEM menu :shock:


In general, any user-selected background will carry over (unless specified in the hotswapped-to wm theme or style). Most of these wms will gracefully yield to the swapped wm - however some functions may or may not terminate (be aware and learn by experience). If you use Restart X server, you will return to the wm of record in /etc/windowmanager (where you were before you started hotswapping ;) ).
Last edited by `f00 on Tue 31 Jul 2012, 05:50, edited 2 times in total.

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#2 Post by Iguleder »

Nice stuff! I was able to switch from Window Maker to E16 without killing all my applications.

This thread is extremely useful for puplet developers.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

Post Reply