Terminating FVWM from Button Bar

I have configured a button bar from which I launch a number of applications. I want to also have a button that “Quits” my FVWM session and returns me to my Gentoo terminal, but I cannot for the life of me work out the command wording. I’ve consulted the man pages, and tried many variations of the “Quit” and “exec Quit” and “exec quit” commands, but to no avail. This should be so simple – but I must confess I’m baffled. Can someone please tell me the magic words? Thanks.

[color=red]Edited by theBlackDragon:
-> moved from General questions[/color]

Well, the “Quit” command (“Exec Quit” won’t help you given that there is no external command called ‘Quit’ most likely) does do just that – exit FVWM. Depending on how you have X11 launched, that’ll either return you to your display manager, or put you to a terminal. If you wanted to explicitly change to a VT (a proper virtual terminal) you could just do:

Exec sudo chvt 1

Or, if you wanted to restart with just an xterm, for instance, you could use:

Restart xterm

– Thomas Adam

Thomas: Neither of those work. My relevant code language is as follows:

*MyButtons: (1x6, Frame 1, Icon 48x48-infox/quit.xpm, Title(Center) “Quit”, /
Action(Mouse 1) “exec sudo chvt 1(or Restart xterm)”)

Any further advice? Thanks, Jim

Of course it works:

DestroyModuleConfig a:*
*a: Rows 1
*a: Columns 1
*a: (1x1, Title foo, Action (Mouse 1) 'Restart')

… for instance. The reason why “Exec sudo chvt 1” doesn’t work is because you haven’t setup sudo, so it’s not going to work. But that’d a different action as to what it is you’re trying to do.

– Thomas Adam

Thomas: Some progress. In the code lines I sent you, i.e.:

*MyButtons: (1x6, Frame 1, Icon 48x48-infox/quit.xpm, Title(Center) “Quit”, /
Action(Mouse 1) “exec sudo chvt 1(or Restart xterm)”)

I noted that the “/” should have been “”!!!

Making that change, I tried the “Restart” and the “Restart xterm,” but all they accomplished for me was, respectively, to restart fvwm and to get me into the xterm within fvwm.

What I really want is to be able to leave fvwm and return to my Gentoo command line – as the quit command in my root menu does. But I tried inserting the same root menu command (or variations of it) into my button bar configuration, but that doesn’t work.

At least I discovered my typo error in my code – which of course is so often the problem.

Thomas: VERY EMBARRASSING! Now that I discovered that typo in my code, I tried a simple “Quit” again – and that worked! Very sorry to have put you through the trouble of trying to help me with this. Many, many thanks. Jim

Some helpful souls in the Gentoo forum directed me to the following potentially useful link:

gentoo-wiki.com/HOWTO_Let_a_comm … own/reboot

Using instructions contained there, I was able to configure things so that I can effect a system restart from the Gentoo command line entering a simple “restart” and a system shutdown using a simple “halt.”

However, it turns out that these commands do not work with my FVWM button bar in the manner of code entry which ultimately worked for the “Quit” command as described in my earlier postings above. I do not understand why “Quit” works so well and not “restart” and “halt” similarly. All work fine from the command line.

Anyone have an explanation – and solution? Thanks, Jim

In fvwmbuttons you can only use fvwm functions. For example, Quit, Restart or Exec, to name a few. In other words, check that you are prepending “Exec” to the command.")

That’s misleading, since a “function” has a specific meaning to FVWM. You can run any action you like from FvwmButtons. If you want an external command, then you have to use Exec.

– Thomas Adam

Thanks guys. That worked fine. I appended “Exec exec…” I believe that yesterday when I tried a sole “exec,” that didn’t work, but I don’t recall for certain. Anyway, I thought I had nothing to lose by using a double “exec.”

It’s important you realise the difference, of course. A single exec spawns a shell and then the external command (via execve()). Of course, given “Exec” is spawning a shell in the first place, it makes sense that when launching the external command then you replace the shell, as it’s typically not needed. That’s what the “Exec exec” is for.

Note that the case matters – the first command – the “Exec” that FVWM knows about (since it is an FVWM command) can be in any case you like. But given that as soon as you use it you’re then at the shell level, case matters – hence why it’s then in lower case, since “exec” at the shell is a builtin.

– Thomas Adam

Thomas: Thanks, yet again, for the explanation. One learns something new every day – and sometime more than one thing! Regards, Jim