How to release keyboard and mouse from grab by a hung unkillable app?
Suppose I have an X application, which grabs keyboard and mouse as its normal mode of operation (e.g. QEMU), but which, due to a bug somewhere, hangs really hard (e.g. gets stuck in Disk sleep). Normally I'd kill an app using kill(1)
from a remote terminal, but if the app is in Disk sleep mode, it can't really be killed. I could kill this app's connection to X server by the xkill
utility, but this time I can't do this because mouse is grabbed, so xkill
will fail to run.
So, how do I release my keyboard and mouse from grab by an X client, if I'm willing to sacrifice this client, but am unable to kill it by the OS means?
x11 keyboard
add a comment |
Suppose I have an X application, which grabs keyboard and mouse as its normal mode of operation (e.g. QEMU), but which, due to a bug somewhere, hangs really hard (e.g. gets stuck in Disk sleep). Normally I'd kill an app using kill(1)
from a remote terminal, but if the app is in Disk sleep mode, it can't really be killed. I could kill this app's connection to X server by the xkill
utility, but this time I can't do this because mouse is grabbed, so xkill
will fail to run.
So, how do I release my keyboard and mouse from grab by an X client, if I'm willing to sacrifice this client, but am unable to kill it by the OS means?
x11 keyboard
add a comment |
Suppose I have an X application, which grabs keyboard and mouse as its normal mode of operation (e.g. QEMU), but which, due to a bug somewhere, hangs really hard (e.g. gets stuck in Disk sleep). Normally I'd kill an app using kill(1)
from a remote terminal, but if the app is in Disk sleep mode, it can't really be killed. I could kill this app's connection to X server by the xkill
utility, but this time I can't do this because mouse is grabbed, so xkill
will fail to run.
So, how do I release my keyboard and mouse from grab by an X client, if I'm willing to sacrifice this client, but am unable to kill it by the OS means?
x11 keyboard
Suppose I have an X application, which grabs keyboard and mouse as its normal mode of operation (e.g. QEMU), but which, due to a bug somewhere, hangs really hard (e.g. gets stuck in Disk sleep). Normally I'd kill an app using kill(1)
from a remote terminal, but if the app is in Disk sleep mode, it can't really be killed. I could kill this app's connection to X server by the xkill
utility, but this time I can't do this because mouse is grabbed, so xkill
will fail to run.
So, how do I release my keyboard and mouse from grab by an X client, if I'm willing to sacrifice this client, but am unable to kill it by the OS means?
x11 keyboard
x11 keyboard
asked 50 mins ago
RuslanRuslan
1,1631123
1,1631123
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Although the most well-known use mode of xkill
is "click to kill", there's an option -id
, which can be supplied with Window Id of the client you want to disconnect from X server. Then, if you can access your X session from a remote terminal/VT, you can use xprop
or some other means to get the Id, and pass it to xkill
.
Suppose that current active window belongs to the X client who grabbed the keys&mouse. Then the following will kill this client's connection to the X server and thus release keyboard and mouse from the grab:
winid=$(xprop -root _NET_ACTIVE_WINDOW | cut -d# -f2)
xkill -id $winid
This actually worked for me when I tried to get rid of QEMU stuck in Disk sleep.
add a comment |
Another option is to use the "ungrab" function of the X server:
On modern-ish X.org installations, there is an
XF86Ungrab
keysym, which causes the server to release all active pointer or keyboard grabs.
On some systems, the
XF86Ungrab
keysym is bound to the key combination Ctrl+Alt+Keypad /. (However this possibility is often turned off because it could allow bypassing a screensaver)
Or force it via commandline:
setxkbmap -option grab:break_actions
xdotool key XF86Ungrab
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494219%2fhow-to-release-keyboard-and-mouse-from-grab-by-a-hung-unkillable-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Although the most well-known use mode of xkill
is "click to kill", there's an option -id
, which can be supplied with Window Id of the client you want to disconnect from X server. Then, if you can access your X session from a remote terminal/VT, you can use xprop
or some other means to get the Id, and pass it to xkill
.
Suppose that current active window belongs to the X client who grabbed the keys&mouse. Then the following will kill this client's connection to the X server and thus release keyboard and mouse from the grab:
winid=$(xprop -root _NET_ACTIVE_WINDOW | cut -d# -f2)
xkill -id $winid
This actually worked for me when I tried to get rid of QEMU stuck in Disk sleep.
add a comment |
Although the most well-known use mode of xkill
is "click to kill", there's an option -id
, which can be supplied with Window Id of the client you want to disconnect from X server. Then, if you can access your X session from a remote terminal/VT, you can use xprop
or some other means to get the Id, and pass it to xkill
.
Suppose that current active window belongs to the X client who grabbed the keys&mouse. Then the following will kill this client's connection to the X server and thus release keyboard and mouse from the grab:
winid=$(xprop -root _NET_ACTIVE_WINDOW | cut -d# -f2)
xkill -id $winid
This actually worked for me when I tried to get rid of QEMU stuck in Disk sleep.
add a comment |
Although the most well-known use mode of xkill
is "click to kill", there's an option -id
, which can be supplied with Window Id of the client you want to disconnect from X server. Then, if you can access your X session from a remote terminal/VT, you can use xprop
or some other means to get the Id, and pass it to xkill
.
Suppose that current active window belongs to the X client who grabbed the keys&mouse. Then the following will kill this client's connection to the X server and thus release keyboard and mouse from the grab:
winid=$(xprop -root _NET_ACTIVE_WINDOW | cut -d# -f2)
xkill -id $winid
This actually worked for me when I tried to get rid of QEMU stuck in Disk sleep.
Although the most well-known use mode of xkill
is "click to kill", there's an option -id
, which can be supplied with Window Id of the client you want to disconnect from X server. Then, if you can access your X session from a remote terminal/VT, you can use xprop
or some other means to get the Id, and pass it to xkill
.
Suppose that current active window belongs to the X client who grabbed the keys&mouse. Then the following will kill this client's connection to the X server and thus release keyboard and mouse from the grab:
winid=$(xprop -root _NET_ACTIVE_WINDOW | cut -d# -f2)
xkill -id $winid
This actually worked for me when I tried to get rid of QEMU stuck in Disk sleep.
answered 50 mins ago
RuslanRuslan
1,1631123
1,1631123
add a comment |
add a comment |
Another option is to use the "ungrab" function of the X server:
On modern-ish X.org installations, there is an
XF86Ungrab
keysym, which causes the server to release all active pointer or keyboard grabs.
On some systems, the
XF86Ungrab
keysym is bound to the key combination Ctrl+Alt+Keypad /. (However this possibility is often turned off because it could allow bypassing a screensaver)
Or force it via commandline:
setxkbmap -option grab:break_actions
xdotool key XF86Ungrab
add a comment |
Another option is to use the "ungrab" function of the X server:
On modern-ish X.org installations, there is an
XF86Ungrab
keysym, which causes the server to release all active pointer or keyboard grabs.
On some systems, the
XF86Ungrab
keysym is bound to the key combination Ctrl+Alt+Keypad /. (However this possibility is often turned off because it could allow bypassing a screensaver)
Or force it via commandline:
setxkbmap -option grab:break_actions
xdotool key XF86Ungrab
add a comment |
Another option is to use the "ungrab" function of the X server:
On modern-ish X.org installations, there is an
XF86Ungrab
keysym, which causes the server to release all active pointer or keyboard grabs.
On some systems, the
XF86Ungrab
keysym is bound to the key combination Ctrl+Alt+Keypad /. (However this possibility is often turned off because it could allow bypassing a screensaver)
Or force it via commandline:
setxkbmap -option grab:break_actions
xdotool key XF86Ungrab
Another option is to use the "ungrab" function of the X server:
On modern-ish X.org installations, there is an
XF86Ungrab
keysym, which causes the server to release all active pointer or keyboard grabs.
On some systems, the
XF86Ungrab
keysym is bound to the key combination Ctrl+Alt+Keypad /. (However this possibility is often turned off because it could allow bypassing a screensaver)
Or force it via commandline:
setxkbmap -option grab:break_actions
xdotool key XF86Ungrab
answered 16 mins ago
dirktdirkt
16.7k21336
16.7k21336
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494219%2fhow-to-release-keyboard-and-mouse-from-grab-by-a-hung-unkillable-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown