Skip to content

Commit

Permalink
FvwmPrompt: don't blindly quit if "quit" given
Browse files Browse the repository at this point in the history
Rather than quit, invoke FvwmScript.  This used to catch FvwmConsole
users out all the time.
  • Loading branch information
ThomasAdam committed Dec 21, 2024
1 parent 92b906f commit 3ff0e76
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions bin/FvwmPrompt/FvwmPrompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,15 @@ func main() {
shell.SetHistoryPath(consoleHistory)

shell.NotFound(func(c *ishell.Context) {
handleInput(c, strings.Join(c.RawArgs, " "), writeToFMD)
})

// register a function for overriding Fvwm3's "Quit" command, to
// instead run a FvwmForm.
shell.AddCmd(&ishell.Cmd{
Name: "quit",
Help: "Quit Fvwm3",
Func: func(c *ishell.Context) {
toSend := strings.Join(c.RawArgs, " ")
// Quit in fvwm is a special command but it can often lead to
// surprising results. Rather than blindly exit, invoke
// FvwmScript to at least confirm.
if strings.ToLower(toSend) == "quit" {
handleInput(c, "Module FvwmScript FvwmScript-ConfirmQuit", writeToFMD)
},
} else {
handleInput(c, toSend, writeToFMD)
}
})

isInteractive = len(os.Args) > 1 && os.Args[1] != "-p"
Expand Down

0 comments on commit 3ff0e76

Please sign in to comment.