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
|
custom_palette=true
|
||||||
icon_theme=Papirus-Dark
|
icon_theme=Papirus-Dark
|
||||||
style=Fusion
|
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
|
model: Quickshell.screens
|
||||||
|
|
||||||
readonly property bool isGerman: Qt.locale().name.startsWith("de")
|
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 logoutLabel: isGerman ? "Abmelden" : "Logout"
|
||||||
readonly property string restartLabel: isGerman ? "Neustart" : "Restart"
|
readonly property string restartLabel: isGerman ? "Neustart" : "Restart"
|
||||||
readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown"
|
readonly property string shutdownLabel: isGerman ? "Herunterfahren" : "Shutdown"
|
||||||
@@ -210,7 +212,7 @@ Variants {
|
|||||||
sourceComponent: Item {
|
sourceComponent: Item {
|
||||||
Process {
|
Process {
|
||||||
id: themeDump
|
id: themeDump
|
||||||
command: ["python3", "/home/nico/.config/theme/render.py", "--dump"]
|
command: ["python3", root.themeDir + "/render.py", "--dump"]
|
||||||
stdout: StdioCollector { id: themeDumpCollector }
|
stdout: StdioCollector { id: themeDumpCollector }
|
||||||
onExited: {
|
onExited: {
|
||||||
try {
|
try {
|
||||||
@@ -308,7 +310,7 @@ Variants {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: statsProc
|
id: statsProc
|
||||||
command: ["bash", "/home/nico/.config/quickshell/default/scripts/stats.sh"]
|
command: ["bash", root.scriptsDir + "/stats.sh"]
|
||||||
stdout: StdioCollector { id: statsCollector }
|
stdout: StdioCollector { id: statsCollector }
|
||||||
onExited: {
|
onExited: {
|
||||||
var p = statsCollector.text.trim().split("|")
|
var p = statsCollector.text.trim().split("|")
|
||||||
@@ -397,7 +399,7 @@ Variants {
|
|||||||
// ---- notification panel (mako history minus what was marked read) ----
|
// ---- notification panel (mako history minus what was marked read) ----
|
||||||
Process {
|
Process {
|
||||||
id: notifProc
|
id: notifProc
|
||||||
command: ["python3", "/home/nico/.config/quickshell/default/scripts/notifs.py"]
|
command: ["python3", root.scriptsDir + "/notifs.py"]
|
||||||
stdout: StdioCollector { id: notifCollector }
|
stdout: StdioCollector { id: notifCollector }
|
||||||
onExited: {
|
onExited: {
|
||||||
try { bar.notifList = JSON.parse(notifCollector.text) } catch (e) {}
|
try { bar.notifList = JSON.parse(notifCollector.text) } catch (e) {}
|
||||||
@@ -413,7 +415,7 @@ Variants {
|
|||||||
var gone = {}
|
var gone = {}
|
||||||
keys.forEach(function (k) { gone[k] = true })
|
keys.forEach(function (k) { gone[k] = true })
|
||||||
notifList = notifList.filter(function (n) { return !gone[n.key] })
|
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
|
notifReadProc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +479,7 @@ Variants {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: volumeProc
|
id: volumeProc
|
||||||
command: ["bash", "/home/nico/.config/quickshell/default/scripts/volume.sh"]
|
command: ["bash", root.scriptsDir + "/volume.sh"]
|
||||||
stdout: StdioCollector { id: volumeCollector }
|
stdout: StdioCollector { id: volumeCollector }
|
||||||
onExited: {
|
onExited: {
|
||||||
var parts = volumeCollector.text.trim().split("|")
|
var parts = volumeCollector.text.trim().split("|")
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ PanelWindow {
|
|||||||
WlrLayershell.layer: WlrLayer.Bottom
|
WlrLayershell.layer: WlrLayer.Bottom
|
||||||
|
|
||||||
readonly property bool isGerman: Qt.locale().name.startsWith("de")
|
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 wallpaperOpen: false
|
||||||
property bool colorsOpen: false
|
property bool colorsOpen: false
|
||||||
|
|||||||
@@ -46,9 +46,16 @@ def hex_to_rgb(hex_color):
|
|||||||
def substitute(text, colors):
|
def substitute(text, colors):
|
||||||
def repl(m):
|
def repl(m):
|
||||||
key, fmt, arg = m.group(1), m.group(2), m.group(3)
|
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")
|
sys.exit(f"render.py: unknown color key '{key}' in template")
|
||||||
value = colors[key]
|
else:
|
||||||
|
value = colors[key]
|
||||||
if fmt is None:
|
if fmt is None:
|
||||||
return str(value)
|
return str(value)
|
||||||
if not isinstance(value, str):
|
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