Re: [i3] i3wm exit session

  • From: Tony Crisci <tony@xxxxxxxxxxxxxxx>
  • To: Discussions/Questions about the i3 window manager <i3-discuss@xxxxxxxxxxxxx>
  • Date: Sun, 05 Apr 2015 13:37:47 -0400

This works

bindsym Mod1+Shift+e exec "test -f /tmp/i3-nagbar$DISPLAY.lock || (touch
/tmp/i3-nagbar$DISPLAY.lock && i3-nagbar -t warning -m 'You pressed the
exit shortcut. Do you really want to exit i3? This will end your X
session.' -b 'Yes, exit i3' 'i3-msg exit' && rm
/tmp/i3-nagbar$DISPLAY.lock)"


On 04/05/2015 01:00 PM, Ingo Bürk wrote:

The pidof solution also completely disregards the possibility of
i3-nagbar being open for a completely different reason, e.g., a
configuration error. In that case displaying both makes total sense.

On 04/05/2015 06:50 PM, Michael Stapelberg wrote:
To expand a bit on my original post: I thought about the pidof
solution, but that will fail on multi-user systems or when you have a
hanging/broken instance of i3-nagbar sticking around.

Making this more robust is not as simple as one might think, and
that’s why I wanted to clarify what the real problem here is. If it’s
merely the dialog showing up more than once (and I _think_ this is
what the question is about), I think not fixing it outweighs the
complexity of fixing it. But it could be that I missed something,
which is why I asked…

On Sun, Apr 5, 2015 at 4:23 PM, Bigby James <bigby.james@xxxxxxxxxxxxxxx>
wrote:
On 04/05, Tony Crisci wrote:
Is there any way to add some snipe of code to solve it if I press many
times?

Change the binding to this

bindsym Mod1+Shift+e exec "pidof i3-nagbar || i3-nagbar -t warning -m
'You pressed the exit shortcut. Do you really want to exit i3? This will
end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
More often than not, the simplest solution to a problem is the preferrable
one.
You can hit several dozen keystrokes writing code to "correct" this
"problem,"
or you can just hit one keystroke and train yourself to not compulsively do
the
same thing over and over and over when there's no reason to. Incidentally,
that
ugly yellow thing is called "i3-nagbar," emphasis on "nag." If it's annoying
you, it's doing its job. Personally I (and, I suspect, many other users)
just
remove all mention of i3-nagbar from the configuration.

This whole thread reminds me of that old joke:

PATIENT: Doctor, it hurts when I do this...
DOCTOR: Then don't do that.
--
"A common mistake that people make when trying to design something
completely
foolproof is to underestimate the ingenuity of complete fools." - Douglas
Adams





Other related posts: