noctalia-shell/Settings/Settings.qml

71 lines
No EOL
2.6 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Services
Singleton {
property string shellName: "Noctalia"
property string settingsDir: (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/"
property string settingsFile: settingsDir + "Settings.json"
property var settings: settingAdapter
Item {
Component.onCompleted: {
// ensure settings dir
Quickshell.execDetached(["mkdir", "-p", settingsDir]);
}
}
FileView {
id: settingFileView
path: settingsFile
watchChanges: true
onFileChanged: reload()
onAdapterUpdated: writeAdapter()
Component.onCompleted: function() {
reload()
}
onLoaded: function() {
WallpaperManager.setCurrentWallpaper(settings.currentWallpaper, true);
}
onLoadFailed: function(error) {
settingAdapter = {}
writeAdapter()
}
JsonAdapter {
id: settingAdapter
property string weatherCity: "Dinslaken"
property string profileImage: Quickshell.env("HOME") + "/.face"
property bool useFahrenheit: false
property string wallpaperFolder: "/usr/share/wallpapers"
property string currentWallpaper: ""
property string videoPath: "~/Videos/"
property bool showActiveWindowIcon: false
property bool showSystemInfoInBar: false
property bool showCorners: false
property bool showMediaInBar: false
property bool useSWWW: false
property bool randomWallpaper: false
property bool useWallpaperTheme: false
property int wallpaperInterval: 300
property string wallpaperResize: "crop"
property int transitionFps: 60
property string transitionType: "random"
property real transitionDuration: 1.1
property string visualizerType: "radial"
property bool reverseDayMonth: false
property bool use12HourClock: false
property bool dimPanels: true
property var pinnedExecs: [] // Added for AppLauncher pinned apps
}
}
Connections {
target: settingAdapter
function onRandomWallpaperChanged() { WallpaperManager.toggleRandomWallpaper() }
function onWallpaperIntervalChanged() { WallpaperManager.restartRandomWallpaperTimer() }
function onWallpaperFolderChanged() { WallpaperManager.loadWallpapers() }
}
}