fix config saving issue by moving writes to singleton
This commit is contained in:
parent
6a038fc7dd
commit
0a80d099bc
38
Colors.qml
38
Colors.qml
@ -5,25 +5,25 @@ import Quickshell
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: customColors
|
id: customColors
|
||||||
// Core Backgrounds
|
// Core Backgrounds
|
||||||
readonly property color background: "#1D2021"
|
readonly property color background: "#1A1B26"
|
||||||
readonly property color foreground: "#D5C4A1"
|
readonly property color foreground: "#C0CAF5"
|
||||||
readonly property color cursor: "#D5C4A1"
|
readonly property color cursor: "#C0CAF5"
|
||||||
|
|
||||||
// The 16 Colors of the Apocalypse
|
// The 16 Colors of the Apocalypse
|
||||||
readonly property color color0: "#1D2021"
|
readonly property color color0: "#414868"
|
||||||
readonly property color color1: "#FB4934"
|
readonly property color color1: "#F7768E"
|
||||||
readonly property color color2: "#B8BB26"
|
readonly property color color2: "#9ECE6A"
|
||||||
readonly property color color3: "#FABD2F"
|
readonly property color color3: "#E0AF68"
|
||||||
readonly property color color4: "#83A598"
|
readonly property color color4: "#7AA2F7"
|
||||||
readonly property color color5: "#D3869B"
|
readonly property color color5: "#BB9AF7"
|
||||||
readonly property color color6: "#8EC07C"
|
readonly property color color6: "#7DCFFF"
|
||||||
readonly property color color7: "#D5C4A1"
|
readonly property color color7: "#A9B1D6"
|
||||||
readonly property color color8: "#665C54"
|
readonly property color color8: "#414868"
|
||||||
readonly property color color9: "#FB4934"
|
readonly property color color9: "#F7768E"
|
||||||
readonly property color color10: "#B8BB26"
|
readonly property color color10: "#9ECE6A"
|
||||||
readonly property color color11: "#FABD2F"
|
readonly property color color11: "#E0AF68"
|
||||||
readonly property color color12: "#83A598"
|
readonly property color color12: "#7AA2F7"
|
||||||
readonly property color color13: "#D3869B"
|
readonly property color color13: "#BB9AF7"
|
||||||
readonly property color color14: "#8EC07C"
|
readonly property color color14: "#7DCFFF"
|
||||||
readonly property color color15: "#FBF1C7"
|
readonly property color color15: "#C0CAF5"
|
||||||
}
|
}
|
||||||
|
|||||||
6
config.json
Normal file
6
config.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"currentWall": "file:///home/lucy/.walls/faris.jpg",
|
||||||
|
"font": "MonaSpiceXe Nerd Font Propo",
|
||||||
|
"fontSize": 13,
|
||||||
|
"wallDir": "/home/lucy/.walls/"
|
||||||
|
}
|
||||||
@ -29,11 +29,11 @@ Item {
|
|||||||
function getVolumeIcon() {
|
function getVolumeIcon() {
|
||||||
// Safety check: if Pipewire is dead or sink is missing
|
// Safety check: if Pipewire is dead or sink is missing
|
||||||
if (!sink)
|
if (!sink)
|
||||||
return "volume_mute";
|
return "volume_off";
|
||||||
|
|
||||||
// If muted, show the hush icon
|
// If muted, show the hush icon
|
||||||
if (sink.audio.muted)
|
if (sink.audio.muted)
|
||||||
return "volume_mute";
|
return "volume_off";
|
||||||
|
|
||||||
// Volume is usually 0.0 to 1.0 (0% to 100%)
|
// Volume is usually 0.0 to 1.0 (0% to 100%)
|
||||||
const vol = sink.audio.volume;
|
const vol = sink.audio.volume;
|
||||||
|
|||||||
@ -1,30 +1,32 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
property alias currentWall: jsonAdapter.currentWall
|
||||||
|
property alias font: jsonAdapter.font
|
||||||
|
property alias fontSize: jsonAdapter.fontSize
|
||||||
|
property alias wallDir: jsonAdapter.wallDir
|
||||||
FileView {
|
FileView {
|
||||||
id: settingsView
|
id: settingsView
|
||||||
path: "/home/lucy/.cache/quickshell_settings.json"
|
path: "/home/lucy/.config/quickshell/modules/settings/config.json"
|
||||||
|
|
||||||
watchChanges: true
|
watchChanges: true
|
||||||
onAdapterUpdated: writeAdapter()
|
onAdapterChanged: reload()
|
||||||
|
onAdapterUpdated: reload()
|
||||||
|
|
||||||
adapter: JsonAdapter {
|
adapter: JsonAdapter {
|
||||||
id: jsonAdapter
|
id: jsonAdapter
|
||||||
property string currentWall: ""
|
property string currentWall: ""
|
||||||
property string wallDir: "/home/lucy/.walls/"
|
property string wallDir: "/home/lucy/.walls/"
|
||||||
property string font: "CommitMono Nerd Font Propo"
|
property string font: "MonaSpiceXe Nerd Font Propo"
|
||||||
property real fontSize: 12
|
property real fontSize: 13
|
||||||
}
|
}
|
||||||
onCurrentWallChanged: writeAdapter()
|
}
|
||||||
onWallDirChanged: writeAdapter()
|
onCurrentWallChanged: settingsView.writeAdapter()
|
||||||
onFontChanged: writeAdapter()
|
onWallDirChanged: settingsView.writeAdapter()
|
||||||
onFontSizeChanged: writeAdapter()
|
onFontChanged: settingsView.writeAdapter()
|
||||||
|
onFontSizeChanged: settingsView.writeAdapter()
|
||||||
property alias currentWall: jsonAdapter.currentWall
|
|
||||||
property alias font: jsonAdapter.font
|
|
||||||
property alias fontSize: jsonAdapter.fontSize
|
|
||||||
property alias wallDir: jsonAdapter.wallDir
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
modules/settings/config.json
Normal file
6
modules/settings/config.json
Normal 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/"
|
||||||
|
}
|
||||||
@ -8,8 +8,9 @@ import "."
|
|||||||
WlrLayershell {
|
WlrLayershell {
|
||||||
id: overlayRoot
|
id: overlayRoot
|
||||||
required property var modelData
|
required property var modelData
|
||||||
property var padding: 5
|
property var padding: 2
|
||||||
property var rounding: 20
|
property var rounding: 15
|
||||||
|
property var hyprgaps: 15
|
||||||
onPaddingChanged: {
|
onPaddingChanged: {
|
||||||
hyprGaps.exec(hyprGaps.command);
|
hyprGaps.exec(hyprGaps.command);
|
||||||
console.log(hyprGaps.command);
|
console.log(hyprGaps.command);
|
||||||
@ -19,8 +20,8 @@ WlrLayershell {
|
|||||||
id: hyprGaps
|
id: hyprGaps
|
||||||
running: true
|
running: true
|
||||||
property bool isZero: overlayRoot.padding === 0
|
property bool isZero: overlayRoot.padding === 0
|
||||||
property var top: isZero ? 10 : overlayRoot.padding * 2
|
property var top: isZero ? 10 : overlayRoot.padding * 2 + overlayRoot.hyprgaps
|
||||||
property var sides: overlayRoot.padding + top
|
property var sides: overlayRoot.padding + overlayRoot.hyprgaps
|
||||||
property var gaps: top + "," + sides + "," + sides + "," + sides
|
property var gaps: top + "," + sides + "," + sides + "," + sides
|
||||||
command: ["hyprctl", "keyword", "general:gaps_out", gaps]
|
command: ["hyprctl", "keyword", "general:gaps_out", gaps]
|
||||||
onStarted: console.log("set gaps to ", gaps)
|
onStarted: console.log("set gaps to ", gaps)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user