move theme types to Styling
This commit is contained in:
parent
823dd66719
commit
fe8261f7af
3 changed files with 51 additions and 62 deletions
|
|
@ -2,6 +2,7 @@ pragma Singleton
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -9,7 +10,7 @@ Singleton {
|
||||||
readonly property Animations animations: Animations {}
|
readonly property Animations animations: Animations {}
|
||||||
readonly property Typography typography: Typography {}
|
readonly property Typography typography: Typography {}
|
||||||
readonly property Layout layout: Layout {}
|
readonly property Layout layout: Layout {}
|
||||||
readonly property var theme: Theme.palette
|
readonly property alias theme: theme
|
||||||
readonly property Lucide lucide: Lucide {}
|
readonly property Lucide lucide: Lucide {}
|
||||||
|
|
||||||
component Animations: QtObject {
|
component Animations: QtObject {
|
||||||
|
|
@ -90,4 +91,42 @@ Singleton {
|
||||||
readonly property string triangle: "\u{E192}"
|
readonly property string triangle: "\u{E192}"
|
||||||
readonly property string triangleDashed: "\u{E642}"
|
readonly property string triangleDashed: "\u{E642}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
path: `${Paths.config}/themes/${Theme.currentTheme}.json`
|
||||||
|
watchChanges: true
|
||||||
|
onFileChanged: reload()
|
||||||
|
|
||||||
|
// when changes are made to properties in the adapter, save them
|
||||||
|
onAdapterUpdated: writeAdapter()
|
||||||
|
|
||||||
|
JsonAdapter {
|
||||||
|
id: theme
|
||||||
|
property color primary: "#605dff"
|
||||||
|
property color primarycontent: "#edf1fe"
|
||||||
|
property color secondary: "#f43098"
|
||||||
|
property color secondarycontent: "#f9e4f0"
|
||||||
|
property color accent: "#00d3bb"
|
||||||
|
property color accentcontent: "#084d49"
|
||||||
|
property color neutral: "#09090b"
|
||||||
|
property color neutralcontent: "#e4e4e7"
|
||||||
|
property color base100: "#1d232a"
|
||||||
|
property color base200: "#191e24"
|
||||||
|
property color base300: "#15191e"
|
||||||
|
property color basecontent: "#ecf9ff"
|
||||||
|
property color info: "#00bafe"
|
||||||
|
property color infocontent: "#042e49"
|
||||||
|
property color success: "#00d390"
|
||||||
|
property color successcontent: "#004c39"
|
||||||
|
property color warning: "#fcb700"
|
||||||
|
property color warningcontent: "#793205"
|
||||||
|
property color error: "#ff627d"
|
||||||
|
property color errorcontent: "#4d0218"
|
||||||
|
|
||||||
|
property int radiusSelector: 8
|
||||||
|
property int radiusField: 8
|
||||||
|
property int radiusBox: 8
|
||||||
|
property int border: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,28 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import "theme"
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Qt.labs.folderlistmodel 2.9
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var palette: theme
|
|
||||||
|
|
||||||
property alias themes: cache.themes
|
property alias themes: cache.themes
|
||||||
property alias currentTheme: cache.current
|
property alias currentTheme: cache.current
|
||||||
property int currentThemeIndex: themes.indexOf(currentTheme)
|
property int currentThemeIndex: themes.indexOf(currentTheme)
|
||||||
|
|
||||||
Process {
|
FolderListModel {
|
||||||
running: true
|
id: model
|
||||||
command: ["bash", "-c", `inotifywait -m -r ~/.config/lux/themes/ -e modify,move,create,delete | while read dir action; do ls -m "$dir"; done`]
|
nameFilters: ["*.json"]
|
||||||
stderr: StdioCollector {
|
folder: `${Paths.config}/themes/`
|
||||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
showDirs: false
|
||||||
}
|
onCountChanged: {
|
||||||
stdout: SplitParser {
|
const arr = [];
|
||||||
splitMarker: "\n"
|
for (let i = 0; i < count; i++) {
|
||||||
onRead: data => {
|
arr.push(get(i, "fileName").replace(".json", ""));
|
||||||
const themes = data.split(", ").filter(item => item.endsWith(".json")).map(item => item.replace(".json", ""));
|
|
||||||
if (themes.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
root.themes = themes;
|
|
||||||
}
|
}
|
||||||
|
root.themes = arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,17 +47,4 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileView {
|
|
||||||
path: `${Paths.config}/themes/${root.currentTheme}.json`
|
|
||||||
watchChanges: true
|
|
||||||
onFileChanged: reload()
|
|
||||||
|
|
||||||
// when changes are made to properties in the adapter, save them
|
|
||||||
onAdapterUpdated: writeAdapter()
|
|
||||||
|
|
||||||
Theme {
|
|
||||||
id: theme
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
JsonAdapter {
|
|
||||||
property color primary: "#605dff"
|
|
||||||
property color primarycontent: "#edf1fe"
|
|
||||||
property color secondary: "#f43098"
|
|
||||||
property color secondarycontent: "#f9e4f0"
|
|
||||||
property color accent: "#00d3bb"
|
|
||||||
property color accentcontent: "#084d49"
|
|
||||||
property color neutral: "#09090b"
|
|
||||||
property color neutralcontent: "#e4e4e7"
|
|
||||||
property color base100: "#1d232a"
|
|
||||||
property color base200: "#191e24"
|
|
||||||
property color base300: "#15191e"
|
|
||||||
property color basecontent: "#ecf9ff"
|
|
||||||
property color info: "#00bafe"
|
|
||||||
property color infocontent: "#042e49"
|
|
||||||
property color success: "#00d390"
|
|
||||||
property color successcontent: "#004c39"
|
|
||||||
property color warning: "#fcb700"
|
|
||||||
property color warningcontent: "#793205"
|
|
||||||
property color error: "#ff627d"
|
|
||||||
property color errorcontent: "#4d0218"
|
|
||||||
|
|
||||||
property int radiusSelector: 8
|
|
||||||
property int radiusField: 8
|
|
||||||
property int radiusBox: 8
|
|
||||||
property int border: 2
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue