Add mouse ungrab functionality

This commit is contained in:
2026-06-09 15:46:43 -04:00
parent 8560eff3ac
commit 0d3f17c1aa
3 changed files with 44 additions and 0 deletions

40
bin/test-mouse-grab.py Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env python3
import tkinter as tk
def release_and_exit(event=None):
try:
root.grab_release()
except tk.TclError:
# The XKB grab-breaking action may already have released the grab.
pass
root.destroy()
def grab_mouse():
root.grab_set_global()
status.config(text="Mouse grabbed. Test the XKB ungrab action.")
grab_button.config(state=tk.DISABLED)
root = tk.Tk()
root.title("Mouse Grab Test")
root.geometry("420x140")
root.protocol("WM_DELETE_WINDOW", release_and_exit)
root.bind("<Escape>", release_and_exit)
status = tk.Label(
root,
text="Click the button to globally grab the mouse.",
padx=20,
pady=20,
)
status.pack()
grab_button = tk.Button(root, text="Grab mouse", command=grab_mouse)
grab_button.pack()
tk.Label(root, text="Press Escape to release the grab and exit.").pack(pady=10)
root.mainloop()

View File

@@ -14,6 +14,9 @@ trust_level = "trusted"
[projects."/home/jyelon/jbashrc"]
trust_level = "trusted"
[projects."/home/jyelon"]
trust_level = "trusted"
[notice.model_migrations]
"gpt-5.3-codex" = "gpt-5.4"
"gpt-5.4" = "gpt-5.5"

View File

@@ -48,3 +48,4 @@ install("kwalletd/kdewallet.kwl.blank", "~/.local/share/kwalletd/kdewallet.kwl.b
install("kwalletd/kdewallet.salt.blank", "~/.local/share/kwalletd/kdewallet.salt.blank")
install("ssh/config", "~/.ssh/config")
install("bin/clean-vscode.sh", "~/bin/clean-vscode.sh")
install("bin/test-mouse-grab.py", "~/bin/test-mouse-grab.py")