• A more elegant solution than binding to xkill and click ?


    Basically sometimes things freeze up badly and I have a mouse-binding ready to run xkill… one more click and the problem’s gone.

    Does anyone know how to skip the click ? Ctrl-Alt-scrolldown would be an awesome way to bring a window “down”.

  • Antergos’ default configuration enables the Ctrl + Alt + Backspace shortcut for killing the X server. Is it not working for you?

  • It’s not the same, but I’ve learned something new.

    But there’s probably rarely any need to restart X and everything. In case, you can’t use xkill cause the process has no window. You could bind a script hunting down the process with the highest cpu or ram usage… and use “nice -20” to make room for it ?

  • @distrohopp said:

    It’s not the same,

    What do you mean? I don’t understand why something other than Ctrl+Alt+Backspace would be needed to kill the current X server :confused:

  • @lots-0-logs : He doesn’t want to kill the server but only a process.
    @distrohopp : It’s not a normal thing to have a process hang on you… which process behaves like this? If it’s a program you use regularly you can create the script you’re mentioning… but what I’d do is change it and use another program/application.

    Cheers!

  • `Yes. True. It isn’t the norm. But I always struggled with resourses and I squeezed everything out of whatever was avialable… and sometimes edging like that means opening another tab on top of 15 others might mean tha something becomes unresponsive.

    Waiting usually doesn’t solve the problem. But it’s not just a browser issue. I remember that even on winodws years ago ctrl-alt-delete came in handy… and being prepared to bring a process down will save precious minutes.

    @lots.0.logs said:

    @distrohopp said:

    It’s not the same,

    What do you mean? I don’t understand why something other than Ctrl+Alt+Backspace would be needed to kill the current X server :confused:

    The problem is tha I usually mutitask and out of 10 applications just one missbehaves. Why resstart everything and open it all again, when you can just go after the culprit ?

  • See if this works. I remembered that Ubuntu had an applet for the panel. You would click the applet then click on the window you wanted to kill.

    http://www.omgubuntu.co.uk/2011/10/force-quit-applet-unity-launcher

    It’s just a shell script and requires zenity, which you probably have installed anyway.

  • Bringing X down as cool as that a trick that is, might also be no-no if you have some unsaved work open. Thank God for sesson-restore.

    @herbie
    I have a shortcut for bringing up xkill. Trying to hunt a tiny button just isn’t as effective. You already have Xkill installed which does exactly that same thing. Plus, I’m asking for a kill on hovering above a window, how are you going to do that with that script ?

    All I’d need is xprop to work on hover.
    xprop -hover > grep > kill $(process id)

    Googling “get pid on mouseover” will return seriously irrelevant results, such as “how to get window id by clicking on it”. I’m stuck. I’ve been searching for an hour.

    My question now comes down to this: I need to get a way to get the window id on hover.

  • I dowloaed and installed, Then, since I had removed zenity, installed zenit.
    Then I created a keyboard shortcut
    commmand: /usr/bin/forcekill.sh
    shortcut WindowsKey+Q

    When I trite to use it didn’t work. So I looked at the forcekill.sh and saw that it needed xkill.
    So I installed xorg-xkill
    Then I ran it again and a little

    skull and crossbones came up

    I clicked on a window I had open and it was closed.

    That’s it. It worked… woohoo.

    Try it.
    Nothing to lose. Just have a window open, perhaps a Terminal window, and using the shortcut I described press Windowskey+Q

  • I should mention that the skull and crossbones in MY cursor from chameleon-pearl cursor theme. Yours, as I believe you stated is an +.
    Sorry for misleading you a bit.

  • @herbie
    I appreciate your help but you didn’t read my original post.

    “Does anyone know how to skip the click ?”

    I want 0, that is zero clicks involved. I want to bring down the window the mouse floats over with a keyboard or mouse shortcut.

  • @distrohopp
    I’m going a little off here BUT, in one breath you say you want to mouse over and it will kill the application with either a keyboard shortcut or mouse.
    How the heck is a mouse over a window supposed to know to kill the window. it’s just a move…
    You’re moving the mouse, so click it.;
    Sorry to be so curt, but it does require some input from you, not a magical solutrion.

  • @herbie said:

    @distrohopp
    I’m going a little off here BUT, in one breath you say you want to mouse over and it will kill the application with either a keyboard shortcut or mouse.

    Wrong. A keyboard shortcut or a mouse-shortcut ONLY. None of those contain clicks.

    How the heck is a mouse over a window supposed to know to kill the window. it’s just a move…
    You’re moving the mouse, so click it.;
    Sorry to be so curt, but it does require some input from you, not a magical solutrion.

    It’s not a move. it’s the current position.

    There are automation programs our there that continuously supply information about what’s going on under the mouse. There must be something out there that knows the PID of the window that’s under the mouse like xprop does but without clicking. Xprop -spy is very close to this, but it monitors changes to a program, instead of the whole system. Could I use this somehow by monitoring xorg ? I guess not.

  • Ok, I spent about 20mins researching the thing you wanted and I came up with this

    edit the /usr.bin/forcekill.sh as root
    Replace the xkill line with this

    (xprop -root | sed -n ‘s/^_NET_ACTIVE_WINDOW(WINDOW): window id # //p’)|cut -d’,’ -f1|xargs xkill -id

    And it will kill the currently active window.
    I use the Windowskey+Q
    the choice is yours.
    Just make sure the window you want to kill is the current window otherwise you might kill the wrong one.
    Cheers.

  • I came up with a dirty solution by accident.

    xkill & xdotool click 1, will save me the click.

    I’m currently trying to figure out $(xdotool getmouselocation --shell) cause it returns a window number on hover. But it doesn’t look like a process id at all…/

  • Please read my post prior to yours. It works without using the mouse.

  • Oh cool. I didn’t see your reply herbie, I am struggling to get past the active window barrier as well, since like an hour now.

    xdotool getmouselocation --shell | grep WINDOW
    WINDOW=14693646
    

    This actually gives me a window number of whatever is under the mouse, wheather active or not. But I can’t use that number or I haven’t figured it out how yet…

    xdotool getwindowpid 14693646
    window 14693646 has no pid associated with it.
    

    I guess it’s a bug cause a random number will return a different message

  • (xprop -root | sed -n ‘s/^_NET_ACTIVE_WINDOW(WINDOW): window id # //p‘)|cut -d’,’ -f1|xargs xkill -id
    will solve your problem. the key to whole thing is the use of xargs, but the command prior, well, that was a new one for me.
    That line in place of the original xkill and it works perfectly.

  • @herbie

    Just make sure the window you want to kill is the current window otherwise you might kill the wrong one.

    That wouldn’t be elegant. I appreciate your time and effort very much though.

    Print the window title and pid an xterm gets focus
        xdotool search --class xterm behave %@ focus  getwindowpid
    

    I don’t know how to get rid of the xterm part. I tried 5 ways to do this already. But I know how to bring a window forward with this:

    xdotool windowactivate  $(xdotool getmouselocation --shell | grep WINDOW | cut -d= -f2)
    

    This snippet combined with yours could do the trick. While it’s not elegant coding, it does what I wanted. I bet one could do this using xdotool only. It actually has an internal windowkill command but it brought the whole system down twice. so I’m not gonna play with that except when I’m ready to shutdown. I can’t really wrap my head around xdotool’s syntax yet.

  • These are the only 2 lines in forcekill.sh

    #!/bin/sh
    (xprop -root | sed -n ‘s/^_NET_ACTIVE_WINDOW(WINDOW): window id # //p’)|cut -d’,’ -f1|xargs xkill -id

    and it works.
    If you close a Terminal it’ll complain, but really, who cares. The Terminal is dead and that is the goal anyway.

Posts 27Views 5931
Log in to reply