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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityWhat 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)"))
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
)