Automatically release the mouse for x11, when breakpoint is hit

This commit is contained in:
Jupeyy 2023-08-26 12:46:06 +02:00
parent 6b6ee21338
commit 87743bd412
3 changed files with 19 additions and 0 deletions

View file

@ -10,5 +10,8 @@ Optional:
- mold (linker), needs to be in PATH
- ninja
Linux (x11):
- xdotool, for automatic mouse release
Inside vscode press `Ctrl+Shift+P` and type `Scan for kits`, press enter.
Now press press `Ctrl+Shift+P` and type `Select a kit`, choose one with `[DDNet]` as prefix for best defaults.

View file

@ -79,6 +79,7 @@
// https://aur.archlinux.org/packages/clang-format-static-bin
"clang-format.executable": "clang-format-10",
"lldb.launch.expressions": "native",
"lldb.launch.initCommands": ["target stop-hook add --one-liner \"command script import ${workspaceFolder}/other/vscode/lldbinit.py\""],
"editor.defaultFormatter": "xaver.clang-format",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",

15
other/vscode/lldbinit.py Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/python
import os
import shutil
# make sure to have the x11 package xdotool installed on your system
def check_global_executable_exists(executable_name):
return shutil.which(executable_name) is not None
def is_x11_session():
return "DISPLAY" in os.environ and "WAYLAND_DISPLAY" not in os.environ
if is_x11_session() and check_global_executable_exists("xdotool"):
print("Breakpoint hit, releasing mouse!")
os.system("setxkbmap -option grab:break_actions")
os.system("xdotool key XF86Ungrab")