Removed extra 's' from all services. Made the noctalia color scheme the default
This commit is contained in:
parent
b05abca3c1
commit
f5a192baba
24 changed files with 79 additions and 89 deletions
81
Services/ColorSchemeService.qml
Normal file
81
Services/ColorSchemeService.qml
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Qt.labs.folderlistmodel
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.log("ColorScheme", "Service started")
|
||||
loadColorSchemes()
|
||||
}
|
||||
|
||||
property var schemes: []
|
||||
property bool scanning: false
|
||||
property string schemesDirectory: Quickshell.shellDir + "/Assets/ColorScheme"
|
||||
property string colorsJsonFilePath: Settings.configDir + "colors.json"
|
||||
|
||||
function loadColorSchemes() {
|
||||
Logger.log("ColorScheme", "Load ColorScheme")
|
||||
scanning = true
|
||||
schemes = []
|
||||
// Unsetting, then setting the folder will re-trigger the parsing!
|
||||
folderModel.folder = ""
|
||||
folderModel.folder = "file://" + schemesDirectory
|
||||
}
|
||||
|
||||
function applyScheme(filePath) {
|
||||
Quickshell.execDetached(["cp", filePath, colorsJsonFilePath])
|
||||
}
|
||||
|
||||
function changedWallpaper() {
|
||||
if (Settings.data.colorSchemes.useWallpaperColors) {
|
||||
Logger.log("ColorScheme", "Starting color generation from wallpaper")
|
||||
generateColorsProcess.running = true
|
||||
// Invalidate potential predefined scheme
|
||||
Settings.data.colorSchemes.predefinedScheme = ""
|
||||
}
|
||||
}
|
||||
|
||||
FolderListModel {
|
||||
id: folderModel
|
||||
nameFilters: ["*.json"]
|
||||
showDirs: false
|
||||
sortField: FolderListModel.Name
|
||||
onStatusChanged: {
|
||||
if (status === FolderListModel.Ready) {
|
||||
var files = []
|
||||
for (var i = 0; i < count; i++) {
|
||||
var filepath = schemesDirectory + "/" + get(i, "fileName")
|
||||
files.push(filepath)
|
||||
}
|
||||
schemes = files
|
||||
scanning = false
|
||||
Logger.log("ColorScheme", "Listed", schemes.length, "schemes")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: generateColorsProcess
|
||||
command: ["matugen", "image", WallpaperService.currentWallpaper, "--config", Quickshell.shellDir + "/Assets/Matugen/matugen.toml"]
|
||||
workingDirectory: Quickshell.shellDir
|
||||
running: false
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
Logger.log("ColorScheme", "Completed colors generation")
|
||||
}
|
||||
}
|
||||
stderr: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (this.text !== "") {
|
||||
Logger.error(this.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue