-   Slackware (
-   -   How do I run "menu" and "logout" from the command line in fluxbox? (

psionl0 02-25-2011 12:30 AM

How do I run "menu" and "logout" from the command line in fluxbox?
Wbar is mostly just a piece of eye-candy. Nevertheless, I have included a "start" (slackware logo) button and an exit button.

The problem is, neither of these buttons work.

The start button should bring up the fluxbox menu but so far the only way I have found to bring up this menu is by right-clicking on the screen.

Similarly, the only way to logout and go back to the login screen seems to be via the fluxbox menu. Running "exit" from the command line only exits the terminal of course.

I can't find any information on this by googling. Has anybody researched this and found any answers?

dive 02-25-2011 12:49 AM

I use keyboard shortcuts for the menu:

Mod1 space :rootMenu

in ~/.fluxbox/keys

I think the command to exit is Exit but I haven't used that one

psionl0 02-25-2011 01:18 AM

neither :rootMenu, rootMenu or Exit do anything ("command not found").

I need to be able to invoke programs that will run the root menu or bring the system back into the login screen as required.

dive 02-25-2011 01:35 AM

Where are you putting those commands?

psionl0 02-25-2011 02:05 AM

Ultimately, these commands will be run by clicking on the appropriate button in Wbar. Programs invoked by Wbar can also be invoked from the command line within a terminal screen.

This is the method that you would use to set background in fluxbox ("fbsetbg"). Unfortunately, the makers of fluxbox seem to have made menu and logout internal commands instead.

dive 02-25-2011 02:34 AM

Yeah looks that way. I prefer to use keyboard to be honest. I don't pick the mouse up much these days.

psionl0 02-27-2011 01:00 AM

Hmmmm, it appears that nobody has an answer to this. It's not a biggie - just a minor disappointment. I seldom use the buttons anyway since most of the time the screen is covered by an app. 99% of the time I use the right click to run the menu and for the most part, fluxbox rocks.

Sooner or later though, I will have to learn how to set up fvwm2 - unless something like openbox is a little more flexible.

gnashley 02-27-2011 01:32 AM

Those commands are inetrnal to fluxbox, so they are not available to external programs like the terminal or wbar. fluxbox would need something like rpc or soap method support for that.

dh2k 02-27-2011 02:31 AM

the shutdown / restart can easily be done with enabling appropriate sudo for users

add (or uncomment if already there)
as root at terminal "visudo",

%users  ALL = NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/shutdown -h now
I believe a system restart is required after sudo changes in my experience - I maybe corrected on this though.

Halt/shutdown system: then point your wbar button to "sudo /sbin/halt"

Reboot/Restart: then point your wbar button to "sudo /sbin/reboot"

Hmm. I have never used a logout from fluxbox usinga button method - will update if I can get that working.

dh2k 02-27-2011 03:11 AM

To prevent accidental shutdown/restart etc, consider

if xmessage -center -buttons No:1,Yes:0 "Really shutdown?"; then sudo /sbin/halt; fi
or how my wbar entry looks for this
(newbies, see the command line starting "c: " )
(newbies, don't copy the icon path - that is personalised for my system "i: " )

i: /usr/share/pixmaps/lucid/pngs/system-shutdown.png
c: if xmessage -center -buttons No:1,Yes:0 "Really shutdown?"; then sudo /sbin/halt; fi
t: Shutdown

the above xmessage could be replaced with any other dialog prompt to add better aesthetics - but I have kept this example to be compliant with a stock slackware installation.

dh2k 02-27-2011 03:29 AM

To logout via a button:

Easiest, cheapest (scruffiest) way I can think of from top of head would be to kill the instance "fluxbox" process.


killall fluxbox
to prevent accidental logout via gui:

if xmessage -center -buttons No:1,Yes:0 "Really logout?"; then killall fluxbox; fi
to prevent accidental logout via terminal:

killall -i fluxbox
my wbar entry looks like this:

i: /usr/share/pixmaps/lucid/pngs/system-switch-user.png
c: if xmessage center -buttons No:1,Yes:0 "Really logout?"; then killall fluxbox; fi
t: Logout

dh2k 02-27-2011 03:50 AM

2 Attachment(s)
screenshots here (scaled down to 400x300 from 1024x768 as upload size <256kB)

dh2k 02-27-2011 03:54 AM

1 Attachment(s)

dh2k 02-27-2011 04:53 AM

Fluxbox menu can be called from command line/wbar button/run dialog:

First, one must enable fluxbox remote commands;
in your fluxbox init file, ~/.fluxbox/init (by default)
find the line:

session.screen0.allowRemoteActions:        false
and change it to true:

session.screen0.allowRemoteActions:        true
restart fluxbox.

You may now use the fluxbox-remote command:

fluxbox-remote "RootMenu"
So, you could use fluxbox-remote "ANY_INTERNAL_FLUXBOX_COMMAND"

Again, here is my wbar entry:

i: /usr/share/pixmaps/lucid/pngs/system.png
c: fluxbox-remote "RootMenu"
t: Menu

dh2k 02-27-2011 04:56 AM

Thinking about this I would probably recommend just invoking the (fluxbox-remote "FLUXBOX_INTERNAL_COMMAND") command;

then it is upto you to consider the system shutdown which would require updating the sudoers file (visudo as root).

So to summarise:

i: /usr/share/pixmaps/lucid/pngs/system.png
c: fluxbox-remote "RootMenu"
t: Menu

i: /usr/share/pixmaps/lucid/pngs/system-switch-user.png
c: if xmessage -center -buttons No:1,Yes:0 "Really logout?"; then fluxbox-remote "Exit"; fi
t: Logout

i: /usr/share/pixmaps/lucid/pngs/system-shutdown.png
c: if xmessage -center -buttons No:1,Yes:0 "Really shutdown?"; then sudo /sbin/halt; fi
t: Shutdown

So, be sure to change/personalise the icon paths and this will work -

All times are GMT -5. The time now is 02:08 PM.