haskellarchlinuxxorgwindow-managersxmonad

Logout Sound for XMonad


I am using XMonad on Arch Linux, and my lack of experience in Haskell is finally getting in the way of configuring my system.

So, I wanted to have a Session login and logout sound. I use .xinitrc to start xmonad, where I can easily add a sound to act as my login sound. For logout, xmonad quits from the logged in session and drops right back to a tty which is logged out.

For this, my plan is to have a key-binding, which when pressed, will play a sound file and show a confirmation prompt to quit. As soon as the user responds, the session will quit.

My key-binding is like this right now

("C-q", confirmPrompt def "exit" $ io (exitWith ExitSuccess))

This can perform the exit command as intended, but I cannot find a way to execute a spawn command just before it.

I tried ("C-q", spawn "mpv --no-video ~/my-sound-file.oga" && confirmPrompt def "exit" $ io (exitWith ExitSuccess)) but to no avail. It throws an error, which most certainly is not according to Haskell syntax.

If anyone can do multiple commands like this on a single key-binding, or, execute a script when xorg closes, please let me know. Thanks in advance


Solution

  • You want:

    spawn "mpv foo.oga" >> confirmPrompt def "exit" (io (exitWith ExitSuccess))
    

    The two changes of interest are && -> >> and $ -> parentheses.