fix config saving issue by moving writes to singleton

This commit is contained in:
lucy 2026-01-05 15:22:29 +01:00
parent 6a038fc7dd
commit 0a80d099bc
6 changed files with 60 additions and 45 deletions

View File

@ -5,25 +5,25 @@ import Quickshell
Singleton {
id: customColors
// Core Backgrounds
readonly property color background: "#1D2021"
readonly property color foreground: "#D5C4A1"
readonly property color cursor: "#D5C4A1"
readonly property color background: "#1A1B26"
readonly property color foreground: "#C0CAF5"
readonly property color cursor: "#C0CAF5"
// The 16 Colors of the Apocalypse
readonly property color color0: "#1D2021"
readonly property color color1: "#FB4934"
readonly property color color2: "#B8BB26"
readonly property color color3: "#FABD2F"
readonly property color color4: "#83A598"
readonly property color color5: "#D3869B"
readonly property color color6: "#8EC07C"
readonly property color color7: "#D5C4A1"
readonly property color color8: "#665C54"
readonly property color color9: "#FB4934"
readonly property color color10: "#B8BB26"
readonly property color color11: "#FABD2F"
readonly property color color12: "#83A598"
readonly property color color13: "#D3869B"
readonly property color color14: "#8EC07C"
readonly property color color15: "#FBF1C7"
readonly property color color0: "#414868"
readonly property color color1: "#F7768E"
readonly property color color2: "#9ECE6A"
readonly property color color3: "#E0AF68"
readonly property color color4: "#7AA2F7"
readonly property color color5: "#BB9AF7"
readonly property color color6: "#7DCFFF"
readonly property color color7: "#A9B1D6"
readonly property color color8: "#414868"
readonly property color color9: "#F7768E"
readonly property color color10: "#9ECE6A"
readonly property color color11: "#E0AF68"
readonly property color color12: "#7AA2F7"
readonly property color color13: "#BB9AF7"
readonly property color color14: "#7DCFFF"
readonly property color color15: "#C0CAF5"
}

6
config.json Normal file
View File

@ -0,0 +1,6 @@
{
"currentWall": "file:///home/lucy/.walls/faris.jpg",
"font": "MonaSpiceXe Nerd Font Propo",
"fontSize": 13,
"wallDir": "/home/lucy/.walls/"
}

View File

@ -29,11 +29,11 @@ Item {
function getVolumeIcon() {
// Safety check: if Pipewire is dead or sink is missing
if (!sink)
return "volume_mute";
return "volume_off";
// If muted, show the hush icon
if (sink.audio.muted)
return "volume_mute";
return "volume_off";
// Volume is usually 0.0 to 1.0 (0% to 100%)
const vol = sink.audio.volume;

View File

@ -1,30 +1,32 @@
pragma ComponentBehavior: Bound
pragma Singleton
import QtQuick
import Quickshell.Io
import Quickshell
import Quickshell.Io
FileView {
id: settingsView
path: "/home/lucy/.cache/quickshell_settings.json"
watchChanges: true
onAdapterUpdated: writeAdapter()
adapter: JsonAdapter {
id: jsonAdapter
property string currentWall: ""
property string wallDir: "/home/lucy/.walls/"
property string font: "CommitMono Nerd Font Propo"
property real fontSize: 12
}
onCurrentWallChanged: writeAdapter()
onWallDirChanged: writeAdapter()
onFontChanged: writeAdapter()
onFontSizeChanged: writeAdapter()
Singleton {
property alias currentWall: jsonAdapter.currentWall
property alias font: jsonAdapter.font
property alias fontSize: jsonAdapter.fontSize
property alias wallDir: jsonAdapter.wallDir
FileView {
id: settingsView
path: "/home/lucy/.config/quickshell/modules/settings/config.json"
watchChanges: true
onAdapterChanged: reload()
onAdapterUpdated: reload()
adapter: JsonAdapter {
id: jsonAdapter
property string currentWall: ""
property string wallDir: "/home/lucy/.walls/"
property string font: "MonaSpiceXe Nerd Font Propo"
property real fontSize: 13
}
}
onCurrentWallChanged: settingsView.writeAdapter()
onWallDirChanged: settingsView.writeAdapter()
onFontChanged: settingsView.writeAdapter()
onFontSizeChanged: settingsView.writeAdapter()
}

View File

@ -0,0 +1,6 @@
{
"currentWall": "file:///home/lucy/.walls/gentoo-abducted-1680x1050.png",
"font": "MonaSpiceXe Nerd Font Propo",
"fontSize": 13,
"wallDir": "/home/lucy/.walls/"
}

View File

@ -8,8 +8,9 @@ import "."
WlrLayershell {
id: overlayRoot
required property var modelData
property var padding: 5
property var rounding: 20
property var padding: 2
property var rounding: 15
property var hyprgaps: 15
onPaddingChanged: {
hyprGaps.exec(hyprGaps.command);
console.log(hyprGaps.command);
@ -19,8 +20,8 @@ WlrLayershell {
id: hyprGaps
running: true
property bool isZero: overlayRoot.padding === 0
property var top: isZero ? 10 : overlayRoot.padding * 2
property var sides: overlayRoot.padding + top
property var top: isZero ? 10 : overlayRoot.padding * 2 + overlayRoot.hyprgaps
property var sides: overlayRoot.padding + overlayRoot.hyprgaps
property var gaps: top + "," + sides + "," + sides + "," + sides
command: ["hyprctl", "keyword", "general:gaps_out", gaps]
onStarted: console.log("set gaps to ", gaps)