Awesome WM shortcut to kill window

3

How can I set a shortcut to kill current window in awesome WM ?

I know Ctrl + ⇧ Shift + C close a window, but what I want is KILL (kill <PID> for instance).

I need this to kill process a frozen window for example.

Victor Aurélio

Posted 2014-07-28T17:47:53.927

Reputation: 473

Answers

2

What you want is killing the process that created a window. You can't do this out-of-the-box but might be able to do it under certain circumstances.

Please take a look at this answer on Stack Overflow about why it is not usualy possible.

If you want to give it a try anyway, you'll have to get active window id in lua, try to retreive a PID from it and invoke a kill -9 command on it. This is easily done use a tool like xprop, or you can use a command like this one (untested, probably not even working):

awful.key({ modkey, "Control"   }, "c",
    function (c) awful.util.spawn("kill -9 " .. get_xproperty("_NET_WM_PID(CARDINAL)"))

Preuk

Posted 2014-07-28T17:47:53.927

Reputation: 155

1

client class has pid property (at least in awesome 4.2 https://awesomewm.org/doc/api/classes/client.html) so you can simply do this:

awful.key({ modkey, "Control"   }, "c",
    function (c)
        if c.pid then
            awful.spawn("kill -9 " .. c.pid)
        end
    end
)

ch1p

Posted 2014-07-28T17:47:53.927

Reputation: 111