diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 09:41:09 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 09:41:09 +0200 |
| commit | fede37b1e1e97127f0b94e964214d3fd5182381e (patch) | |
| tree | 6986630020a0486b4007bdf00ecff890dafef193 | |
| parent | 4985439eb2feb15757c3c8056cbeb5ae2abe1442 (diff) | |
| download | conky-theme-udt-fede37b1e1e97127f0b94e964214d3fd5182381e.tar.gz conky-theme-udt-fede37b1e1e97127f0b94e964214d3fd5182381e.zip | |
feat: add restart.sh
Editing the layout table or a widget needs a conky restart and nothing
else, since the Lua is symlinked and conky never rereads its config.
That was three commands to remember, one of them the hyprctl dispatch
form that keeps the dashboard from popping open over the screen.
The script syntax-checks before killing anything and refuses to restart
on a Lua error, naming the file and line. Without that the first sign of
a typo is a blank workspace with no message on any stream, which is the
single most confusing failure mode this project has.
Falls back to a plain exec where Hyprland is not running, and says what
to run by hand if conky fails to come up.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| -rw-r--r-- | README.md | 16 | ||||
| -rwxr-xr-x | restart.sh | 46 |
2 files changed, 58 insertions, 4 deletions
@@ -129,12 +129,20 @@ cheap. ## Development -Run it in the foreground to see Lua output, which is the only debugging channel: +After editing `dashboard.lua` or a widget: - conky -c ~/.config/conky/conky.conf + ./restart.sh -Conky has no hot-reload, so kill any running instance first (`pkill -x conky`) -rather than ending up with two. +Conky never rereads its config and the Lua is symlinked into `~/.config/conky/`, +so a restart is the whole update path. The script syntax-checks first and +refuses to restart on a Lua error, since the alternative is a blank screen with +no message. Only a change to `conky.conf.in` or the palette needs UDT's +`install.sh` to re-render first. + +To see Lua output, which is the only debugging channel, run it in the +foreground instead: + + pkill -x conky; conky -c ~/.config/conky/conky.conf Run the parser and layout checks: diff --git a/restart.sh b/restart.sh new file mode 100755 index 0000000..f99ca98 --- /dev/null +++ b/restart.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Restart the dashboard after editing dashboard.lua or a widget. +# +# Conky never rereads its config, and the Lua is symlinked into +# ~/.config/conky/, so a restart is the whole update path. Only a change to +# conky.conf.in or the palette needs UDT's install.sh to re-render first. +# +# Relaunched through hyprctl with `[workspace special:dash silent]`: the +# dashboard's window rule puts it on that workspace but cannot suppress the +# switch to it, so a plain exec throws the dashboard up over whatever is on +# screen. + +set -u + +CONF="$HOME/.config/conky/conky.conf" + +if [ ! -e "$CONF" ]; then + echo "restart: no $CONF (run ../unified-desktop-theme/install.sh first)" >&2 + exit 1 +fi + +# Syntax-check first: a Lua error is a blank screen with no message, so it is +# worth catching here rather than discovering it on the workspace. +if ! luac -p dashboard.lua lib/*.lua widgets/*.lua; then + echo "restart: Lua syntax error, not restarting" >&2 + exit 1 +fi + +pkill -x conky 2>/dev/null && sleep 0.5 + +if command -v hyprctl >/dev/null 2>&1 && [ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]; then + hyprctl dispatch \ + "hl.dsp.exec_cmd(\"[workspace special:dash silent] conky -c $CONF -d\")" \ + >/dev/null +else + (conky -c "$CONF" -d >/dev/null 2>&1 &) +fi + +sleep 1 +if pgrep -x conky >/dev/null; then + echo "dashboard restarted" +else + echo "restart: conky did not come up; run it in the foreground to see why:" >&2 + echo " conky -c $CONF" >&2 + exit 1 +fi |
