The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.
Ask Your Question
4

exiting i3 without mouse click?

asked 2013-02-27 06:45:37 +0000

fab gravatar image

updated 2013-02-27 06:46:39 +0000

I am a bit baffled by not having been able to find any answer after having extensively searched this. So I really like i3, but there's an annoying thing in my configuration. Everything seems to be able to be done via keyboard.

But when I exit i3 via standard $mod+Shift+e, an i3-nagbar (I suppose?) appears asking me if I really want to exit.

And then I haven't been able to find any key with which I can confirm to exit! So I have to use the mouse and click on "Yes, exit i3" (or "X" for cancel). This is really annoying to me. Can I map a key there or how can I do that? Thanks! (I assume I could disable the bar from appearing altogether, but so far I am not sure I really want that, so the question is really how to confirm to exit with a key press :) )

edit retag flag offensive close merge delete

Comments

Note that I exit i3 extremely rarely, and if I weren’t developing it, I probably never would. Either I lock and/or suspend my computer, or I reboot it. Why would I ever exit i3? :)

Michael gravatar imageMichael ( 2013-02-27 22:31:41 +0000 )edit

which version of i3? this doesn't happen with me on 4.2

bruno.braga gravatar imagebruno.braga ( 2013-02-27 23:09:53 +0000 )edit

@Michael: good question-To shut down. I have the strange habit of exiting the wm and shutting down from gdm...which is pretty dumb I suppose. I had issues (hangups on shutdown) when doing "halt" from a shell with ubuntu 12.04/awesome...shutting down from gdm seemed to clear that. @bruno.braga: 4.4

fab gravatar imagefab ( 2013-02-27 23:25:55 +0000 )edit

Looks I am left behind already :-) I'll check that out with 4.4 Cheers,

bruno.braga gravatar imagebruno.braga ( 2013-02-27 23:55:39 +0000 )edit

@fab: same thing here, if I try to shutdown from the terminal in precise, it hangs. So I must exit i3 prior to shutdown and it's true it's a little bit annoying to not be able to confirm with the keyboard ;-)

syl20bnr gravatar imagesyl20bnr ( 2013-03-01 19:42:54 +0000 )edit

3 answers

Sort by » oldest newest most voted
3

answered 2013-07-09 06:42:32 +0000

bw gravatar image

updated 2013-07-09 18:18:34 +0000

Michael gravatar image

If you think you can get away without having a confirm dialog:

bindsym $mod+Shift+e exit

edit flag offensive delete link more
1

answered 2014-04-29 22:35:03 +0000

tieni gravatar image

Hi, I know, this thread is old, but I found a good solution for me. In ~/.i3/config I changed the bindsym of exiting to

bindsym $mod+Shift+e exec i3-msg exit

That way, it chooses the "Yes, exit i3" path automatically.

edit flag offensive delete link more

Comments

Running i3-msg is unnecessary. Just use `bindsym $mod+Shift+e exit`

Michael gravatar imageMichael ( 2014-05-25 18:12:53 +0000 )edit
0

answered 2013-02-27 11:29:44 +0000

oblique gravatar image

updated 2013-02-27 11:45:01 +0000

You can use dmenu.

#!/bin/bash
while [ "$select" != "NO" -a "$select" != "YES" ]; do
    select=$(echo -e 'NO\nYES' | dmenu -nb '#151515' -nf '#999999' -sb '#f00060' -sf '#000000' -fn '-*-*-medium-r-normal-*-*-*-*-*-*-100-*-*' -i -p "You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.")
    [ -z "$select" ] && exit 0
done
[ "$select" = "NO" ] && exit 0
i3-msg exit

Save the above code in ~/.i3/exit_menu.sh (don't forget to chmod +x) and change the bindsym to

bindsym $mod+Shift+e exec ~/.i3/exit_menu.sh

if you don't like the colors or the fonts check 'man dmenu'.

edit flag offensive delete link more

Comments

That's exaclty what I was searching for. Thanks very much!

Lykos gravatar imageLykos ( 2013-10-13 23:42:13 +0000 )edit

I simplified this a bit: #!/bin/bash [ $(echo -e 'NO\nYES' | dmenu -sb '#ff6600' -fn \ '-*-*-*-*-*-*-20-*-*-*-*-*-*-*' -i -p "Do you really want to exit? This \ will end your session.") = "YES" ] && i3-msg exit

sml gravatar imagesml ( 2014-07-14 11:29:38 +0000 )edit

inline, no external shell file needed: bindsym $mod+Shift+e exec sh -c '[ $(echo "NO\nYES" | dmenu -sb "#ff6600" -i -p "Really exit i3 X session?") = "YES" ] && i3-msg exit'

Ruben G gravatar imageRuben G ( 2015-02-24 08:41:57 +0000 )edit

Question Tools

3 followers

Stats

Asked: 2013-02-27 06:45:37 +0000

Seen: 9,701 times

Last updated: Apr 29 '14