Fix hardcoded /home/nico paths breaking theming for other users
ThemeWidget.qml's themeDir and five paths in Bar.qml (theme dump,
stats, notifications, volume) were literal "/home/nico/..." strings.
Harmless for a single-user machine, but a second user with their own
clone of this repo would have their bar and theme widget silently
pointed at this user's files instead of their own - which they can't
even read, since $HOME is 700. Now resolved per-user via
Quickshell.env("HOME") / Quickshell.shellDir.
qt6ct/qt6ct.conf (tracked in this repo) had the same problem in its
color_scheme_path, baked in from whoever last edited it rather than
generated - now a proper render.py template using a new {home}
placeholder (not a palette color, always available) instead of one of
the existing color substitutions, since this is the first template
that needs an absolute path rather than a color value.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
This commit is contained in:
@@ -3,6 +3,3 @@ color_scheme_path=/home/nico/.config/qt6ct/colors/aether-rice.conf
|
||||
custom_palette=true
|
||||
icon_theme=Papirus-Dark
|
||||
style=Fusion
|
||||
|
||||
[SettingsWindow]
|
||||
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\n\0\0\0\0\0\0\0\r4\0\0\x1\xe8\0\0\n\0\0\0\0\0\0\0\v\x90\0\0\x1\xe8\0\0\0\0\x2\0\0\0\x6\x90\0\0\n\0\0\0\0\0\0\0\r4\0\0\x1\xe8)
|
||||
|
||||
@@ -12,6 +12,8 @@ Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
readonly property bool isGerman: Qt.locale().name.startsWith("de")
|
||||
readonly property string themeDir: Quickshell.env("HOME") + "/.config/theme"
|
||||
readonly property string scriptsDir: Quickshell.shellDir + "/scripts"
|
||||
readonly property string logoutLabel: isGerman ? "Abmelden" : "Logout"
|
||||
readonly property string restartLabel: isGerman ? "Neustart" : "Restart"
|
||||
readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown"
|
||||
@@ -210,7 +212,7 @@ Variants {
|
||||
sourceComponent: Item {
|
||||
Process {
|
||||
id: themeDump
|
||||
command: ["python3", "/home/nico/.config/theme/render.py", "--dump"]
|
||||
command: ["python3", root.themeDir + "/render.py", "--dump"]
|
||||
stdout: StdioCollector { id: themeDumpCollector }
|
||||
onExited: {
|
||||
try {
|
||||
@@ -308,7 +310,7 @@ Variants {
|
||||
|
||||
Process {
|
||||
id: statsProc
|
||||
command: ["bash", "/home/nico/.config/quickshell/default/scripts/stats.sh"]
|
||||
command: ["bash", root.scriptsDir + "/stats.sh"]
|
||||
stdout: StdioCollector { id: statsCollector }
|
||||
onExited: {
|
||||
var p = statsCollector.text.trim().split("|")
|
||||
@@ -397,7 +399,7 @@ Variants {
|
||||
// ---- notification panel (mako history minus what was marked read) ----
|
||||
Process {
|
||||
id: notifProc
|
||||
command: ["python3", "/home/nico/.config/quickshell/default/scripts/notifs.py"]
|
||||
command: ["python3", root.scriptsDir + "/notifs.py"]
|
||||
stdout: StdioCollector { id: notifCollector }
|
||||
onExited: {
|
||||
try { bar.notifList = JSON.parse(notifCollector.text) } catch (e) {}
|
||||
@@ -413,7 +415,7 @@ Variants {
|
||||
var gone = {}
|
||||
keys.forEach(function (k) { gone[k] = true })
|
||||
notifList = notifList.filter(function (n) { return !gone[n.key] })
|
||||
notifReadProc.command = ["python3", "/home/nico/.config/quickshell/default/scripts/notifs.py", "read"].concat(keys)
|
||||
notifReadProc.command = ["python3", root.scriptsDir + "/notifs.py", "read"].concat(keys)
|
||||
notifReadProc.running = true
|
||||
}
|
||||
|
||||
@@ -477,7 +479,7 @@ Variants {
|
||||
|
||||
Process {
|
||||
id: volumeProc
|
||||
command: ["bash", "/home/nico/.config/quickshell/default/scripts/volume.sh"]
|
||||
command: ["bash", root.scriptsDir + "/volume.sh"]
|
||||
stdout: StdioCollector { id: volumeCollector }
|
||||
onExited: {
|
||||
var parts = volumeCollector.text.trim().split("|")
|
||||
|
||||
@@ -25,7 +25,7 @@ PanelWindow {
|
||||
WlrLayershell.layer: WlrLayer.Bottom
|
||||
|
||||
readonly property bool isGerman: Qt.locale().name.startsWith("de")
|
||||
readonly property string themeDir: "/home/nico/.config/theme"
|
||||
readonly property string themeDir: Quickshell.env("HOME") + "/.config/theme"
|
||||
|
||||
property bool wallpaperOpen: false
|
||||
property bool colorsOpen: false
|
||||
|
||||
@@ -46,9 +46,16 @@ def hex_to_rgb(hex_color):
|
||||
def substitute(text, colors):
|
||||
def repl(m):
|
||||
key, fmt, arg = m.group(1), m.group(2), m.group(3)
|
||||
if key not in colors:
|
||||
if key == "home":
|
||||
# Not a palette color - always available, for templates (qt6ct.conf) that
|
||||
# need an absolute path baked in. Without this, that path would hardcode
|
||||
# whoever last ran render.py's home directory into the template output,
|
||||
# breaking it for any other user with their own copy of this repo.
|
||||
value = os.path.expanduser("~")
|
||||
elif key not in colors:
|
||||
sys.exit(f"render.py: unknown color key '{key}' in template")
|
||||
value = colors[key]
|
||||
else:
|
||||
value = colors[key]
|
||||
if fmt is None:
|
||||
return str(value)
|
||||
if not isinstance(value, str):
|
||||
|
||||
4
theme/templates/qt6ct-conf/config.json
Normal file
4
theme/templates/qt6ct-conf/config.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"template": "qt6ct.conf",
|
||||
"destination": "~/.config/qt6ct/qt6ct.conf"
|
||||
}
|
||||
5
theme/templates/qt6ct-conf/qt6ct.conf
Normal file
5
theme/templates/qt6ct-conf/qt6ct.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
[Appearance]
|
||||
color_scheme_path={home}/.config/qt6ct/colors/aether-rice.conf
|
||||
custom_palette=true
|
||||
icon_theme=Papirus-Dark
|
||||
style=Fusion
|
||||
Reference in New Issue
Block a user