From 57724c340d44f7f2e9575b14af4f34cb57a224f4 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Mon, 4 Oct 2021 20:32:34 +0200 Subject: [PATCH] add(debug) lld debugger with Xephyr --- .vscode/launch.json | 21 +++++++++++++++++++++ init.lua | 4 ++++ start-xephyr.sh | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 .vscode/launch.json create mode 100755 start-xephyr.sh diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..35e23f8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // 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", + "configurations": [ + { + "type": "lua-local", + "request": "launch", + "name": "Debug with Xephyr", + "program": { + "command": "${workspaceFolder}/start-xephyr.sh" + }, + "args": [ + "/usr/bin/Xephyr", + "/usr/bin/awesome", + "${workspaceFolder}/init.lua", + ] + } + ] +} \ No newline at end of file diff --git a/init.lua b/init.lua index 8ade968..26a3366 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,9 @@ -- awesome_mode: api-level=4:screen=on +if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then + require("lldebugger").start() +end + -- If LuaRocks is installed, make sure that packages installed through it are -- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, 'luarocks.loader') diff --git a/start-xephyr.sh b/start-xephyr.sh new file mode 100755 index 0000000..e01f15b --- /dev/null +++ b/start-xephyr.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +xephyr=$1 +awesome=$2 +rc_file=$3 + +# Check for the first free $DISPLAY +for ((i=1;;i++)); do + if [[ ! -f "/tmp/.X${i}-lock" ]]; then + D=$i; + break; + fi; +done + +# Start Xephyr +$xephyr :$D -name xephyr_$D -ac -br -noreset -screen 1600x900 >/dev/null 2>&1 & +sleep 1 + +# Start Awesome +DISPLAY=:$D.0 $awesome \ + --config $rc_file \ No newline at end of file