add(debug) vscode debug config

This commit is contained in:
Aire-One 2021-11-29 18:56:22 +01:00
parent a267fc99ab
commit acd4f3e924
3 changed files with 40 additions and 11 deletions

10
.vscode/launch.json vendored
View File

@ -1,7 +1,4 @@
{ {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
@ -14,8 +11,9 @@
"args": [ "args": [
"/usr/bin/Xephyr", "/usr/bin/Xephyr",
"/usr/bin/awesome", "/usr/bin/awesome",
"${workspaceFolder}/init.lua", "${workspaceFolder}/init.lua"
] ],
"postDebugTask": "Terminate All Tasks"
} }
] ]
} }

19
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Terminate All Tasks",
"command": "${workspaceFolder}/start-xephyr.sh stop",
"type": "shell",
"problemMatcher": []
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
}

View File

@ -1,21 +1,33 @@
#!/usr/bin/env sh #!/usr/bin/env sh
killXephyr() {
kill "$(pgrep Xephyr)" >/dev/null 2>&1
}
trap killXephyr EXIT
if [ "$1" = "stop" ]; then
killXephyr
exit 0
fi;
xephyr=$1 xephyr=$1
awesome=$2 awesome=$2
rc_file=$3 rc_file=$3
# Check for the first free $DISPLAY # Check for the first free display
for ((i=1;;i++)); do for i in $(seq 1 10); do
if [[ ! -f "/tmp/.X${i}-lock" ]]; then if [ ! -f "/tmp/.X${i}-lock" ]; then
D=$i; D=$i;
break; break;
fi; fi;
done done
# Start Xephyr # Start Xephyr
$xephyr :$D -name xephyr_$D -ac -br -noreset -screen 1600x900 >/dev/null 2>&1 & $xephyr :"$D" -name xephyr_"$D" -ac -br -noreset -screen 1600x900 >/dev/null 2>&1 &
sleep 1 sleep 1
# Start Awesome # Start Awesome
DISPLAY=:$D.0 $awesome \ DISPLAY=:$D.0 $awesome \
--config $rc_file --config "$rc_file"