1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 15:32:50 -05:00

config refacotr: separate settings.json, session.json, appusage.json

This commit is contained in:
bbedward
2025-08-06 11:47:24 -04:00
parent defc50eec6
commit 18aa557ef1
45 changed files with 639 additions and 529 deletions

View File

@@ -0,0 +1,128 @@
pragma Singleton
pragma ComponentBehavior: Bound
import QtCore
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
property var appUsageRanking: {}
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
readonly property string _configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl
Component.onCompleted: {
loadSettings();
}
function loadSettings() {
parseSettings(settingsFile.text());
}
function parseSettings(content) {
try {
if (content && content.trim()) {
var settings = JSON.parse(content);
appUsageRanking = settings.appUsageRanking || {};
}
} catch (e) {
}
}
function saveSettings() {
settingsFile.setText(JSON.stringify({
"appUsageRanking": appUsageRanking
}, null, 2));
}
function addAppUsage(app) {
if (!app)
return;
var appId = app.id || (app.execString || app.exec || "");
if (!appId)
return;
var currentRanking = Object.assign({}, appUsageRanking);
if (currentRanking[appId]) {
currentRanking[appId].usageCount = (currentRanking[appId].usageCount || 1) + 1;
currentRanking[appId].lastUsed = Date.now();
currentRanking[appId].icon = app.icon || currentRanking[appId].icon || "application-x-executable";
currentRanking[appId].name = app.name || currentRanking[appId].name || "";
} else {
currentRanking[appId] = {
"name": app.name || "",
"exec": app.execString || app.exec || "",
"icon": app.icon || "application-x-executable",
"comment": app.comment || "",
"usageCount": 1,
"lastUsed": Date.now()
};
}
appUsageRanking = currentRanking;
saveSettings();
}
function getAppUsageRanking() {
return appUsageRanking;
}
function getRankedApps() {
var apps = [];
for (var appId in appUsageRanking) {
var appData = appUsageRanking[appId];
apps.push({
id: appId,
name: appData.name,
exec: appData.exec,
icon: appData.icon,
comment: appData.comment,
usageCount: appData.usageCount,
lastUsed: appData.lastUsed
});
}
return apps.sort(function(a, b) {
if (a.usageCount !== b.usageCount)
return b.usageCount - a.usageCount;
return a.name.localeCompare(b.name);
});
}
function cleanupAppUsageRanking(availableAppIds) {
var currentRanking = Object.assign({}, appUsageRanking);
var hasChanges = false;
for (var appId in currentRanking) {
if (availableAppIds.indexOf(appId) === -1) {
delete currentRanking[appId];
hasChanges = true;
}
}
if (hasChanges) {
appUsageRanking = currentRanking;
saveSettings();
}
}
FileView {
id: settingsFile
path: StandardPaths.writableLocation(StandardPaths.ConfigLocation) + "/DankMaterialShell/appusage.json"
blockLoading: true
blockWrites: true
watchChanges: true
onLoaded: {
parseSettings(settingsFile.text());
}
onLoadFailed: (error) => {
}
}
}

View File

@@ -17,7 +17,7 @@ Singleton {
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation) readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
readonly property string configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl readonly property string configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl
readonly property string shellDir: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Common/", "") readonly property string shellDir: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Common/", "")
readonly property string wallpaperPath: Prefs.wallpaperPath readonly property string wallpaperPath: SessionData.wallpaperPath
property bool matugenAvailable: false property bool matugenAvailable: false
property bool gtkThemingEnabled: false property bool gtkThemingEnabled: false
property bool qtThemingEnabled: false property bool qtThemingEnabled: false
@@ -71,7 +71,7 @@ Singleton {
function getMatugenColor(path, fallback) { function getMatugenColor(path, fallback) {
colorUpdateTrigger; colorUpdateTrigger;
const colorMode = (typeof Theme !== "undefined" && Theme.isLightMode) ? "light" : "dark"; const colorMode = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "light" : "dark";
let cur = matugenColors && matugenColors.colors && matugenColors.colors[colorMode]; let cur = matugenColors && matugenColors.colors && matugenColors.colors[colorMode];
for (const part of path.split(".")) { for (const part of path.split(".")) {
if (!cur || typeof cur !== "object" || !(part in cur)) if (!cur || typeof cur !== "object" || !(part in cur))
@@ -90,8 +90,8 @@ Singleton {
matugenCheck.running = true; matugenCheck.running = true;
checkGtkThemingAvailability(); checkGtkThemingAvailability();
checkQtThemingAvailability(); checkQtThemingAvailability();
if (typeof Theme !== "undefined") if (typeof SessionData !== "undefined")
Theme.isLightModeChanged.connect(root.onLightModeChanged); SessionData.isLightModeChanged.connect(root.onLightModeChanged);
} }
Process { Process {
@@ -167,10 +167,10 @@ Singleton {
generateNiriConfig(); generateNiriConfig();
generateGhosttyConfig(); generateGhosttyConfig();
if (gtkThemingEnabled && typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) { if (gtkThemingEnabled && typeof SettingsData !== "undefined" && SettingsData.gtkThemingEnabled) {
generateGtkThemes(); generateGtkThemes();
} }
if (qtThemingEnabled && typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) { if (qtThemingEnabled && typeof SettingsData !== "undefined" && SettingsData.qtThemingEnabled) {
generateQtThemes(); generateQtThemes();
} }
} }
@@ -270,10 +270,10 @@ palette = 15=${fg_b}`;
return; return;
} }
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false"; const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default"; const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default";
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false"; const gtkTheming = (typeof SettingsData !== "undefined" && SettingsData.gtkThemingEnabled) ? "true" : "false";
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false"; const qtTheming = (typeof SettingsData !== "undefined" && SettingsData.qtThemingEnabled) ? "true" : "false";
systemThemeGenerationInProgress = true; systemThemeGenerationInProgress = true;
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, configDir, "generate", isLight, iconTheme, gtkTheming, qtTheming]; systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, configDir, "generate", isLight, iconTheme, gtkTheming, qtTheming];
@@ -294,10 +294,10 @@ palette = 15=${fg_b}`;
return; return;
} }
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false"; const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default"; const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default";
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false"; const gtkTheming = (typeof SettingsData !== "undefined" && SettingsData.gtkThemingEnabled) ? "true" : "false";
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false"; const qtTheming = (typeof SettingsData !== "undefined" && SettingsData.qtThemingEnabled) ? "true" : "false";
systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, configDir, "restore", isLight, iconTheme, gtkTheming, qtTheming]; systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, configDir, "restore", isLight, iconTheme, gtkTheming, qtTheming];
systemThemeRestoreProcess.running = true; systemThemeRestoreProcess.running = true;

179
Common/SessionData.qml Normal file
View File

@@ -0,0 +1,179 @@
pragma Singleton
pragma ComponentBehavior: Bound
import QtCore
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
property bool isLightMode: false
property string wallpaperPath: ""
property string wallpaperLastPath: ""
property string profileLastPath: ""
property bool doNotDisturb: false
property var pinnedApps: []
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
readonly property string _configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl
Component.onCompleted: {
loadSettings();
}
function loadSettings() {
parseSettings(settingsFile.text());
}
function parseSettings(content) {
try {
if (content && content.trim()) {
var settings = JSON.parse(content);
isLightMode = settings.isLightMode !== undefined ? settings.isLightMode : false;
wallpaperPath = settings.wallpaperPath !== undefined ? settings.wallpaperPath : "";
wallpaperLastPath = settings.wallpaperLastPath !== undefined ? settings.wallpaperLastPath : "";
profileLastPath = settings.profileLastPath !== undefined ? settings.profileLastPath : "";
doNotDisturb = settings.doNotDisturb !== undefined ? settings.doNotDisturb : false;
pinnedApps = settings.pinnedApps !== undefined ? settings.pinnedApps : [];
}
} catch (e) {
}
}
function saveSettings() {
settingsFile.setText(JSON.stringify({
"isLightMode": isLightMode,
"wallpaperPath": wallpaperPath,
"wallpaperLastPath": wallpaperLastPath,
"profileLastPath": profileLastPath,
"doNotDisturb": doNotDisturb,
"pinnedApps": pinnedApps
}, null, 2));
}
function setLightMode(lightMode) {
isLightMode = lightMode;
saveSettings();
}
function setDoNotDisturb(enabled) {
doNotDisturb = enabled;
saveSettings();
}
function setWallpaperPath(path) {
wallpaperPath = path;
saveSettings();
}
function setWallpaper(imagePath) {
wallpaperPath = imagePath;
saveSettings();
if (typeof Colors !== "undefined" && typeof SettingsData !== "undefined" && SettingsData.wallpaperDynamicTheming) {
Colors.extractColors();
}
}
function setWallpaperLastPath(path) {
wallpaperLastPath = path;
saveSettings();
}
function setProfileLastPath(path) {
profileLastPath = path;
saveSettings();
}
function setPinnedApps(apps) {
pinnedApps = apps;
saveSettings();
}
function addPinnedApp(appId) {
if (!appId) return;
var currentPinned = [...pinnedApps];
if (currentPinned.indexOf(appId) === -1) {
currentPinned.push(appId);
setPinnedApps(currentPinned);
}
}
function removePinnedApp(appId) {
if (!appId) return;
var currentPinned = pinnedApps.filter(id => id !== appId);
setPinnedApps(currentPinned);
}
function isPinnedApp(appId) {
return appId && pinnedApps.indexOf(appId) !== -1;
}
FileView {
id: settingsFile
path: StandardPaths.writableLocation(StandardPaths.ConfigLocation) + "/DankMaterialShell/session.json"
blockLoading: true
blockWrites: true
watchChanges: true
onLoaded: {
parseSettings(settingsFile.text());
}
onLoadFailed: (error) => {
}
}
IpcHandler {
target: "wallpaper"
function get(): string {
return root.wallpaperPath || ""
}
function set(path: string): string {
if (!path) {
return "ERROR: No path provided"
}
var absolutePath = path.startsWith("/") ? path : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/" + path
try {
root.setWallpaper(absolutePath)
return "SUCCESS: Wallpaper set to " + absolutePath
} catch (e) {
return "ERROR: Failed to set wallpaper: " + e.toString()
}
}
function clear(): string {
root.setWallpaper("")
return "SUCCESS: Wallpaper cleared"
}
}
IpcHandler {
target: "theme"
function toggle(): string {
root.setLightMode(!root.isLightMode)
return root.isLightMode ? "light" : "dark"
}
function light(): string {
root.setLightMode(true)
return "light"
}
function dark(): string {
root.setLightMode(false)
return "dark"
}
function getMode(): string {
return root.isLightMode ? "light" : "dark"
}
}
}

View File

@@ -13,12 +13,10 @@ Singleton {
property int themeIndex: 0 property int themeIndex: 0
property bool themeIsDynamic: false property bool themeIsDynamic: false
property bool isLightMode: false
property real topBarTransparency: 0.75 property real topBarTransparency: 0.75
property real topBarWidgetTransparency: 0.85 property real topBarWidgetTransparency: 0.85
property real popupTransparency: 0.92 property real popupTransparency: 0.92
property real dockTransparency: 1.0 property real dockTransparency: 1.0
property var appUsageRanking: {}
property bool use24HourClock: true property bool use24HourClock: true
property bool useFahrenheit: false property bool useFahrenheit: false
property bool nightModeEnabled: false property bool nightModeEnabled: false
@@ -74,11 +72,7 @@ Singleton {
property string osLogoColorOverride: "" property string osLogoColorOverride: ""
property real osLogoBrightness: 0.5 property real osLogoBrightness: 0.5
property real osLogoContrast: 1.0 property real osLogoContrast: 1.0
property string wallpaperPath: ""
property bool wallpaperDynamicTheming: true property bool wallpaperDynamicTheming: true
property string wallpaperLastPath: ""
property string profileLastPath: ""
property bool doNotDisturb: false
property bool weatherEnabled: true property bool weatherEnabled: true
property string fontFamily: "Inter Variable" property string fontFamily: "Inter Variable"
property string monoFontFamily: "Fira Code" property string monoFontFamily: "Fira Code"
@@ -86,7 +80,6 @@ Singleton {
property bool gtkThemingEnabled: false property bool gtkThemingEnabled: false
property bool qtThemingEnabled: false property bool qtThemingEnabled: false
property bool showDock: false property bool showDock: false
property var pinnedApps: []
property bool dockAutoHide: false property bool dockAutoHide: false
readonly property string defaultFontFamily: "Inter Variable" readonly property string defaultFontFamily: "Inter Variable"
@@ -140,12 +133,10 @@ Singleton {
var settings = JSON.parse(content); var settings = JSON.parse(content);
themeIndex = settings.themeIndex !== undefined ? settings.themeIndex : 0; themeIndex = settings.themeIndex !== undefined ? settings.themeIndex : 0;
themeIsDynamic = settings.themeIsDynamic !== undefined ? settings.themeIsDynamic : false; themeIsDynamic = settings.themeIsDynamic !== undefined ? settings.themeIsDynamic : false;
isLightMode = settings.isLightMode !== undefined ? settings.isLightMode : false;
topBarTransparency = settings.topBarTransparency !== undefined ? (settings.topBarTransparency > 1 ? settings.topBarTransparency / 100 : settings.topBarTransparency) : 0.75; topBarTransparency = settings.topBarTransparency !== undefined ? (settings.topBarTransparency > 1 ? settings.topBarTransparency / 100 : settings.topBarTransparency) : 0.75;
topBarWidgetTransparency = settings.topBarWidgetTransparency !== undefined ? (settings.topBarWidgetTransparency > 1 ? settings.topBarWidgetTransparency / 100 : settings.topBarWidgetTransparency) : 0.85; topBarWidgetTransparency = settings.topBarWidgetTransparency !== undefined ? (settings.topBarWidgetTransparency > 1 ? settings.topBarWidgetTransparency / 100 : settings.topBarWidgetTransparency) : 0.85;
popupTransparency = settings.popupTransparency !== undefined ? (settings.popupTransparency > 1 ? settings.popupTransparency / 100 : settings.popupTransparency) : 0.92; popupTransparency = settings.popupTransparency !== undefined ? (settings.popupTransparency > 1 ? settings.popupTransparency / 100 : settings.popupTransparency) : 0.92;
dockTransparency = settings.dockTransparency !== undefined ? (settings.dockTransparency > 1 ? settings.dockTransparency / 100 : settings.dockTransparency) : 1.0; dockTransparency = settings.dockTransparency !== undefined ? (settings.dockTransparency > 1 ? settings.dockTransparency / 100 : settings.dockTransparency) : 1.0;
appUsageRanking = settings.appUsageRanking || {};
use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true; use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true;
useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false; useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false;
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false; nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false;
@@ -194,18 +185,13 @@ Singleton {
osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : ""; osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : "";
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5; osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5;
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1.0; osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1.0;
wallpaperPath = settings.wallpaperPath !== undefined ? settings.wallpaperPath : "";
wallpaperDynamicTheming = settings.wallpaperDynamicTheming !== undefined ? settings.wallpaperDynamicTheming : true; wallpaperDynamicTheming = settings.wallpaperDynamicTheming !== undefined ? settings.wallpaperDynamicTheming : true;
wallpaperLastPath = settings.wallpaperLastPath !== undefined ? settings.wallpaperLastPath : "";
profileLastPath = settings.profileLastPath !== undefined ? settings.profileLastPath : "";
doNotDisturb = settings.doNotDisturb !== undefined ? settings.doNotDisturb : false;
fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : defaultFontFamily; fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : defaultFontFamily;
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily; monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily;
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal; fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal;
gtkThemingEnabled = settings.gtkThemingEnabled !== undefined ? settings.gtkThemingEnabled : false; gtkThemingEnabled = settings.gtkThemingEnabled !== undefined ? settings.gtkThemingEnabled : false;
qtThemingEnabled = settings.qtThemingEnabled !== undefined ? settings.qtThemingEnabled : false; qtThemingEnabled = settings.qtThemingEnabled !== undefined ? settings.qtThemingEnabled : false;
showDock = settings.showDock !== undefined ? settings.showDock : false; showDock = settings.showDock !== undefined ? settings.showDock : false;
pinnedApps = settings.pinnedApps !== undefined ? settings.pinnedApps : [];
dockAutoHide = settings.dockAutoHide !== undefined ? settings.dockAutoHide : false; dockAutoHide = settings.dockAutoHide !== undefined ? settings.dockAutoHide : false;
applyStoredTheme(); applyStoredTheme();
detectAvailableIconThemes(); detectAvailableIconThemes();
@@ -224,12 +210,10 @@ Singleton {
settingsFile.setText(JSON.stringify({ settingsFile.setText(JSON.stringify({
"themeIndex": themeIndex, "themeIndex": themeIndex,
"themeIsDynamic": themeIsDynamic, "themeIsDynamic": themeIsDynamic,
"isLightMode": isLightMode,
"topBarTransparency": topBarTransparency, "topBarTransparency": topBarTransparency,
"topBarWidgetTransparency": topBarWidgetTransparency, "topBarWidgetTransparency": topBarWidgetTransparency,
"popupTransparency": popupTransparency, "popupTransparency": popupTransparency,
"dockTransparency": dockTransparency, "dockTransparency": dockTransparency,
"appUsageRanking": appUsageRanking,
"use24HourClock": use24HourClock, "use24HourClock": use24HourClock,
"useFahrenheit": useFahrenheit, "useFahrenheit": useFahrenheit,
"nightModeEnabled": nightModeEnabled, "nightModeEnabled": nightModeEnabled,
@@ -264,18 +248,13 @@ Singleton {
"osLogoColorOverride": osLogoColorOverride, "osLogoColorOverride": osLogoColorOverride,
"osLogoBrightness": osLogoBrightness, "osLogoBrightness": osLogoBrightness,
"osLogoContrast": osLogoContrast, "osLogoContrast": osLogoContrast,
"wallpaperPath": wallpaperPath,
"wallpaperDynamicTheming": wallpaperDynamicTheming, "wallpaperDynamicTheming": wallpaperDynamicTheming,
"wallpaperLastPath": wallpaperLastPath,
"profileLastPath": profileLastPath,
"doNotDisturb": doNotDisturb,
"fontFamily": fontFamily, "fontFamily": fontFamily,
"monoFontFamily": monoFontFamily, "monoFontFamily": monoFontFamily,
"fontWeight": fontWeight, "fontWeight": fontWeight,
"gtkThemingEnabled": gtkThemingEnabled, "gtkThemingEnabled": gtkThemingEnabled,
"qtThemingEnabled": qtThemingEnabled, "qtThemingEnabled": qtThemingEnabled,
"showDock": showDock, "showDock": showDock,
"pinnedApps": pinnedApps,
"dockAutoHide": dockAutoHide "dockAutoHide": dockAutoHide
}, null, 2)); }, null, 2));
} }
@@ -302,12 +281,10 @@ Singleton {
function applyStoredTheme() { function applyStoredTheme() {
if (typeof Theme !== "undefined") { if (typeof Theme !== "undefined") {
Theme.isLightMode = isLightMode;
Theme.switchTheme(themeIndex, themeIsDynamic, false); Theme.switchTheme(themeIndex, themeIsDynamic, false);
} else { } else {
Qt.callLater(() => { Qt.callLater(() => {
if (typeof Theme !== "undefined") { if (typeof Theme !== "undefined") {
Theme.isLightMode = isLightMode;
Theme.switchTheme(themeIndex, themeIsDynamic, false); Theme.switchTheme(themeIndex, themeIsDynamic, false);
} }
}); });
@@ -320,13 +297,6 @@ Singleton {
saveSettings(); saveSettings();
} }
function setLightMode(lightMode) {
isLightMode = lightMode;
if (typeof Theme !== "undefined") {
Theme.isLightMode = lightMode;
}
saveSettings();
}
function setTopBarTransparency(transparency) { function setTopBarTransparency(transparency) {
topBarTransparency = transparency; topBarTransparency = transparency;
@@ -348,78 +318,9 @@ Singleton {
saveSettings(); saveSettings();
} }
function addAppUsage(app) {
if (!app)
return;
var appId = app.id || (app.execString || app.exec || "");
if (!appId)
return;
var currentRanking = Object.assign({}, appUsageRanking);
if (currentRanking[appId]) {
currentRanking[appId].usageCount = (currentRanking[appId].usageCount || 1) + 1;
currentRanking[appId].lastUsed = Date.now();
currentRanking[appId].icon = app.icon || currentRanking[appId].icon || "application-x-executable";
currentRanking[appId].name = app.name || currentRanking[appId].name || "";
} else {
currentRanking[appId] = {
"name": app.name || "",
"exec": app.execString || app.exec || "",
"icon": app.icon || "application-x-executable",
"comment": app.comment || "",
"usageCount": 1,
"lastUsed": Date.now()
};
}
appUsageRanking = currentRanking;
saveSettings();
}
function getAppUsageRanking() {
return appUsageRanking;
}
function getRankedApps() {
var apps = [];
for (var appId in appUsageRanking) {
var appData = appUsageRanking[appId];
apps.push({
id: appId,
name: appData.name,
exec: appData.exec,
icon: appData.icon,
comment: appData.comment,
usageCount: appData.usageCount,
lastUsed: appData.lastUsed
});
}
return apps.sort(function(a, b) {
if (a.usageCount !== b.usageCount)
return b.usageCount - a.usageCount;
return a.name.localeCompare(b.name);
});
}
function cleanupAppUsageRanking(availableAppIds) {
var currentRanking = Object.assign({}, appUsageRanking);
var hasChanges = false;
for (var appId in currentRanking) {
if (availableAppIds.indexOf(appId) === -1) {
delete currentRanking[appId];
hasChanges = true;
}
}
if (hasChanges) {
appUsageRanking = currentRanking;
saveSettings();
}
}
// New preference setters // New preference setters
function setClockFormat(use24Hour) { function setClockFormat(use24Hour) {
@@ -770,37 +671,14 @@ Singleton {
saveSettings(); saveSettings();
} }
function setWallpaperPath(path) {
wallpaperPath = path;
saveSettings();
if (wallpaperDynamicTheming && path && typeof Theme !== "undefined") {
Theme.switchTheme(themeIndex, true, true);
}
}
function setWallpaperDynamicTheming(enabled) { function setWallpaperDynamicTheming(enabled) {
wallpaperDynamicTheming = enabled; wallpaperDynamicTheming = enabled;
saveSettings(); saveSettings();
if (enabled && wallpaperPath && typeof Theme !== "undefined") {
Theme.switchTheme(themeIndex, true, true);
}
} }
function setWallpaper(imagePath) {
wallpaperPath = imagePath;
saveSettings();
if (wallpaperDynamicTheming && typeof Colors !== "undefined") {
Colors.extractColors();
}
}
function setDoNotDisturb(enabled) {
doNotDisturb = enabled;
saveSettings();
}
function setFontFamily(family) { function setFontFamily(family) {
fontFamily = family; fontFamily = family;
@@ -832,30 +710,6 @@ Singleton {
saveSettings(); saveSettings();
} }
function setPinnedApps(apps) {
pinnedApps = apps;
pinnedAppsChanged(); // Explicitly emit the signal
saveSettings();
}
function addPinnedApp(appId) {
if (!appId) return;
var currentPinned = [...pinnedApps];
if (currentPinned.indexOf(appId) === -1) {
currentPinned.push(appId);
setPinnedApps(currentPinned);
}
}
function removePinnedApp(appId) {
if (!appId) return;
var currentPinned = pinnedApps.filter(id => id !== appId);
setPinnedApps(currentPinned);
}
function isPinnedApp(appId) {
return appId && pinnedApps.indexOf(appId) !== -1;
}
function setDockAutoHide(enabled) { function setDockAutoHide(enabled) {
@@ -942,54 +796,4 @@ Singleton {
} }
} }
IpcHandler {
target: "wallpaper"
function get(): string {
return root.wallpaperPath || ""
}
function set(path: string): string {
if (!path) {
return "ERROR: No path provided"
}
var absolutePath = path.startsWith("/") ? path : StandardPaths.writableLocation(StandardPaths.HomeLocation) + "/" + path
try {
root.setWallpaper(absolutePath)
return "SUCCESS: Wallpaper set to " + absolutePath
} catch (e) {
return "ERROR: Failed to set wallpaper: " + e.toString()
}
}
function clear(): string {
root.setWallpaper("")
return "SUCCESS: Wallpaper cleared"
}
}
IpcHandler {
target: "theme"
function toggle(): string {
root.setLightMode(!root.isLightMode)
return root.isLightMode ? "light" : "dark"
}
function light(): string {
root.setLightMode(true)
return "light"
}
function dark(): string {
root.setLightMode(false)
return "dark"
}
function getMode(): string {
return root.isLightMode ? "light" : "dark"
}
}
} }

View File

@@ -424,8 +424,8 @@ Singleton {
if (isDynamicTheme) { if (isDynamicTheme) {
currentThemeIndex = 10; currentThemeIndex = 10;
isDynamicTheme = true; isDynamicTheme = true;
if (typeof Prefs !== "undefined") if (typeof SettingsData !== "undefined")
Prefs.setTheme(currentThemeIndex, isDynamicTheme); SettingsData.setTheme(currentThemeIndex, isDynamicTheme);
} }
} }
@@ -442,14 +442,14 @@ Singleton {
currentThemeIndex = themeIndex; currentThemeIndex = themeIndex;
isDynamicTheme = false; isDynamicTheme = false;
} }
if (savePrefs && typeof Prefs !== "undefined") if (savePrefs && typeof SettingsData !== "undefined")
Prefs.setTheme(currentThemeIndex, isDynamicTheme); SettingsData.setTheme(currentThemeIndex, isDynamicTheme);
} }
function toggleLightMode(savePrefs = true) { function toggleLightMode(savePrefs = true) {
isLightMode = !isLightMode; isLightMode = !isLightMode;
if (savePrefs && typeof Prefs !== "undefined") if (savePrefs && typeof SessionData !== "undefined")
Prefs.setLightMode(isLightMode); SessionData.setLightMode(isLightMode);
} }
function getCurrentThemeArray() { function getCurrentThemeArray() {
@@ -592,23 +592,23 @@ Singleton {
if (typeof Colors !== "undefined") if (typeof Colors !== "undefined")
Colors.colorsUpdated.connect(root.onColorsUpdated); Colors.colorsUpdated.connect(root.onColorsUpdated);
if (typeof Prefs !== "undefined") { if (typeof SettingsData !== "undefined") {
if (Prefs.popupTransparency !== undefined) if (SettingsData.popupTransparency !== undefined)
root.popupTransparency = Prefs.popupTransparency; root.popupTransparency = SettingsData.popupTransparency;
if (Prefs.topBarWidgetTransparency !== undefined) if (SettingsData.topBarWidgetTransparency !== undefined)
root.widgetTransparency = Prefs.topBarWidgetTransparency; root.widgetTransparency = SettingsData.topBarWidgetTransparency;
if (Prefs.popupTransparencyChanged) if (SettingsData.popupTransparencyChanged)
Prefs.popupTransparencyChanged.connect(function() { SettingsData.popupTransparencyChanged.connect(function() {
if (typeof Prefs !== "undefined" && Prefs.popupTransparency !== undefined) if (typeof SettingsData !== "undefined" && SettingsData.popupTransparency !== undefined)
root.popupTransparency = Prefs.popupTransparency; root.popupTransparency = SettingsData.popupTransparency;
}); });
if (Prefs.topBarWidgetTransparencyChanged) if (SettingsData.topBarWidgetTransparencyChanged)
Prefs.topBarWidgetTransparencyChanged.connect(function() { SettingsData.topBarWidgetTransparencyChanged.connect(function() {
if (typeof Prefs !== "undefined" && Prefs.topBarWidgetTransparency !== undefined) if (typeof SettingsData !== "undefined" && SettingsData.topBarWidgetTransparency !== undefined)
root.widgetTransparency = Prefs.topBarWidgetTransparency; root.widgetTransparency = SettingsData.topBarWidgetTransparency;
}); });
} }
} }

View File

@@ -39,9 +39,9 @@ DankModal {
function getLastPath() { function getLastPath() {
var lastPath = ""; var lastPath = "";
if (browserType === "wallpaper") { if (browserType === "wallpaper") {
lastPath = Prefs.wallpaperLastPath; lastPath = SessionData.wallpaperLastPath;
} else if (browserType === "profile") { } else if (browserType === "profile") {
lastPath = Prefs.profileLastPath; lastPath = SessionData.profileLastPath;
} }
if (lastPath && lastPath !== "") { if (lastPath && lastPath !== "") {
@@ -52,11 +52,10 @@ DankModal {
function saveLastPath(path) { function saveLastPath(path) {
if (browserType === "wallpaper") { if (browserType === "wallpaper") {
Prefs.wallpaperLastPath = path; SessionData.setWallpaperLastPath(path);
} else if (browserType === "profile") { } else if (browserType === "profile") {
Prefs.profileLastPath = path; SessionData.setProfileLastPath(path);
} }
Prefs.saveSettings();
} }
Component.onCompleted: { Component.onCompleted: {

View File

@@ -59,11 +59,11 @@ DankModal {
AppLauncher { AppLauncher {
id: appLauncher id: appLauncher
viewMode: Prefs.spotlightModalViewMode viewMode: SettingsData.spotlightModalViewMode
gridColumns: 4 gridColumns: 4
onAppLaunched: hide() onAppLaunched: hide()
onViewModeSelected: function(mode) { onViewModeSelected: function(mode) {
Prefs.setSpotlightModalViewMode(mode); SettingsData.setSpotlightModalViewMode(mode);
} }
} }
@@ -426,7 +426,7 @@ DankModal {
name: { name: {
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return "push_pin" if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return "push_pin"
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "" var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""
return Prefs.isPinnedApp(appId) ? "keep_off" : "push_pin" return SessionData.isPinnedApp(appId) ? "keep_off" : "push_pin"
} }
size: Theme.iconSize - 2 size: Theme.iconSize - 2
color: Theme.surfaceText color: Theme.surfaceText
@@ -438,7 +438,7 @@ DankModal {
text: { text: {
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return "Pin to Dock" if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return "Pin to Dock"
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "" var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""
return Prefs.isPinnedApp(appId) ? "Unpin from Dock" : "Pin to Dock" return SessionData.isPinnedApp(appId) ? "Unpin from Dock" : "Pin to Dock"
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
@@ -455,10 +455,10 @@ DankModal {
onClicked: { onClicked: {
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "" var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""
if (Prefs.isPinnedApp(appId)) { if (SessionData.isPinnedApp(appId)) {
Prefs.removePinnedApp(appId) SessionData.removePinnedApp(appId)
} else { } else {
Prefs.addPinnedApp(appId) SessionData.addPinnedApp(appId)
} }
contextMenu.close() contextMenu.close()
} }

View File

@@ -62,11 +62,11 @@ PanelWindow {
AppLauncher { AppLauncher {
id: appLauncher id: appLauncher
viewMode: Prefs.appLauncherViewMode viewMode: SettingsData.appLauncherViewMode
gridColumns: 4 gridColumns: 4
onAppLaunched: appDrawerPopout.hide() onAppLaunched: appDrawerPopout.hide()
onViewModeSelected: function(mode) { onViewModeSelected: function(mode) {
Prefs.setAppLauncherViewMode(mode); SettingsData.setAppLauncherViewMode(mode);
} }
} }
@@ -514,7 +514,7 @@ PanelWindow {
return "push_pin"; return "push_pin";
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""; var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "";
return Prefs.isPinnedApp(appId) ? "keep_off" : "push_pin"; return SessionData.isPinnedApp(appId) ? "keep_off" : "push_pin";
} }
size: Theme.iconSize - 2 size: Theme.iconSize - 2
color: Theme.surfaceText color: Theme.surfaceText
@@ -528,7 +528,7 @@ PanelWindow {
return "Pin to Dock"; return "Pin to Dock";
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""; var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "";
return Prefs.isPinnedApp(appId) ? "Unpin from Dock" : "Pin to Dock"; return SessionData.isPinnedApp(appId) ? "Unpin from Dock" : "Pin to Dock";
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
@@ -549,10 +549,10 @@ PanelWindow {
return ; return ;
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""; var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "";
if (Prefs.isPinnedApp(appId)) if (SessionData.isPinnedApp(appId))
Prefs.removePinnedApp(appId); SessionData.removePinnedApp(appId);
else else
Prefs.addPinnedApp(appId); SessionData.addPinnedApp(appId);
contextMenu.close(); contextMenu.close();
} }
} }

View File

@@ -29,7 +29,7 @@ Item {
property var categoryIcons: categories.map((category) => { property var categoryIcons: categories.map((category) => {
return AppSearchService.getCategoryIcon(category); return AppSearchService.getCategoryIcon(category);
}) })
property var appUsageRanking: Prefs.appUsageRanking property var appUsageRanking: AppUsageHistoryData.appUsageRanking
property alias model: filteredModel property alias model: filteredModel
property var _watchApplications: AppSearchService.applications property var _watchApplications: AppSearchService.applications
@@ -144,7 +144,7 @@ Item {
appData.desktopEntry.execute(); appData.desktopEntry.execute();
appLaunched(appData); appLaunched(appData);
Prefs.addAppUsage(appData.desktopEntry); AppUsageHistoryData.addAppUsage(appData.desktopEntry);
} }
function setCategory(category) { function setCategory(category) {

View File

@@ -227,13 +227,13 @@ PanelWindow {
Weather { Weather {
width: parent.width width: parent.width
height: 140 height: 140
visible: Prefs.weatherEnabled visible: SettingsData.weatherEnabled
} }
SystemInfo { SystemInfo {
width: parent.width width: parent.width
height: 140 height: 140
visible: !Prefs.weatherEnabled visible: !SettingsData.weatherEnabled
} }
} }

View File

@@ -204,7 +204,7 @@ Rectangle {
if (modelData.allDay) { if (modelData.allDay) {
return "All day"; return "All day";
} else { } else {
let timeFormat = Prefs.use24HourClock ? "H:mm" : "h:mm AP"; let timeFormat = SettingsData.use24HourClock ? "H:mm" : "h:mm AP";
let startTime = Qt.formatTime(modelData.start, timeFormat); let startTime = Qt.formatTime(modelData.start, timeFormat);
if (modelData.start.toDateString() !== modelData.end.toDateString() || modelData.start.getTime() !== modelData.end.getTime()) if (modelData.start.toDateString() !== modelData.end.toDateString() || modelData.start.getTime() !== modelData.end.getTime())
return startTime + " " + Qt.formatTime(modelData.end, timeFormat); return startTime + " " + Qt.formatTime(modelData.end, timeFormat);

View File

@@ -67,7 +67,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
text: (Prefs.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp) + "°" + (Prefs.useFahrenheit ? "F" : "C") text: (SettingsData.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp) + "°" + (SettingsData.useFahrenheit ? "F" : "C")
font.pixelSize: Theme.fontSizeXLarge font.pixelSize: Theme.fontSizeXLarge
color: Theme.surfaceText color: Theme.surfaceText
font.weight: Font.Light font.weight: Font.Light
@@ -78,7 +78,7 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (WeatherService.weather.available) if (WeatherService.weather.available)
Prefs.setTemperatureUnit(!Prefs.useFahrenheit); SettingsData.setTemperatureUnit(!SettingsData.useFahrenheit);
} }
enabled: WeatherService.weather.available enabled: WeatherService.weather.available

View File

@@ -763,9 +763,9 @@ PanelWindow {
width: parent.width width: parent.width
text: "Night Mode" text: "Night Mode"
description: "Apply warm color temperature to reduce eye strain" description: "Apply warm color temperature to reduce eye strain"
checked: Prefs.nightModeEnabled checked: SettingsData.nightModeEnabled
onToggled: (checked) => { onToggled: (checked) => {
Prefs.setNightModeEnabled(checked); SettingsData.setNightModeEnabled(checked);
} }
} }
@@ -773,9 +773,9 @@ PanelWindow {
width: parent.width width: parent.width
text: "Light Mode" text: "Light Mode"
description: "Use light theme instead of dark theme" description: "Use light theme instead of dark theme"
checked: Prefs.isLightMode checked: SessionData.isLightMode
onToggled: (checked) => { onToggled: (checked) => {
Prefs.setLightMode(checked); SessionData.setLightMode(checked);
Theme.isLightMode = checked; Theme.isLightMode = checked;
PortalService.setLightMode(checked); PortalService.setLightMode(checked);
} }

View File

@@ -88,25 +88,25 @@ ScrollView {
width: (parent.width - Theme.spacingM) / 2 width: (parent.width - Theme.spacingM) / 2
height: 80 height: 80
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Prefs.nightModeEnabled ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (nightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08)) color: SettingsData.nightModeEnabled ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12) : (nightModeToggle.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.08))
border.color: Prefs.nightModeEnabled ? Theme.primary : "transparent" border.color: SettingsData.nightModeEnabled ? Theme.primary : "transparent"
border.width: Prefs.nightModeEnabled ? 1 : 0 border.width: SettingsData.nightModeEnabled ? 1 : 0
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
spacing: Theme.spacingS spacing: Theme.spacingS
DankIcon { DankIcon {
name: Prefs.nightModeEnabled ? "nightlight" : "dark_mode" name: SettingsData.nightModeEnabled ? "nightlight" : "dark_mode"
size: Theme.iconSizeLarge size: Theme.iconSizeLarge
color: Prefs.nightModeEnabled ? Theme.primary : Theme.surfaceText color: SettingsData.nightModeEnabled ? Theme.primary : Theme.surfaceText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
StyledText { StyledText {
text: "Night Mode" text: "Night Mode"
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Prefs.nightModeEnabled ? Theme.primary : Theme.surfaceText color: SettingsData.nightModeEnabled ? Theme.primary : Theme.surfaceText
font.weight: Font.Medium font.weight: Font.Medium
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
@@ -120,12 +120,12 @@ ScrollView {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (Prefs.nightModeEnabled) { if (SettingsData.nightModeEnabled) {
nightModeDisableProcess.running = true; nightModeDisableProcess.running = true;
Prefs.setNightModeEnabled(false); SettingsData.setNightModeEnabled(false);
} else { } else {
nightModeEnableProcess.running = true; nightModeEnableProcess.running = true;
Prefs.setNightModeEnabled(true); SettingsData.setNightModeEnabled(true);
} }
} }
} }
@@ -196,7 +196,7 @@ ScrollView {
onExited: (exitCode) => { onExited: (exitCode) => {
if (exitCode !== 0) { if (exitCode !== 0) {
Prefs.setNightModeEnabled(false); SettingsData.setNightModeEnabled(false);
} }
} }
} }

View File

@@ -17,8 +17,8 @@ PanelWindow {
property var modelData property var modelData
property var contextMenu property var contextMenu
property var windowsMenu property var windowsMenu
property bool autoHide: Prefs.dockAutoHide property bool autoHide: SettingsData.dockAutoHide
property real backgroundTransparency: Prefs.dockTransparency property real backgroundTransparency: SettingsData.dockTransparency
property bool contextMenuOpen: (contextMenu && contextMenu.visible && contextMenu.screen === modelData) || (windowsMenu && windowsMenu.visible && windowsMenu.screen === modelData) property bool contextMenuOpen: (contextMenu && contextMenu.visible && contextMenu.screen === modelData) || (windowsMenu && windowsMenu.visible && windowsMenu.screen === modelData)
@@ -32,14 +32,14 @@ PanelWindow {
property bool reveal: (!autoHide || dockMouseArea.containsMouse || dockApps.requestDockShow || contextMenuOpen) && !windowIsFullscreen property bool reveal: (!autoHide || dockMouseArea.containsMouse || dockApps.requestDockShow || contextMenuOpen) && !windowIsFullscreen
Connections { Connections {
target: Prefs target: SettingsData
function onDockTransparencyChanged() { function onDockTransparencyChanged() {
dock.backgroundTransparency = Prefs.dockTransparency; dock.backgroundTransparency = SettingsData.dockTransparency;
} }
} }
screen: modelData screen: modelData
visible: Prefs.showDock visible: SettingsData.showDock
color: "transparent" color: "transparent"
anchors { anchors {

View File

@@ -170,7 +170,7 @@ Item {
if (appData && appData.appId) { if (appData && appData.appId) {
var desktopEntry = DesktopEntries.byId(appData.appId) var desktopEntry = DesktopEntries.byId(appData.appId)
if (desktopEntry) { if (desktopEntry) {
Prefs.addAppUsage({ AppUsageHistoryData.addAppUsage({
id: appData.appId, id: appData.appId,
name: desktopEntry.name || appData.appId, name: desktopEntry.name || appData.appId,
icon: desktopEntry.icon || "", icon: desktopEntry.icon || "",
@@ -190,7 +190,7 @@ Item {
if (appData && appData.appId) { if (appData && appData.appId) {
var desktopEntry = DesktopEntries.byId(appData.appId) var desktopEntry = DesktopEntries.byId(appData.appId)
if (desktopEntry) { if (desktopEntry) {
Prefs.addAppUsage({ AppUsageHistoryData.addAppUsage({
id: appData.appId, id: appData.appId,
name: desktopEntry.name || appData.appId, name: desktopEntry.name || appData.appId,
icon: desktopEntry.icon || "", icon: desktopEntry.icon || "",
@@ -225,7 +225,7 @@ Item {
if (!appData || !appData.appId) return "" if (!appData || !appData.appId) return ""
var desktopEntry = DesktopEntries.byId(appData.appId) var desktopEntry = DesktopEntries.byId(appData.appId)
if (desktopEntry && desktopEntry.icon) { if (desktopEntry && desktopEntry.icon) {
var iconPath = Quickshell.iconPath(desktopEntry.icon, Prefs.iconTheme === "System Default" ? "" : Prefs.iconTheme) var iconPath = Quickshell.iconPath(desktopEntry.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme)
return iconPath return iconPath
} }
return "" return ""

View File

@@ -19,13 +19,13 @@ Item {
function movePinnedApp(fromIndex, toIndex) { function movePinnedApp(fromIndex, toIndex) {
if (fromIndex === toIndex) return if (fromIndex === toIndex) return
var currentPinned = [...Prefs.pinnedApps] var currentPinned = [...SessionData.pinnedApps]
if (fromIndex < 0 || fromIndex >= currentPinned.length || toIndex < 0 || toIndex >= currentPinned.length) return if (fromIndex < 0 || fromIndex >= currentPinned.length || toIndex < 0 || toIndex >= currentPinned.length) return
var movedApp = currentPinned.splice(fromIndex, 1)[0] var movedApp = currentPinned.splice(fromIndex, 1)[0]
currentPinned.splice(toIndex, 0, movedApp) currentPinned.splice(toIndex, 0, movedApp)
Prefs.setPinnedApps(currentPinned) SessionData.setPinnedApps(currentPinned)
} }
Row { Row {
@@ -46,7 +46,7 @@ Item {
var items = [] var items = []
var runningApps = NiriService.getRunningAppIds() var runningApps = NiriService.getRunningAppIds()
var pinnedApps = [...Prefs.pinnedApps] var pinnedApps = [...SessionData.pinnedApps]
var addedApps = new Set() var addedApps = new Set()
pinnedApps.forEach(appId => { pinnedApps.forEach(appId => {
@@ -63,7 +63,7 @@ Item {
} }
}) })
root.pinnedAppCount = pinnedApps.length root.pinnedAppCount = pinnedApps.length
var appUsageRanking = Prefs.appUsageRanking || {} var appUsageRanking = AppUsageHistoryData.appUsageRanking || {}
var allUnpinnedApps = [] var allUnpinnedApps = []
for (var appId in appUsageRanking) { for (var appId in appUsageRanking) {
@@ -151,7 +151,7 @@ Item {
} }
Connections { Connections {
target: Prefs target: SessionData
function onPinnedAppsChanged() { dockModel.updateModel() } function onPinnedAppsChanged() { dockModel.updateModel() }
} }
} }

View File

@@ -160,9 +160,9 @@ PanelWindow {
onClicked: { onClicked: {
if (!root.appData) return if (!root.appData) return
if (root.appData.isPinned) { if (root.appData.isPinned) {
Prefs.removePinnedApp(root.appData.appId) SessionData.removePinnedApp(root.appData.appId)
} else { } else {
Prefs.addPinnedApp(root.appData.appId) SessionData.addPinnedApp(root.appData.appId)
} }
root.close() root.close()
} }

View File

@@ -70,7 +70,7 @@ Item {
Image { Image {
id: wallpaperBackground id: wallpaperBackground
anchors.fill: parent anchors.fill: parent
source: Prefs.wallpaperPath || "" source: SessionData.wallpaperPath || ""
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
smooth: true smooth: true
asynchronous: true asynchronous: true
@@ -114,7 +114,7 @@ Item {
id: clockText id: clockText
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
text: Prefs.use24HourClock ? Qt.formatTime(new Date(), "H:mm") : Qt.formatTime(new Date(), "h:mm AP") text: SettingsData.use24HourClock ? Qt.formatTime(new Date(), "H:mm") : Qt.formatTime(new Date(), "h:mm AP")
font.pixelSize: 120 font.pixelSize: 120
font.weight: Font.Light font.weight: Font.Light
color: "white" color: "white"
@@ -124,7 +124,7 @@ Item {
interval: 1000 interval: 1000
running: true running: true
repeat: true repeat: true
onTriggered: parent.text = Prefs.use24HourClock ? Qt.formatTime(new Date(), "H:mm") : Qt.formatTime(new Date(), "h:mm AP") onTriggered: parent.text = SettingsData.use24HourClock ? Qt.formatTime(new Date(), "H:mm") : Qt.formatTime(new Date(), "h:mm AP")
} }
} }
@@ -517,7 +517,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.margins: Theme.spacingXL anchors.margins: Theme.spacingXL
text: WeatherService.weather.available && WeatherService.weather.city && WeatherService.weather.city !== "Unknown" ? text: WeatherService.weather.available && WeatherService.weather.city && WeatherService.weather.city !== "Unknown" ?
`${WeatherService.weather.city} ${(Prefs.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp)}°${(Prefs.useFahrenheit ? "F" : "C")}` : `${WeatherService.weather.city} ${(SettingsData.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp)}°${(SettingsData.useFahrenheit ? "F" : "C")}` :
"" ""
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: "white" color: "white"

View File

@@ -26,11 +26,11 @@ Item {
DankActionButton { DankActionButton {
id: doNotDisturbButton id: doNotDisturbButton
iconName: Prefs.doNotDisturb ? "notifications_off" : "notifications" iconName: SessionData.doNotDisturb ? "notifications_off" : "notifications"
iconColor: Prefs.doNotDisturb ? Theme.error : Theme.surfaceText iconColor: SessionData.doNotDisturb ? Theme.error : Theme.surfaceText
buttonSize: 28 buttonSize: 28
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: Prefs.setDoNotDisturb(!Prefs.doNotDisturb) onClicked: SessionData.setDoNotDisturb(!SessionData.doNotDisturb)
Rectangle { Rectangle {
id: doNotDisturbTooltip id: doNotDisturbTooltip

View File

@@ -68,7 +68,7 @@ Rectangle {
StyledText { StyledText {
text: process ? process.displayName : "" text: process ? process.displayName : ""
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
width: 250 width: 250
@@ -100,7 +100,7 @@ Rectangle {
StyledText { StyledText {
text: SysMonitorService.formatCpuUsage(process ? process.cpu : 0) text: SysMonitorService.formatCpuUsage(process ? process.cpu : 0)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: { color: {
if (process && process.cpu > 80) if (process && process.cpu > 80)
@@ -138,7 +138,7 @@ Rectangle {
StyledText { StyledText {
text: SysMonitorService.formatMemoryUsage(process ? process.memoryKB : 0) text: SysMonitorService.formatMemoryUsage(process ? process.memoryKB : 0)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: { color: {
if (process && process.memoryKB > 1024 * 1024) if (process && process.memoryKB > 1024 * 1024)
@@ -157,7 +157,7 @@ Rectangle {
StyledText { StyledText {
text: process ? process.pid.toString() : "" text: process ? process.pid.toString() : ""
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
opacity: 0.7 opacity: 0.7
width: 50 width: 50

View File

@@ -35,7 +35,7 @@ Column {
StyledText { StyledText {
text: "Process" text: "Process"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "name" ? Font.Bold : Font.Medium font.weight: SysMonitorService.sortBy === "name" ? Font.Bold : Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "name" ? 1 : 0.7 opacity: SysMonitorService.sortBy === "name" ? 1 : 0.7
@@ -76,7 +76,7 @@ Column {
StyledText { StyledText {
text: "CPU" text: "CPU"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "cpu" ? Font.Bold : Font.Medium font.weight: SysMonitorService.sortBy === "cpu" ? Font.Bold : Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.7 opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.7
@@ -117,7 +117,7 @@ Column {
StyledText { StyledText {
text: "RAM" text: "RAM"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "memory" ? Font.Bold : Font.Medium font.weight: SysMonitorService.sortBy === "memory" ? Font.Bold : Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.7 opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.7
@@ -158,7 +158,7 @@ Column {
StyledText { StyledText {
text: "PID" text: "PID"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: SysMonitorService.sortBy === "pid" ? Font.Bold : Font.Medium font.weight: SysMonitorService.sortBy === "pid" ? Font.Bold : Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
opacity: SysMonitorService.sortBy === "pid" ? 1 : 0.7 opacity: SysMonitorService.sortBy === "pid" ? 1 : 0.7

View File

@@ -54,7 +54,7 @@ Row {
StyledText { StyledText {
text: SysMonitorService.totalCpuUsage.toFixed(1) + "%" text: SysMonitorService.totalCpuUsage.toFixed(1) + "%"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
} }
@@ -62,7 +62,7 @@ Row {
StyledText { StyledText {
text: SysMonitorService.cpuCount + " cores" text: SysMonitorService.cpuCount + " cores"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
opacity: 0.7 opacity: 0.7
} }
@@ -126,7 +126,7 @@ Row {
StyledText { StyledText {
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB) text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB)
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
} }
@@ -134,7 +134,7 @@ Row {
StyledText { StyledText {
text: "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) text: "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
opacity: 0.7 opacity: 0.7
} }
@@ -182,7 +182,7 @@ Row {
StyledText { StyledText {
text: SysMonitorService.totalSwapKB > 0 ? SysMonitorService.formatSystemMemory(SysMonitorService.usedSwapKB) : "None" text: SysMonitorService.totalSwapKB > 0 ? SysMonitorService.formatSystemMemory(SysMonitorService.usedSwapKB) : "None"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
} }
@@ -190,7 +190,7 @@ Row {
StyledText { StyledText {
text: SysMonitorService.totalSwapKB > 0 ? "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalSwapKB) : "No swap configured" text: SysMonitorService.totalSwapKB > 0 ? "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalSwapKB) : "No swap configured"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
opacity: 0.7 opacity: 0.7
} }

View File

@@ -53,7 +53,7 @@ ScrollView {
StyledText { StyledText {
text: SysMonitorService.hostname text: SysMonitorService.hostname
font.pixelSize: Theme.fontSizeXLarge font.pixelSize: Theme.fontSizeXLarge
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Light font.weight: Font.Light
color: Theme.surfaceText color: Theme.surfaceText
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@@ -62,7 +62,7 @@ ScrollView {
StyledText { StyledText {
text: SysMonitorService.distribution + " • " + SysMonitorService.architecture + " • " + SysMonitorService.kernelVersion text: SysMonitorService.distribution + " • " + SysMonitorService.architecture + " • " + SysMonitorService.kernelVersion
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@@ -70,7 +70,7 @@ ScrollView {
StyledText { StyledText {
text: "Up " + UserInfoService.uptime + " • Boot: " + SysMonitorService.bootTime text: "Up " + UserInfoService.uptime + " • Boot: " + SysMonitorService.bootTime
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@@ -78,7 +78,7 @@ ScrollView {
StyledText { StyledText {
text: "Load: " + SysMonitorService.loadAverage + " • " + SysMonitorService.processCount + " processes, " + SysMonitorService.threadCount + " threads" text: "Load: " + SysMonitorService.loadAverage + " • " + SysMonitorService.processCount + " processes, " + SysMonitorService.threadCount + " threads"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
@@ -128,7 +128,7 @@ ScrollView {
StyledText { StyledText {
text: "Hardware" text: "Hardware"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.primary color: Theme.primary
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -139,7 +139,7 @@ ScrollView {
StyledText { StyledText {
text: SysMonitorService.cpuModel text: SysMonitorService.cpuModel
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width width: parent.width
@@ -152,7 +152,7 @@ ScrollView {
StyledText { StyledText {
text: SysMonitorService.motherboard text: SysMonitorService.motherboard
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -164,7 +164,7 @@ ScrollView {
StyledText { StyledText {
text: "BIOS " + SysMonitorService.biosVersion text: "BIOS " + SysMonitorService.biosVersion
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -206,7 +206,7 @@ ScrollView {
StyledText { StyledText {
text: "Memory" text: "Memory"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.secondary color: Theme.secondary
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -217,7 +217,7 @@ ScrollView {
StyledText { StyledText {
text: SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) + " Total" text: SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) + " Total"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width width: parent.width
@@ -228,7 +228,7 @@ ScrollView {
StyledText { StyledText {
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB) + " Used • " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB - SysMonitorService.usedMemoryKB) + " Available" text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB) + " Used • " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB - SysMonitorService.usedMemoryKB) + " Available"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7) color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
width: parent.width width: parent.width
elide: Text.ElideRight elide: Text.ElideRight
@@ -280,7 +280,7 @@ ScrollView {
StyledText { StyledText {
text: "Storage & Disks" text: "Storage & Disks"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -300,7 +300,7 @@ ScrollView {
StyledText { StyledText {
text: "Device" text: "Device"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.25 width: parent.width * 0.25
@@ -311,7 +311,7 @@ ScrollView {
StyledText { StyledText {
text: "Mount" text: "Mount"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.2 width: parent.width * 0.2
@@ -322,7 +322,7 @@ ScrollView {
StyledText { StyledText {
text: "Size" text: "Size"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.15 width: parent.width * 0.15
@@ -333,7 +333,7 @@ ScrollView {
StyledText { StyledText {
text: "Used" text: "Used"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.15 width: parent.width * 0.15
@@ -344,7 +344,7 @@ ScrollView {
StyledText { StyledText {
text: "Available" text: "Available"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.15 width: parent.width * 0.15
@@ -355,7 +355,7 @@ ScrollView {
StyledText { StyledText {
text: "Use%" text: "Use%"
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
font.weight: Font.Bold font.weight: Font.Bold
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.1 width: parent.width * 0.1
@@ -390,7 +390,7 @@ ScrollView {
StyledText { StyledText {
text: modelData.device text: modelData.device
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.25 width: parent.width * 0.25
elide: Text.ElideRight elide: Text.ElideRight
@@ -401,7 +401,7 @@ ScrollView {
StyledText { StyledText {
text: modelData.mount text: modelData.mount
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.2 width: parent.width * 0.2
elide: Text.ElideRight elide: Text.ElideRight
@@ -412,7 +412,7 @@ ScrollView {
StyledText { StyledText {
text: modelData.size text: modelData.size
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.15 width: parent.width * 0.15
elide: Text.ElideRight elide: Text.ElideRight
@@ -423,7 +423,7 @@ ScrollView {
StyledText { StyledText {
text: modelData.used text: modelData.used
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.15 width: parent.width * 0.15
elide: Text.ElideRight elide: Text.ElideRight
@@ -434,7 +434,7 @@ ScrollView {
StyledText { StyledText {
text: modelData.avail text: modelData.avail
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: Theme.surfaceText color: Theme.surfaceText
width: parent.width * 0.15 width: parent.width * 0.15
elide: Text.ElideRight elide: Text.ElideRight
@@ -445,7 +445,7 @@ ScrollView {
StyledText { StyledText {
text: modelData.percent text: modelData.percent
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily font.family: SettingsData.monoFontFamily
color: { color: {
const percent = parseInt(modelData.percent); const percent = parseInt(modelData.percent);
if (percent > 90) if (percent > 90)

View File

@@ -60,9 +60,9 @@ ScrollView {
width: parent.width width: parent.width
text: "Night Mode" text: "Night Mode"
description: "Apply warm color temperature to reduce eye strain" description: "Apply warm color temperature to reduce eye strain"
checked: Prefs.nightModeEnabled checked: SettingsData.nightModeEnabled
onToggled: (checked) => { onToggled: (checked) => {
Prefs.setNightModeEnabled(checked); SettingsData.setNightModeEnabled(checked);
if (checked) if (checked)
nightModeEnableProcess.running = true; nightModeEnableProcess.running = true;
else else
@@ -74,9 +74,9 @@ ScrollView {
width: parent.width width: parent.width
text: "Light Mode" text: "Light Mode"
description: "Use light theme instead of dark theme" description: "Use light theme instead of dark theme"
checked: Prefs.isLightMode checked: SessionData.isLightMode
onToggled: (checked) => { onToggled: (checked) => {
Prefs.setLightMode(checked); SessionData.setLightMode(checked);
Theme.isLightMode = checked; Theme.isLightMode = checked;
PortalService.setLightMode(checked); PortalService.setLightMode(checked);
} }
@@ -86,17 +86,17 @@ ScrollView {
width: parent.width width: parent.width
text: "Icon Theme" text: "Icon Theme"
description: "Select icon theme" description: "Select icon theme"
currentValue: Prefs.iconTheme currentValue: SettingsData.iconTheme
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: { options: {
Prefs.detectAvailableIconThemes(); SettingsData.detectAvailableIconThemes();
return Prefs.availableIconThemes; return SettingsData.availableIconThemes;
} }
onValueChanged: (value) => { onValueChanged: (value) => {
Prefs.setIconTheme(value); SettingsData.setIconTheme(value);
if (value !== "System Default" && !Prefs.qt5ctAvailable && !Prefs.qt6ctAvailable) if (value !== "System Default" && !SettingsData.qt5ctAvailable && !SettingsData.qt6ctAvailable)
ToastService.showWarning("qt5ct or qt6ct not found - Qt app themes may not update without these tools"); ToastService.showWarning("qt5ct or qt6ct not found - Qt app themes may not update without these tools");
} }
@@ -107,16 +107,16 @@ ScrollView {
text: "Font Family" text: "Font Family"
description: "Select system font family" description: "Select system font family"
currentValue: { currentValue: {
if (Prefs.fontFamily === Prefs.defaultFontFamily) if (SettingsData.fontFamily === SettingsData.defaultFontFamily)
return "Default (" + Prefs.defaultFontFamily + ")"; return "Default (" + SettingsData.defaultFontFamily + ")";
else else
return Prefs.fontFamily || "Default (" + Prefs.defaultFontFamily + ")"; return SettingsData.fontFamily || "Default (" + SettingsData.defaultFontFamily + ")";
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: { options: {
var fonts = ["Default (" + Prefs.defaultFontFamily + ")"]; var fonts = ["Default (" + SettingsData.defaultFontFamily + ")"];
var availableFonts = Qt.fontFamilies(); var availableFonts = Qt.fontFamilies();
var rootFamilies = []; var rootFamilies = [];
var seenFamilies = new Set(); var seenFamilies = new Set();
@@ -125,7 +125,7 @@ ScrollView {
if (fontName.startsWith(".")) if (fontName.startsWith("."))
continue; continue;
if (fontName === Prefs.defaultFontFamily) if (fontName === SettingsData.defaultFontFamily)
continue; continue;
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) { var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) {
@@ -140,9 +140,9 @@ ScrollView {
} }
onValueChanged: (value) => { onValueChanged: (value) => {
if (value.startsWith("Default (")) if (value.startsWith("Default ("))
Prefs.setFontFamily(Prefs.defaultFontFamily); SettingsData.setFontFamily(SettingsData.defaultFontFamily);
else else
Prefs.setFontFamily(value); SettingsData.setFontFamily(value);
} }
} }
@@ -151,7 +151,7 @@ ScrollView {
text: "Font Weight" text: "Font Weight"
description: "Select font weight" description: "Select font weight"
currentValue: { currentValue: {
switch (Prefs.fontWeight) { switch (SettingsData.fontWeight) {
case Font.Thin: case Font.Thin:
return "Thin"; return "Thin";
case Font.ExtraLight: case Font.ExtraLight:
@@ -209,7 +209,7 @@ ScrollView {
weight = Font.Normal; weight = Font.Normal;
break; break;
} }
Prefs.setFontWeight(weight); SettingsData.setFontWeight(weight);
} }
} }
@@ -218,10 +218,10 @@ ScrollView {
text: "Monospace Font" text: "Monospace Font"
description: "Select monospace font for process list and technical displays" description: "Select monospace font for process list and technical displays"
currentValue: { currentValue: {
if (Prefs.monoFontFamily === Prefs.defaultMonoFontFamily) if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily)
return "Default"; return "Default";
return Prefs.monoFontFamily || "Default"; return SettingsData.monoFontFamily || "Default";
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
@@ -236,7 +236,7 @@ ScrollView {
if (fontName.startsWith(".")) if (fontName.startsWith("."))
continue; continue;
if (fontName === Prefs.defaultMonoFontFamily) if (fontName === SettingsData.defaultMonoFontFamily)
continue; continue;
var lowerName = fontName.toLowerCase(); var lowerName = fontName.toLowerCase();
@@ -252,9 +252,9 @@ ScrollView {
} }
onValueChanged: (value) => { onValueChanged: (value) => {
if (value === "Default") if (value === "Default")
Prefs.setMonoFontFamily(Prefs.defaultMonoFontFamily); SettingsData.setMonoFontFamily(SettingsData.defaultMonoFontFamily);
else else
Prefs.setMonoFontFamily(value); SettingsData.setMonoFontFamily(value);
} }
} }
@@ -312,13 +312,13 @@ ScrollView {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(Prefs.topBarTransparency * 100) value: Math.round(SettingsData.topBarTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: (newValue) => {
Prefs.setTopBarTransparency(newValue / 100); SettingsData.setTopBarTransparency(newValue / 100);
} }
} }
@@ -338,13 +338,13 @@ ScrollView {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(Prefs.topBarWidgetTransparency * 100) value: Math.round(SettingsData.topBarWidgetTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: (newValue) => {
Prefs.setTopBarWidgetTransparency(newValue / 100); SettingsData.setTopBarWidgetTransparency(newValue / 100);
} }
} }
@@ -364,13 +364,13 @@ ScrollView {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(Prefs.popupTransparency * 100) value: Math.round(SettingsData.popupTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: (newValue) => {
Prefs.setPopupTransparency(newValue / 100); SettingsData.setPopupTransparency(newValue / 100);
} }
} }
@@ -790,9 +790,9 @@ ScrollView {
text: "Theme GTK Applications" text: "Theme GTK Applications"
description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)" description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)"
enabled: Colors.gtkThemingEnabled enabled: Colors.gtkThemingEnabled
checked: Colors.gtkThemingEnabled && Prefs.gtkThemingEnabled checked: Colors.gtkThemingEnabled && SettingsData.gtkThemingEnabled
onToggled: function(checked) { onToggled: function(checked) {
Prefs.setGtkThemingEnabled(checked); SettingsData.setGtkThemingEnabled(checked);
if (checked && Theme.isDynamicTheme) if (checked && Theme.isDynamicTheme)
Colors.generateGtkThemes(); Colors.generateGtkThemes();
@@ -804,9 +804,9 @@ ScrollView {
text: "Theme Qt Applications" text: "Theme Qt Applications"
description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)" description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)"
enabled: Colors.qtThemingEnabled enabled: Colors.qtThemingEnabled
checked: Colors.qtThemingEnabled && Prefs.qtThemingEnabled checked: Colors.qtThemingEnabled && SettingsData.qtThemingEnabled
onToggled: function(checked) { onToggled: function(checked) {
Prefs.setQtThemingEnabled(checked); SettingsData.setQtThemingEnabled(checked);
if (checked && Theme.isDynamicTheme) if (checked && Theme.isDynamicTheme)
Colors.generateQtThemes(); Colors.generateQtThemes();
@@ -826,7 +826,7 @@ ScrollView {
running: false running: false
onExited: (exitCode) => { onExited: (exitCode) => {
if (exitCode !== 0) if (exitCode !== 0)
Prefs.setNightModeEnabled(true); SettingsData.setNightModeEnabled(true);
} }
} }
@@ -838,7 +838,7 @@ ScrollView {
running: false running: false
onExited: (exitCode) => { onExited: (exitCode) => {
if (exitCode !== 0) if (exitCode !== 0)
Prefs.setNightModeEnabled(false); SettingsData.setNightModeEnabled(false);
} }
} }

View File

@@ -37,16 +37,16 @@ ScrollView {
width: parent.width width: parent.width
text: "Use OS Logo" text: "Use OS Logo"
description: "Display operating system logo instead of apps icon" description: "Display operating system logo instead of apps icon"
checked: Prefs.useOSLogo checked: SettingsData.useOSLogo
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setUseOSLogo(checked); return SettingsData.setUseOSLogo(checked);
} }
} }
Row { Row {
width: parent.width - Theme.spacingL width: parent.width - Theme.spacingL
spacing: Theme.spacingL spacing: Theme.spacingL
visible: Prefs.useOSLogo visible: SettingsData.useOSLogo
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Theme.spacingL anchors.leftMargin: Theme.spacingL
@@ -66,7 +66,7 @@ ScrollView {
width: 100 width: 100
height: 28 height: 28
placeholderText: "#ffffff" placeholderText: "#ffffff"
text: Prefs.osLogoColorOverride text: SettingsData.osLogoColorOverride
maximumLength: 7 maximumLength: 7
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
topPadding: Theme.spacingXS topPadding: Theme.spacingXS
@@ -74,9 +74,9 @@ ScrollView {
onEditingFinished: { onEditingFinished: {
var color = text.trim(); var color = text.trim();
if (color === "" || /^#[0-9A-Fa-f]{6}$/.test(color)) if (color === "" || /^#[0-9A-Fa-f]{6}$/.test(color))
Prefs.setOSLogoColorOverride(color); SettingsData.setOSLogoColorOverride(color);
else else
text = Prefs.osLogoColorOverride; text = SettingsData.osLogoColorOverride;
} }
} }
@@ -98,11 +98,11 @@ ScrollView {
height: 20 height: 20
minimum: 0 minimum: 0
maximum: 100 maximum: 100
value: Math.round(Prefs.osLogoBrightness * 100) value: Math.round(SettingsData.osLogoBrightness * 100)
unit: "%" unit: "%"
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: (newValue) => {
Prefs.setOSLogoBrightness(newValue / 100); SettingsData.setOSLogoBrightness(newValue / 100);
} }
} }
@@ -124,11 +124,11 @@ ScrollView {
height: 20 height: 20
minimum: 0 minimum: 0
maximum: 200 maximum: 200
value: Math.round(Prefs.osLogoContrast * 100) value: Math.round(SettingsData.osLogoContrast * 100)
unit: "%" unit: "%"
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: (newValue) => {
Prefs.setOSLogoContrast(newValue / 100); SettingsData.setOSLogoContrast(newValue / 100);
} }
} }
@@ -187,9 +187,9 @@ ScrollView {
width: parent.width width: parent.width
text: "Show Dock" text: "Show Dock"
description: "Display a dock at the bottom of the screen with pinned and running applications" description: "Display a dock at the bottom of the screen with pinned and running applications"
checked: Prefs.showDock checked: SettingsData.showDock
onToggled: (checked) => { onToggled: (checked) => {
Prefs.setShowDock(checked) SettingsData.setShowDock(checked)
} }
} }
@@ -197,11 +197,11 @@ ScrollView {
width: parent.width width: parent.width
text: "Auto-hide Dock" text: "Auto-hide Dock"
description: "Hide the dock when not in use and reveal it when hovering near the bottom of the screen" description: "Hide the dock when not in use and reveal it when hovering near the bottom of the screen"
checked: Prefs.dockAutoHide checked: SettingsData.dockAutoHide
visible: Prefs.showDock visible: SettingsData.showDock
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
onToggled: (checked) => { onToggled: (checked) => {
Prefs.setDockAutoHide(checked) SettingsData.setDockAutoHide(checked)
} }
Behavior on opacity { Behavior on opacity {
@@ -215,7 +215,7 @@ ScrollView {
Column { Column {
width: parent.width width: parent.width
spacing: Theme.spacingS spacing: Theme.spacingS
visible: Prefs.showDock visible: SettingsData.showDock
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
StyledText { StyledText {
@@ -228,13 +228,13 @@ ScrollView {
DankSlider { DankSlider {
width: parent.width width: parent.width
height: 24 height: 24
value: Math.round(Prefs.dockTransparency * 100) value: Math.round(SettingsData.dockTransparency * 100)
minimum: 0 minimum: 0
maximum: 100 maximum: 100
unit: "" unit: ""
showValue: true showValue: true
onSliderValueChanged: (newValue) => { onSliderValueChanged: (newValue) => {
Prefs.setDockTransparency(newValue / 100); SettingsData.setDockTransparency(newValue / 100);
} }
} }
@@ -262,8 +262,8 @@ ScrollView {
property var rankedAppsModel: { property var rankedAppsModel: {
var apps = []; var apps = [];
for (var appId in Prefs.appUsageRanking) { for (var appId in AppUsageHistoryData.appUsageRanking) {
var appData = Prefs.appUsageRanking[appId]; var appData = AppUsageHistoryData.appUsageRanking[appId];
apps.push({ apps.push({
"id": appId, "id": appId,
"name": appData.name, "name": appData.name,
@@ -320,9 +320,9 @@ ScrollView {
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: { onClicked: {
Prefs.appUsageRanking = { AppUsageHistoryData.appUsageRanking = {
}; };
Prefs.saveSettings(); SettingsData.saveSettings();
} }
} }
@@ -438,10 +438,10 @@ ScrollView {
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
onClicked: { onClicked: {
var currentRanking = Object.assign({ var currentRanking = Object.assign({
}, Prefs.appUsageRanking); }, AppUsageHistoryData.appUsageRanking);
delete currentRanking[modelData.id]; delete currentRanking[modelData.id];
Prefs.appUsageRanking = currentRanking; AppUsageHistoryData.appUsageRanking = currentRanking;
Prefs.saveSettings(); SettingsData.saveSettings();
} }
} }

View File

@@ -334,9 +334,9 @@ ScrollView {
CachingImage { CachingImage {
anchors.fill: parent anchors.fill: parent
anchors.margins: 1 anchors.margins: 1
imagePath: Prefs.wallpaperPath || "" imagePath: SessionData.wallpaperPath || ""
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
visible: Prefs.wallpaperPath !== "" visible: SessionData.wallpaperPath !== ""
maxCacheSize: 160 maxCacheSize: 160
layer.enabled: true layer.enabled: true
@@ -365,7 +365,7 @@ ScrollView {
name: "image" name: "image"
size: Theme.iconSizeLarge + 8 size: Theme.iconSizeLarge + 8
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
visible: Prefs.wallpaperPath === "" visible: SessionData.wallpaperPath === ""
} }
} }
@@ -376,7 +376,7 @@ ScrollView {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
text: Prefs.wallpaperPath ? Prefs.wallpaperPath.split('/').pop() : "No wallpaper selected" text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split('/').pop() : "No wallpaper selected"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText color: Theme.surfaceText
elide: Text.ElideMiddle elide: Text.ElideMiddle
@@ -384,12 +384,12 @@ ScrollView {
} }
StyledText { StyledText {
text: Prefs.wallpaperPath ? Prefs.wallpaperPath : "" text: SessionData.wallpaperPath ? SessionData.wallpaperPath : ""
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
elide: Text.ElideMiddle elide: Text.ElideMiddle
width: parent.width width: parent.width
visible: Prefs.wallpaperPath !== "" visible: SessionData.wallpaperPath !== ""
} }
Row { Row {
@@ -437,7 +437,7 @@ ScrollView {
height: 32 height: 32
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Theme.surfaceVariant color: Theme.surfaceVariant
opacity: Prefs.wallpaperPath !== "" ? 1 : 0.5 opacity: SessionData.wallpaperPath !== "" ? 1 : 0.5
Row { Row {
anchors.centerIn: parent anchors.centerIn: parent
@@ -461,10 +461,10 @@ ScrollView {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: Prefs.wallpaperPath !== "" enabled: SessionData.wallpaperPath !== ""
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: { onClicked: {
Prefs.setWallpaperPath(""); SessionData.setWallpaper("");
} }
} }
@@ -593,7 +593,7 @@ ScrollView {
browserType: "wallpaper" browserType: "wallpaper"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"] fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: (path) => { onFileSelected: (path) => {
Prefs.setWallpaperPath(path); SessionData.setWallpaper(path);
visible = false; visible = false;
} }
onDialogClosed: {} onDialogClosed: {}

View File

@@ -55,9 +55,9 @@ ScrollView {
width: parent.width width: parent.width
text: "24-Hour Format" text: "24-Hour Format"
description: "Use 24-hour time format instead of 12-hour AM/PM" description: "Use 24-hour time format instead of 12-hour AM/PM"
checked: Prefs.use24HourClock checked: SettingsData.use24HourClock
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setClockFormat(checked); return SettingsData.setClockFormat(checked);
} }
} }
@@ -105,9 +105,9 @@ ScrollView {
width: parent.width width: parent.width
text: "Enable Weather" text: "Enable Weather"
description: "Show weather information in top bar and centcom center" description: "Show weather information in top bar and centcom center"
checked: Prefs.weatherEnabled checked: SettingsData.weatherEnabled
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setWeatherEnabled(checked); return SettingsData.setWeatherEnabled(checked);
} }
} }
@@ -115,10 +115,10 @@ ScrollView {
width: parent.width width: parent.width
text: "Fahrenheit" text: "Fahrenheit"
description: "Use Fahrenheit instead of Celsius for temperature" description: "Use Fahrenheit instead of Celsius for temperature"
checked: Prefs.useFahrenheit checked: SettingsData.useFahrenheit
enabled: Prefs.weatherEnabled enabled: SettingsData.weatherEnabled
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setTemperatureUnit(checked); return SettingsData.setTemperatureUnit(checked);
} }
} }
@@ -126,17 +126,17 @@ ScrollView {
width: parent.width width: parent.width
text: "Auto Location" text: "Auto Location"
description: "Allow wttr.in to determine location based on IP address" description: "Allow wttr.in to determine location based on IP address"
checked: Prefs.useAutoLocation checked: SettingsData.useAutoLocation
enabled: Prefs.weatherEnabled enabled: SettingsData.weatherEnabled
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setAutoLocation(checked); return SettingsData.setAutoLocation(checked);
} }
} }
Column { Column {
width: parent.width width: parent.width
spacing: Theme.spacingXS spacing: Theme.spacingXS
visible: !Prefs.useAutoLocation && Prefs.weatherEnabled visible: !SettingsData.useAutoLocation && SettingsData.weatherEnabled
StyledText { StyledText {
text: "Location" text: "Location"
@@ -147,10 +147,10 @@ ScrollView {
DankLocationSearch { DankLocationSearch {
width: parent.width width: parent.width
currentLocation: Prefs.weatherLocation currentLocation: SettingsData.weatherLocation
placeholderText: "New York, NY" placeholderText: "New York, NY"
onLocationSelected: (displayName, coordinates) => { onLocationSelected: (displayName, coordinates) => {
Prefs.setWeatherLocation(displayName, coordinates); SettingsData.setWeatherLocation(displayName, coordinates);
} }
} }

View File

@@ -141,54 +141,54 @@ ScrollView {
var widgets = []; var widgets = [];
if (targetSection === "left") { if (targetSection === "left") {
widgets = Prefs.topBarLeftWidgets.slice(); widgets = SettingsData.topBarLeftWidgets.slice();
widgets.push(widgetObj); widgets.push(widgetObj);
Prefs.setTopBarLeftWidgets(widgets); SettingsData.setTopBarLeftWidgets(widgets);
} else if (targetSection === "center") { } else if (targetSection === "center") {
widgets = Prefs.topBarCenterWidgets.slice(); widgets = SettingsData.topBarCenterWidgets.slice();
widgets.push(widgetObj); widgets.push(widgetObj);
Prefs.setTopBarCenterWidgets(widgets); SettingsData.setTopBarCenterWidgets(widgets);
} else if (targetSection === "right") { } else if (targetSection === "right") {
widgets = Prefs.topBarRightWidgets.slice(); widgets = SettingsData.topBarRightWidgets.slice();
widgets.push(widgetObj); widgets.push(widgetObj);
Prefs.setTopBarRightWidgets(widgets); SettingsData.setTopBarRightWidgets(widgets);
} }
} }
function removeWidgetFromSection(sectionId, itemId) { function removeWidgetFromSection(sectionId, itemId) {
var widgets = []; var widgets = [];
if (sectionId === "left") { if (sectionId === "left") {
widgets = Prefs.topBarLeftWidgets.slice(); widgets = SettingsData.topBarLeftWidgets.slice();
widgets = widgets.filter((widget) => { widgets = widgets.filter((widget) => {
var widgetId = typeof widget === "string" ? widget : widget.id; var widgetId = typeof widget === "string" ? widget : widget.id;
return widgetId !== itemId; return widgetId !== itemId;
}); });
Prefs.setTopBarLeftWidgets(widgets); SettingsData.setTopBarLeftWidgets(widgets);
} else if (sectionId === "center") { } else if (sectionId === "center") {
widgets = Prefs.topBarCenterWidgets.slice(); widgets = SettingsData.topBarCenterWidgets.slice();
widgets = widgets.filter((widget) => { widgets = widgets.filter((widget) => {
var widgetId = typeof widget === "string" ? widget : widget.id; var widgetId = typeof widget === "string" ? widget : widget.id;
return widgetId !== itemId; return widgetId !== itemId;
}); });
Prefs.setTopBarCenterWidgets(widgets); SettingsData.setTopBarCenterWidgets(widgets);
} else if (sectionId === "right") { } else if (sectionId === "right") {
widgets = Prefs.topBarRightWidgets.slice(); widgets = SettingsData.topBarRightWidgets.slice();
widgets = widgets.filter((widget) => { widgets = widgets.filter((widget) => {
var widgetId = typeof widget === "string" ? widget : widget.id; var widgetId = typeof widget === "string" ? widget : widget.id;
return widgetId !== itemId; return widgetId !== itemId;
}); });
Prefs.setTopBarRightWidgets(widgets); SettingsData.setTopBarRightWidgets(widgets);
} }
} }
function handleItemEnabledChanged(sectionId, itemId, enabled) { function handleItemEnabledChanged(sectionId, itemId, enabled) {
var widgets = []; var widgets = [];
if (sectionId === "left") if (sectionId === "left")
widgets = Prefs.topBarLeftWidgets.slice(); widgets = SettingsData.topBarLeftWidgets.slice();
else if (sectionId === "center") else if (sectionId === "center")
widgets = Prefs.topBarCenterWidgets.slice(); widgets = SettingsData.topBarCenterWidgets.slice();
else if (sectionId === "right") else if (sectionId === "right")
widgets = Prefs.topBarRightWidgets.slice(); widgets = SettingsData.topBarRightWidgets.slice();
for (var i = 0; i < widgets.length; i++) { for (var i = 0; i < widgets.length; i++) {
var widget = widgets[i]; var widget = widgets[i];
var widgetId = typeof widget === "string" ? widget : widget.id; var widgetId = typeof widget === "string" ? widget : widget.id;
@@ -205,30 +205,30 @@ ScrollView {
} }
} }
if (sectionId === "left") if (sectionId === "left")
Prefs.setTopBarLeftWidgets(widgets); SettingsData.setTopBarLeftWidgets(widgets);
else if (sectionId === "center") else if (sectionId === "center")
Prefs.setTopBarCenterWidgets(widgets); SettingsData.setTopBarCenterWidgets(widgets);
else if (sectionId === "right") else if (sectionId === "right")
Prefs.setTopBarRightWidgets(widgets); SettingsData.setTopBarRightWidgets(widgets);
} }
function handleItemOrderChanged(sectionId, newOrder) { function handleItemOrderChanged(sectionId, newOrder) {
if (sectionId === "left") if (sectionId === "left")
Prefs.setTopBarLeftWidgets(newOrder); SettingsData.setTopBarLeftWidgets(newOrder);
else if (sectionId === "center") else if (sectionId === "center")
Prefs.setTopBarCenterWidgets(newOrder); SettingsData.setTopBarCenterWidgets(newOrder);
else if (sectionId === "right") else if (sectionId === "right")
Prefs.setTopBarRightWidgets(newOrder); SettingsData.setTopBarRightWidgets(newOrder);
} }
function handleSpacerSizeChanged(sectionId, itemId, newSize) { function handleSpacerSizeChanged(sectionId, itemId, newSize) {
var widgets = []; var widgets = [];
if (sectionId === "left") if (sectionId === "left")
widgets = Prefs.topBarLeftWidgets.slice(); widgets = SettingsData.topBarLeftWidgets.slice();
else if (sectionId === "center") else if (sectionId === "center")
widgets = Prefs.topBarCenterWidgets.slice(); widgets = SettingsData.topBarCenterWidgets.slice();
else if (sectionId === "right") else if (sectionId === "right")
widgets = Prefs.topBarRightWidgets.slice(); widgets = SettingsData.topBarRightWidgets.slice();
for (var i = 0; i < widgets.length; i++) { for (var i = 0; i < widgets.length; i++) {
var widget = widgets[i]; var widget = widgets[i];
var widgetId = typeof widget === "string" ? widget : widget.id; var widgetId = typeof widget === "string" ? widget : widget.id;
@@ -246,22 +246,22 @@ ScrollView {
} }
} }
if (sectionId === "left") if (sectionId === "left")
Prefs.setTopBarLeftWidgets(widgets); SettingsData.setTopBarLeftWidgets(widgets);
else if (sectionId === "center") else if (sectionId === "center")
Prefs.setTopBarCenterWidgets(widgets); SettingsData.setTopBarCenterWidgets(widgets);
else if (sectionId === "right") else if (sectionId === "right")
Prefs.setTopBarRightWidgets(widgets); SettingsData.setTopBarRightWidgets(widgets);
} }
function getItemsForSection(sectionId) { function getItemsForSection(sectionId) {
var widgets = []; var widgets = [];
var widgetData = []; var widgetData = [];
if (sectionId === "left") if (sectionId === "left")
widgetData = Prefs.topBarLeftWidgets || []; widgetData = SettingsData.topBarLeftWidgets || [];
else if (sectionId === "center") else if (sectionId === "center")
widgetData = Prefs.topBarCenterWidgets || []; widgetData = SettingsData.topBarCenterWidgets || [];
else if (sectionId === "right") else if (sectionId === "right")
widgetData = Prefs.topBarRightWidgets || []; widgetData = SettingsData.topBarRightWidgets || [];
widgetData.forEach((widget) => { widgetData.forEach((widget) => {
var widgetId = typeof widget === "string" ? widget : widget.id; var widgetId = typeof widget === "string" ? widget : widget.id;
var widgetEnabled = typeof widget === "string" ? true : widget.enabled; var widgetEnabled = typeof widget === "string" ? true : widget.enabled;
@@ -285,23 +285,23 @@ ScrollView {
contentHeight: column.implicitHeight + Theme.spacingXL contentHeight: column.implicitHeight + Theme.spacingXL
clip: true clip: true
Component.onCompleted: { Component.onCompleted: {
if (!Prefs.topBarLeftWidgets || Prefs.topBarLeftWidgets.length === 0) if (!SettingsData.topBarLeftWidgets || SettingsData.topBarLeftWidgets.length === 0)
Prefs.setTopBarLeftWidgets(defaultLeftWidgets); SettingsData.setTopBarLeftWidgets(defaultLeftWidgets);
if (!Prefs.topBarCenterWidgets || Prefs.topBarCenterWidgets.length === 0) if (!SettingsData.topBarCenterWidgets || SettingsData.topBarCenterWidgets.length === 0)
Prefs.setTopBarCenterWidgets(defaultCenterWidgets); SettingsData.setTopBarCenterWidgets(defaultCenterWidgets);
if (!Prefs.topBarRightWidgets || Prefs.topBarRightWidgets.length === 0) if (!SettingsData.topBarRightWidgets || SettingsData.topBarRightWidgets.length === 0)
Prefs.setTopBarRightWidgets(defaultRightWidgets); SettingsData.setTopBarRightWidgets(defaultRightWidgets);
["left", "center", "right"].forEach((sectionId) => { ["left", "center", "right"].forEach((sectionId) => {
var widgets = []; var widgets = [];
if (sectionId === "left") if (sectionId === "left")
widgets = Prefs.topBarLeftWidgets.slice(); widgets = SettingsData.topBarLeftWidgets.slice();
else if (sectionId === "center") else if (sectionId === "center")
widgets = Prefs.topBarCenterWidgets.slice(); widgets = SettingsData.topBarCenterWidgets.slice();
else if (sectionId === "right") else if (sectionId === "right")
widgets = Prefs.topBarRightWidgets.slice(); widgets = SettingsData.topBarRightWidgets.slice();
var updated = false; var updated = false;
for (var i = 0; i < widgets.length; i++) { for (var i = 0; i < widgets.length; i++) {
var widget = widgets[i]; var widget = widgets[i];
@@ -315,11 +315,11 @@ ScrollView {
} }
if (updated) { if (updated) {
if (sectionId === "left") if (sectionId === "left")
Prefs.setTopBarLeftWidgets(widgets); SettingsData.setTopBarLeftWidgets(widgets);
else if (sectionId === "center") else if (sectionId === "center")
Prefs.setTopBarCenterWidgets(widgets); SettingsData.setTopBarCenterWidgets(widgets);
else if (sectionId === "right") else if (sectionId === "right")
Prefs.setTopBarRightWidgets(widgets); SettingsData.setTopBarRightWidgets(widgets);
} }
}); });
} }
@@ -393,9 +393,9 @@ ScrollView {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Prefs.setTopBarLeftWidgets(defaultLeftWidgets); SettingsData.setTopBarLeftWidgets(defaultLeftWidgets);
Prefs.setTopBarCenterWidgets(defaultCenterWidgets); SettingsData.setTopBarCenterWidgets(defaultCenterWidgets);
Prefs.setTopBarRightWidgets(defaultRightWidgets); SettingsData.setTopBarRightWidgets(defaultRightWidgets);
} }
} }
@@ -473,9 +473,9 @@ ScrollView {
} }
onCompactModeChanged: (widgetId, enabled) => { onCompactModeChanged: (widgetId, enabled) => {
if (widgetId === "clock") { if (widgetId === "clock") {
Prefs.setClockCompactMode(enabled); SettingsData.setClockCompactMode(enabled);
} else if (widgetId === "music") { } else if (widgetId === "music") {
Prefs.setMediaCompactMode(enabled); SettingsData.setMediaCompactMode(enabled);
} }
} }
} }
@@ -506,9 +506,9 @@ ScrollView {
} }
onCompactModeChanged: (widgetId, enabled) => { onCompactModeChanged: (widgetId, enabled) => {
if (widgetId === "clock") { if (widgetId === "clock") {
Prefs.setClockCompactMode(enabled); SettingsData.setClockCompactMode(enabled);
} else if (widgetId === "music") { } else if (widgetId === "music") {
Prefs.setMediaCompactMode(enabled); SettingsData.setMediaCompactMode(enabled);
} }
} }
} }
@@ -539,9 +539,9 @@ ScrollView {
} }
onCompactModeChanged: (widgetId, enabled) => { onCompactModeChanged: (widgetId, enabled) => {
if (widgetId === "clock") { if (widgetId === "clock") {
Prefs.setClockCompactMode(enabled); SettingsData.setClockCompactMode(enabled);
} else if (widgetId === "music") { } else if (widgetId === "music") {
Prefs.setMediaCompactMode(enabled); SettingsData.setMediaCompactMode(enabled);
} }
} }
} }
@@ -588,9 +588,9 @@ ScrollView {
width: parent.width width: parent.width
text: "Workspace Index Numbers" text: "Workspace Index Numbers"
description: "Show workspace index numbers in the top bar workspace switcher" description: "Show workspace index numbers in the top bar workspace switcher"
checked: Prefs.showWorkspaceIndex checked: SettingsData.showWorkspaceIndex
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setShowWorkspaceIndex(checked); return SettingsData.setShowWorkspaceIndex(checked);
} }
} }
@@ -598,9 +598,9 @@ ScrollView {
width: parent.width width: parent.width
text: "Workspace Padding" text: "Workspace Padding"
description: "Always show a minimum of 3 workspaces, even if fewer are available" description: "Always show a minimum of 3 workspaces, even if fewer are available"
checked: Prefs.showWorkspacePadding checked: SettingsData.showWorkspacePadding
onToggled: (checked) => { onToggled: (checked) => {
return Prefs.setShowWorkspacePadding(checked); return SettingsData.setShowWorkspacePadding(checked);
} }
} }

View File

@@ -32,7 +32,7 @@ Rectangle {
spacing: Theme.spacingS spacing: Theme.spacingS
StyledText { StyledText {
text: Prefs.use24HourClock ? Qt.formatTime(root.currentDate, "H:mm") : Qt.formatTime(root.currentDate, "h:mm AP") text: SettingsData.use24HourClock ? Qt.formatTime(root.currentDate, "H:mm") : Qt.formatTime(root.currentDate, "h:mm AP")
font.pixelSize: Theme.fontSizeMedium - 1 font.pixelSize: Theme.fontSizeMedium - 1
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -43,7 +43,7 @@ Rectangle {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.outlineButton color: Theme.outlineButton
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !Prefs.clockCompactMode visible: !SettingsData.clockCompactMode
} }
StyledText { StyledText {
@@ -51,7 +51,7 @@ Rectangle {
font.pixelSize: Theme.fontSizeMedium - 1 font.pixelSize: Theme.fontSizeMedium - 1
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !Prefs.clockCompactMode visible: !SettingsData.clockCompactMode
} }
} }

View File

@@ -22,17 +22,17 @@ Rectangle {
} }
SystemLogo { SystemLogo {
visible: Prefs.useOSLogo visible: SettingsData.useOSLogo
anchors.centerIn: parent anchors.centerIn: parent
width: Theme.iconSize - 3 width: Theme.iconSize - 3
height: Theme.iconSize - 3 height: Theme.iconSize - 3
colorOverride: Prefs.osLogoColorOverride colorOverride: SettingsData.osLogoColorOverride
brightnessOverride: Prefs.osLogoBrightness brightnessOverride: SettingsData.osLogoBrightness
contrastOverride: Prefs.osLogoContrast contrastOverride: SettingsData.osLogoContrast
} }
DankIcon { DankIcon {
visible: !Prefs.useOSLogo visible: !SettingsData.useOSLogo
anchors.centerIn: parent anchors.centerIn: parent
name: "apps" name: "apps"
size: Theme.iconSize - 6 size: Theme.iconSize - 6

View File

@@ -33,7 +33,7 @@ Rectangle {
PropertyChanges { PropertyChanges {
target: root target: root
opacity: 1 opacity: 1
width: Prefs.mediaCompactMode ? compactContentWidth : normalContentWidth width: SettingsData.mediaCompactMode ? compactContentWidth : normalContentWidth
} }
}, },
@@ -100,8 +100,8 @@ Rectangle {
id: mediaText id: mediaText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Prefs.mediaCompactMode ? 60 : 140 width: SettingsData.mediaCompactMode ? 60 : 140
visible: !Prefs.mediaCompactMode visible: !SettingsData.mediaCompactMode
text: { text: {
if (!activePlayer || !activePlayer.trackTitle) if (!activePlayer || !activePlayer.trackTitle)
return ""; return "";

View File

@@ -23,9 +23,9 @@ Rectangle {
DankIcon { DankIcon {
anchors.centerIn: parent anchors.centerIn: parent
name: Prefs.doNotDisturb ? "notifications_off" : "notifications" name: SessionData.doNotDisturb ? "notifications_off" : "notifications"
size: Theme.iconSize - 6 size: Theme.iconSize - 6
color: Prefs.doNotDisturb ? Theme.error : (notificationArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText) color: SessionData.doNotDisturb ? Theme.error : (notificationArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText)
} }
Rectangle { Rectangle {

View File

@@ -18,7 +18,7 @@ PanelWindow {
property var modelData property var modelData
property string screenName: modelData.name property string screenName: modelData.name
property real backgroundTransparency: Prefs.topBarTransparency property real backgroundTransparency: SettingsData.topBarTransparency
readonly property int notificationCount: NotificationService.notifications.length readonly property int notificationCount: NotificationService.notifications.length
screen: modelData screen: modelData
@@ -29,7 +29,7 @@ PanelWindow {
if (fonts.indexOf("Material Symbols Rounded") === -1) if (fonts.indexOf("Material Symbols Rounded") === -1)
ToastService.showError("Please install Material Symbols Rounded and Restart your Shell. See README.md for instructions"); ToastService.showError("Please install Material Symbols Rounded and Restart your Shell. See README.md for instructions");
Prefs.forceTopBarLayoutRefresh.connect(function() { SettingsData.forceTopBarLayoutRefresh.connect(function() {
Qt.callLater(() => { Qt.callLater(() => {
leftSection.visible = false; leftSection.visible = false;
centerSection.visible = false; centerSection.visible = false;
@@ -45,10 +45,10 @@ PanelWindow {
Connections { Connections {
function onTopBarTransparencyChanged() { function onTopBarTransparencyChanged() {
root.backgroundTransparency = Prefs.topBarTransparency; root.backgroundTransparency = SettingsData.topBarTransparency;
} }
target: Prefs target: SettingsData
} }
Connections { Connections {
@@ -246,7 +246,7 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Repeater { Repeater {
model: Prefs.topBarLeftWidgetsModel model: SettingsData.topBarLeftWidgetsModel
Loader { Loader {
property string widgetId: model.widgetId property string widgetId: model.widgetId
@@ -367,7 +367,7 @@ PanelWindow {
Repeater { Repeater {
id: centerRepeater id: centerRepeater
model: Prefs.topBarCenterWidgetsModel model: SettingsData.topBarCenterWidgetsModel
Loader { Loader {
property string widgetId: model.widgetId property string widgetId: model.widgetId
@@ -401,7 +401,7 @@ PanelWindow {
Qt.callLater(centerSection.updateLayout); Qt.callLater(centerSection.updateLayout);
} }
target: Prefs.topBarCenterWidgetsModel target: SettingsData.topBarCenterWidgetsModel
} }
} }
@@ -415,7 +415,7 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Repeater { Repeater {
model: Prefs.topBarRightWidgetsModel model: SettingsData.topBarRightWidgetsModel
Loader { Loader {
property string widgetId: model.widgetId property string widgetId: model.widgetId

View File

@@ -12,7 +12,7 @@ Rectangle {
signal clicked() signal clicked()
visible: Prefs.weatherEnabled visible: SettingsData.weatherEnabled
width: visible ? Math.min(100, weatherRow.implicitWidth + Theme.spacingS * 2) : 0 width: visible ? Math.min(100, weatherRow.implicitWidth + Theme.spacingS * 2) : 0
height: 30 height: 30
radius: Theme.cornerRadius radius: Theme.cornerRadius
@@ -39,7 +39,7 @@ Rectangle {
} }
StyledText { StyledText {
text: (Prefs.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp) + "°" + (Prefs.useFahrenheit ? "F" : "C") text: (SettingsData.useFahrenheit ? WeatherService.weather.tempF : WeatherService.weather.temp) + "°" + (SettingsData.useFahrenheit ? "F" : "C")
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

View File

@@ -12,7 +12,7 @@ Rectangle {
property int currentWorkspace: getDisplayActiveWorkspace() property int currentWorkspace: getDisplayActiveWorkspace()
property var workspaceList: { property var workspaceList: {
var baseList = getDisplayWorkspaces(); var baseList = getDisplayWorkspaces();
return Prefs.showWorkspacePadding ? padWorkspaces(baseList) : baseList; return SettingsData.showWorkspacePadding ? padWorkspaces(baseList) : baseList;
} }
function padWorkspaces(list) { function padWorkspaces(list) {
@@ -54,7 +54,7 @@ Rectangle {
return 1; return 1;
} }
width: Prefs.showWorkspacePadding ? Math.max(120, workspaceRow.implicitWidth + Theme.spacingL * 2) : workspaceRow.implicitWidth + Theme.spacingL * 2 width: SettingsData.showWorkspacePadding ? Math.max(120, workspaceRow.implicitWidth + Theme.spacingL * 2) : workspaceRow.implicitWidth + Theme.spacingL * 2
height: 30 height: 30
radius: Theme.cornerRadiusLarge radius: Theme.cornerRadiusLarge
color: { color: {
@@ -65,7 +65,7 @@ Rectangle {
Connections { Connections {
function onAllWorkspacesChanged() { function onAllWorkspacesChanged() {
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces(); root.workspaceList = SettingsData.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
root.currentWorkspace = root.getDisplayActiveWorkspace(); root.currentWorkspace = root.getDisplayActiveWorkspace();
} }
@@ -75,7 +75,7 @@ Rectangle {
function onNiriAvailableChanged() { function onNiriAvailableChanged() {
if (NiriService.niriAvailable) { if (NiriService.niriAvailable) {
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces(); root.workspaceList = SettingsData.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
root.currentWorkspace = root.getDisplayActiveWorkspace(); root.currentWorkspace = root.getDisplayActiveWorkspace();
} }
} }
@@ -86,10 +86,10 @@ Rectangle {
Connections { Connections {
function onShowWorkspacePaddingChanged() { function onShowWorkspacePaddingChanged() {
var baseList = root.getDisplayWorkspaces(); var baseList = root.getDisplayWorkspaces();
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(baseList) : baseList; root.workspaceList = SettingsData.showWorkspacePadding ? root.padWorkspaces(baseList) : baseList;
} }
target: Prefs target: SettingsData
} }
Row { Row {
@@ -127,7 +127,7 @@ Rectangle {
} }
StyledText { StyledText {
visible: Prefs.showWorkspaceIndex visible: SettingsData.showWorkspaceIndex
anchors.centerIn: parent anchors.centerIn: parent
text: isPlaceholder ? sequentialNumber : sequentialNumber text: isPlaceholder ? sequentialNumber : sequentialNumber
color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium

View File

@@ -6,7 +6,7 @@ import qs.Common
import qs.Widgets import qs.Widgets
LazyLoader { LazyLoader {
active: Prefs.wallpaperPath !== "" active: SessionData.wallpaperPath !== ""
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
@@ -32,7 +32,7 @@ LazyLoader {
id: root id: root
anchors.fill: parent anchors.fill: parent
property string source: Prefs.wallpaperPath || "" property string source: SessionData.wallpaperPath || ""
property Image current: one property Image current: one
onSourceChanged: { onSourceChanged: {

View File

@@ -55,7 +55,7 @@ Singleton {
} }
Component.onCompleted: { Component.onCompleted: {
root.userPreference = Prefs.networkPreference root.userPreference = SettingsData.networkPreference
if (root.networkStatus === "wifi" && root.wifiEnabled) { if (root.networkStatus === "wifi" && root.wifiEnabled) {
updateCurrentWifiInfo() updateCurrentWifiInfo()
@@ -402,7 +402,7 @@ Singleton {
root.userPreference = preference root.userPreference = preference
root.changingPreference = true root.changingPreference = true
root.targetPreference = preference root.targetPreference = preference
Prefs.setNetworkPreference(preference) SettingsData.setNetworkPreference(preference)
if (preference === "wifi") { if (preference === "wifi") {
// Set WiFi to low route metric (high priority), ethernet to high route metric (low priority) // Set WiFi to low route metric (high priority), ethernet to high route metric (low priority)

View File

@@ -57,7 +57,7 @@ Singleton {
onNotification: notif => { onNotification: notif => {
notif.tracked = true; notif.tracked = true;
const shouldShowPopup = !root.popupsDisabled && !Prefs.doNotDisturb; const shouldShowPopup = !root.popupsDisabled && !SessionData.doNotDisturb;
const wrapper = notifComponent.createObject(root, { const wrapper = notifComponent.createObject(root, {
popup: shouldShowPopup, popup: shouldShowPopup,
notification: notif notification: notif
@@ -226,7 +226,7 @@ Singleton {
function processQueue() { function processQueue() {
if (addGateBusy) return; if (addGateBusy) return;
if (popupsDisabled) return; if (popupsDisabled) return;
if (Prefs.doNotDisturb) return; if (SessionData.doNotDisturb) return;
if (notificationQueue.length === 0) return; if (notificationQueue.length === 0) return;
const [next, ...rest] = notificationQueue; const [next, ...rest] = notificationQueue;
@@ -420,9 +420,9 @@ Singleton {
Connections { Connections {
target: Prefs target: SessionData
function onDoNotDisturbChanged() { function onDoNotDisturbChanged() {
if (Prefs.doNotDisturb) { if (SessionData.doNotDisturb) {
// Hide all current popups when DND is enabled // Hide all current popups when DND is enabled
for (const notif of visibleNotifications) { for (const notif of visibleNotifications) {
notif.popup = false; notif.popup = false;

View File

@@ -149,8 +149,8 @@ Singleton {
var shouldBeLightMode = (root.systemColorScheme === 2) var shouldBeLightMode = (root.systemColorScheme === 2)
if (Theme.isLightMode !== shouldBeLightMode) { if (Theme.isLightMode !== shouldBeLightMode) {
Theme.isLightMode = shouldBeLightMode Theme.isLightMode = shouldBeLightMode
if (typeof Prefs !== "undefined") { if (typeof SessionData !== "undefined") {
Prefs.setLightMode(shouldBeLightMode) SessionData.setLightMode(shouldBeLightMode)
} }
} }
} }

View File

@@ -92,13 +92,13 @@ Singleton {
} }
function getWeatherUrl() { function getWeatherUrl() {
if (Prefs.useAutoLocation) { if (SettingsData.useAutoLocation) {
const url = "wttr.in/?format=j1" const url = "wttr.in/?format=j1"
console.log("Using auto location, URL:", url) console.log("Using auto location, URL:", url)
return url return url
} }
const location = Prefs.weatherCoordinates || "40.7128,-74.0060" const location = SettingsData.weatherCoordinates || "40.7128,-74.0060"
const url = `wttr.in/${encodeURIComponent(location)}?format=j1` const url = `wttr.in/${encodeURIComponent(location)}?format=j1`
console.log("Using manual location:", location, "URL:", url) console.log("Using manual location:", location, "URL:", url)
return url return url
@@ -107,7 +107,7 @@ Singleton {
function addRef() { function addRef() {
refCount++; refCount++;
if (refCount === 1 && !weather.available && Prefs.weatherEnabled) { if (refCount === 1 && !weather.available && SettingsData.weatherEnabled) {
// Start fetching when first consumer appears and weather is enabled // Start fetching when first consumer appears and weather is enabled
fetchWeather(); fetchWeather();
} }
@@ -120,7 +120,7 @@ Singleton {
function fetchWeather() { function fetchWeather() {
// Only fetch if someone is consuming the data and weather is enabled // Only fetch if someone is consuming the data and weather is enabled
if (root.refCount === 0 || !Prefs.weatherEnabled) { if (root.refCount === 0 || !SettingsData.weatherEnabled) {
return; return;
} }
@@ -246,7 +246,7 @@ Singleton {
Timer { Timer {
id: updateTimer id: updateTimer
interval: root.updateInterval interval: root.updateInterval
running: root.refCount > 0 && !IdleService.isIdle && Prefs.weatherEnabled running: root.refCount > 0 && !IdleService.isIdle && SettingsData.weatherEnabled
repeat: true repeat: true
triggeredOnStart: true triggeredOnStart: true
onTriggered: { onTriggered: {
@@ -261,7 +261,7 @@ Singleton {
console.log("WeatherService: System idle, pausing weather updates") console.log("WeatherService: System idle, pausing weather updates")
} else { } else {
console.log("WeatherService: System active, resuming weather updates") console.log("WeatherService: System active, resuming weather updates")
if (root.refCount > 0 && !root.weather.available && Prefs.weatherEnabled) { if (root.refCount > 0 && !root.weather.available && SettingsData.weatherEnabled) {
// Trigger immediate update when coming back from idle if no data and weather enabled // Trigger immediate update when coming back from idle if no data and weather enabled
root.fetchWeather() root.fetchWeather()
} }
@@ -291,7 +291,7 @@ Singleton {
} }
Component.onCompleted: { Component.onCompleted: {
Prefs.weatherCoordinatesChanged.connect(() => { SettingsData.weatherCoordinatesChanged.connect(() => {
console.log("Weather location changed, force refreshing weather") console.log("Weather location changed, force refreshing weather")
root.weather = { root.weather = {
available: false, available: false,
@@ -311,13 +311,13 @@ Singleton {
root.forceRefresh() root.forceRefresh()
}) })
Prefs.weatherLocationChanged.connect(() => { SettingsData.weatherLocationChanged.connect(() => {
console.log("Weather location display name changed") console.log("Weather location display name changed")
const currentWeather = Object.assign({}, root.weather) const currentWeather = Object.assign({}, root.weather)
root.weather = currentWeather root.weather = currentWeather
}) })
Prefs.useAutoLocationChanged.connect(() => { SettingsData.useAutoLocationChanged.connect(() => {
console.log("Auto location setting changed, force refreshing weather") console.log("Auto location setting changed, force refreshing weather")
root.weather = { root.weather = {
available: false, available: false,
@@ -337,12 +337,12 @@ Singleton {
root.forceRefresh() root.forceRefresh()
}) })
Prefs.weatherEnabledChanged.connect(() => { SettingsData.weatherEnabledChanged.connect(() => {
console.log("Weather enabled setting changed:", Prefs.weatherEnabled) console.log("Weather enabled setting changed:", SettingsData.weatherEnabled)
if (Prefs.weatherEnabled && root.refCount > 0 && !root.weather.available) { if (SettingsData.weatherEnabled && root.refCount > 0 && !root.weather.available) {
// Start fetching when weather is re-enabled // Start fetching when weather is re-enabled
root.forceRefresh() root.forceRefresh()
} else if (!Prefs.weatherEnabled) { } else if (!SettingsData.weatherEnabled) {
// Stop all timers when weather is disabled // Stop all timers when weather is disabled
updateTimer.stop() updateTimer.stop()
retryTimer.stop() retryTimer.stop()

View File

@@ -102,7 +102,7 @@ GridView {
id: iconImg id: iconImg
anchors.fill: parent anchors.fill: parent
source: (model.icon) ? Quickshell.iconPath(model.icon, Prefs.iconTheme === "System Default" ? "" : Prefs.iconTheme) : "" source: (model.icon) ? Quickshell.iconPath(model.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme) : ""
smooth: true smooth: true
asynchronous: true asynchronous: true
visible: status === Image.Ready visible: status === Image.Ready

View File

@@ -89,7 +89,7 @@ ListView {
id: iconImg id: iconImg
anchors.fill: parent anchors.fill: parent
source: (model.icon) ? Quickshell.iconPath(model.icon, Prefs.iconTheme === "System Default" ? "" : Prefs.iconTheme) : "" source: (model.icon) ? Quickshell.iconPath(model.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme) : ""
smooth: true smooth: true
asynchronous: true asynchronous: true
visible: status === Image.Ready visible: status === Image.Ready

View File

@@ -141,14 +141,14 @@ Column {
id: compactModeButton id: compactModeButton
anchors.fill: parent anchors.fill: parent
buttonSize: 32 buttonSize: 32
iconName: (modelData.id === "clock" && Prefs.clockCompactMode) || (modelData.id === "music" && Prefs.mediaCompactMode) ? "zoom_out" : "zoom_in" iconName: (modelData.id === "clock" && SettingsData.clockCompactMode) || (modelData.id === "music" && SettingsData.mediaCompactMode) ? "zoom_out" : "zoom_in"
iconSize: 18 iconSize: 18
iconColor: ((modelData.id === "clock" && Prefs.clockCompactMode) || (modelData.id === "music" && Prefs.mediaCompactMode)) ? Theme.primary : Theme.outline iconColor: ((modelData.id === "clock" && SettingsData.clockCompactMode) || (modelData.id === "music" && SettingsData.mediaCompactMode)) ? Theme.primary : Theme.outline
onClicked: { onClicked: {
if (modelData.id === "clock") { if (modelData.id === "clock") {
root.compactModeChanged("clock", !Prefs.clockCompactMode); root.compactModeChanged("clock", !SettingsData.clockCompactMode);
} else if (modelData.id === "music") { } else if (modelData.id === "music") {
root.compactModeChanged("music", !Prefs.mediaCompactMode); root.compactModeChanged("music", !SettingsData.mediaCompactMode);
} }
} }
} }

View File

@@ -10,8 +10,8 @@ Text {
color: Theme.surfaceText color: Theme.surfaceText
font.pixelSize: Appearance.fontSize.normal font.pixelSize: Appearance.fontSize.normal
font.family: { font.family: {
var requestedFont = isMonospace ? Prefs.monoFontFamily : Prefs.fontFamily; var requestedFont = isMonospace ? SettingsData.monoFontFamily : SettingsData.fontFamily;
var defaultFont = isMonospace ? Prefs.defaultMonoFontFamily : Prefs.defaultFontFamily; var defaultFont = isMonospace ? SettingsData.defaultMonoFontFamily : SettingsData.defaultFontFamily;
if (requestedFont === defaultFont) { if (requestedFont === defaultFont) {
var availableFonts = Qt.fontFamilies(); var availableFonts = Qt.fontFamilies();
if (!availableFonts.includes(requestedFont)) if (!availableFonts.includes(requestedFont))
@@ -20,7 +20,7 @@ Text {
} }
return requestedFont; return requestedFont;
} }
font.weight: Prefs.fontWeight font.weight: SettingsData.fontWeight
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter