mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
config refacotr: separate settings.json, session.json, appusage.json
This commit is contained in:
128
Common/AppUsageHistoryData.qml
Normal file
128
Common/AppUsageHistoryData.qml
Normal 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) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ Singleton {
|
||||
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
|
||||
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 wallpaperPath: Prefs.wallpaperPath
|
||||
readonly property string wallpaperPath: SessionData.wallpaperPath
|
||||
property bool matugenAvailable: false
|
||||
property bool gtkThemingEnabled: false
|
||||
property bool qtThemingEnabled: false
|
||||
@@ -71,7 +71,7 @@ Singleton {
|
||||
|
||||
function getMatugenColor(path, fallback) {
|
||||
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];
|
||||
for (const part of path.split(".")) {
|
||||
if (!cur || typeof cur !== "object" || !(part in cur))
|
||||
@@ -90,8 +90,8 @@ Singleton {
|
||||
matugenCheck.running = true;
|
||||
checkGtkThemingAvailability();
|
||||
checkQtThemingAvailability();
|
||||
if (typeof Theme !== "undefined")
|
||||
Theme.isLightModeChanged.connect(root.onLightModeChanged);
|
||||
if (typeof SessionData !== "undefined")
|
||||
SessionData.isLightModeChanged.connect(root.onLightModeChanged);
|
||||
}
|
||||
|
||||
Process {
|
||||
@@ -167,10 +167,10 @@ Singleton {
|
||||
generateNiriConfig();
|
||||
generateGhosttyConfig();
|
||||
|
||||
if (gtkThemingEnabled && typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) {
|
||||
if (gtkThemingEnabled && typeof SettingsData !== "undefined" && SettingsData.gtkThemingEnabled) {
|
||||
generateGtkThemes();
|
||||
}
|
||||
if (qtThemingEnabled && typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) {
|
||||
if (qtThemingEnabled && typeof SettingsData !== "undefined" && SettingsData.qtThemingEnabled) {
|
||||
generateQtThemes();
|
||||
}
|
||||
}
|
||||
@@ -270,10 +270,10 @@ palette = 15=${fg_b}`;
|
||||
return;
|
||||
}
|
||||
|
||||
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false";
|
||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof SettingsData !== "undefined" && SettingsData.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof SettingsData !== "undefined" && SettingsData.qtThemingEnabled) ? "true" : "false";
|
||||
|
||||
systemThemeGenerationInProgress = true;
|
||||
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, configDir, "generate", isLight, iconTheme, gtkTheming, qtTheming];
|
||||
@@ -294,10 +294,10 @@ palette = 15=${fg_b}`;
|
||||
return;
|
||||
}
|
||||
|
||||
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false";
|
||||
const isLight = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof SettingsData !== "undefined" && SettingsData.iconTheme) ? SettingsData.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof SettingsData !== "undefined" && SettingsData.gtkThemingEnabled) ? "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.running = true;
|
||||
|
||||
179
Common/SessionData.qml
Normal file
179
Common/SessionData.qml
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,10 @@ Singleton {
|
||||
|
||||
property int themeIndex: 0
|
||||
property bool themeIsDynamic: false
|
||||
property bool isLightMode: false
|
||||
property real topBarTransparency: 0.75
|
||||
property real topBarWidgetTransparency: 0.85
|
||||
property real popupTransparency: 0.92
|
||||
property real dockTransparency: 1.0
|
||||
property var appUsageRanking: {}
|
||||
property bool use24HourClock: true
|
||||
property bool useFahrenheit: false
|
||||
property bool nightModeEnabled: false
|
||||
@@ -74,11 +72,7 @@ Singleton {
|
||||
property string osLogoColorOverride: ""
|
||||
property real osLogoBrightness: 0.5
|
||||
property real osLogoContrast: 1.0
|
||||
property string wallpaperPath: ""
|
||||
property bool wallpaperDynamicTheming: true
|
||||
property string wallpaperLastPath: ""
|
||||
property string profileLastPath: ""
|
||||
property bool doNotDisturb: false
|
||||
property bool weatherEnabled: true
|
||||
property string fontFamily: "Inter Variable"
|
||||
property string monoFontFamily: "Fira Code"
|
||||
@@ -86,7 +80,6 @@ Singleton {
|
||||
property bool gtkThemingEnabled: false
|
||||
property bool qtThemingEnabled: false
|
||||
property bool showDock: false
|
||||
property var pinnedApps: []
|
||||
property bool dockAutoHide: false
|
||||
|
||||
readonly property string defaultFontFamily: "Inter Variable"
|
||||
@@ -140,12 +133,10 @@ Singleton {
|
||||
var settings = JSON.parse(content);
|
||||
themeIndex = settings.themeIndex !== undefined ? settings.themeIndex : 0;
|
||||
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;
|
||||
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;
|
||||
dockTransparency = settings.dockTransparency !== undefined ? (settings.dockTransparency > 1 ? settings.dockTransparency / 100 : settings.dockTransparency) : 1.0;
|
||||
appUsageRanking = settings.appUsageRanking || {};
|
||||
use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true;
|
||||
useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false;
|
||||
nightModeEnabled = settings.nightModeEnabled !== undefined ? settings.nightModeEnabled : false;
|
||||
@@ -194,18 +185,13 @@ Singleton {
|
||||
osLogoColorOverride = settings.osLogoColorOverride !== undefined ? settings.osLogoColorOverride : "";
|
||||
osLogoBrightness = settings.osLogoBrightness !== undefined ? settings.osLogoBrightness : 0.5;
|
||||
osLogoContrast = settings.osLogoContrast !== undefined ? settings.osLogoContrast : 1.0;
|
||||
wallpaperPath = settings.wallpaperPath !== undefined ? settings.wallpaperPath : "";
|
||||
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;
|
||||
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily;
|
||||
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal;
|
||||
gtkThemingEnabled = settings.gtkThemingEnabled !== undefined ? settings.gtkThemingEnabled : false;
|
||||
qtThemingEnabled = settings.qtThemingEnabled !== undefined ? settings.qtThemingEnabled : false;
|
||||
showDock = settings.showDock !== undefined ? settings.showDock : false;
|
||||
pinnedApps = settings.pinnedApps !== undefined ? settings.pinnedApps : [];
|
||||
dockAutoHide = settings.dockAutoHide !== undefined ? settings.dockAutoHide : false;
|
||||
applyStoredTheme();
|
||||
detectAvailableIconThemes();
|
||||
@@ -224,12 +210,10 @@ Singleton {
|
||||
settingsFile.setText(JSON.stringify({
|
||||
"themeIndex": themeIndex,
|
||||
"themeIsDynamic": themeIsDynamic,
|
||||
"isLightMode": isLightMode,
|
||||
"topBarTransparency": topBarTransparency,
|
||||
"topBarWidgetTransparency": topBarWidgetTransparency,
|
||||
"popupTransparency": popupTransparency,
|
||||
"dockTransparency": dockTransparency,
|
||||
"appUsageRanking": appUsageRanking,
|
||||
"use24HourClock": use24HourClock,
|
||||
"useFahrenheit": useFahrenheit,
|
||||
"nightModeEnabled": nightModeEnabled,
|
||||
@@ -264,18 +248,13 @@ Singleton {
|
||||
"osLogoColorOverride": osLogoColorOverride,
|
||||
"osLogoBrightness": osLogoBrightness,
|
||||
"osLogoContrast": osLogoContrast,
|
||||
"wallpaperPath": wallpaperPath,
|
||||
"wallpaperDynamicTheming": wallpaperDynamicTheming,
|
||||
"wallpaperLastPath": wallpaperLastPath,
|
||||
"profileLastPath": profileLastPath,
|
||||
"doNotDisturb": doNotDisturb,
|
||||
"fontFamily": fontFamily,
|
||||
"monoFontFamily": monoFontFamily,
|
||||
"fontWeight": fontWeight,
|
||||
"gtkThemingEnabled": gtkThemingEnabled,
|
||||
"qtThemingEnabled": qtThemingEnabled,
|
||||
"showDock": showDock,
|
||||
"pinnedApps": pinnedApps,
|
||||
"dockAutoHide": dockAutoHide
|
||||
}, null, 2));
|
||||
}
|
||||
@@ -302,12 +281,10 @@ Singleton {
|
||||
|
||||
function applyStoredTheme() {
|
||||
if (typeof Theme !== "undefined") {
|
||||
Theme.isLightMode = isLightMode;
|
||||
Theme.switchTheme(themeIndex, themeIsDynamic, false);
|
||||
} else {
|
||||
Qt.callLater(() => {
|
||||
if (typeof Theme !== "undefined") {
|
||||
Theme.isLightMode = isLightMode;
|
||||
Theme.switchTheme(themeIndex, themeIsDynamic, false);
|
||||
}
|
||||
});
|
||||
@@ -320,13 +297,6 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setLightMode(lightMode) {
|
||||
isLightMode = lightMode;
|
||||
if (typeof Theme !== "undefined") {
|
||||
Theme.isLightMode = lightMode;
|
||||
}
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setTopBarTransparency(transparency) {
|
||||
topBarTransparency = transparency;
|
||||
@@ -348,78 +318,9 @@ Singleton {
|
||||
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
|
||||
function setClockFormat(use24Hour) {
|
||||
@@ -770,37 +671,14 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setWallpaperPath(path) {
|
||||
wallpaperPath = path;
|
||||
saveSettings();
|
||||
|
||||
if (wallpaperDynamicTheming && path && typeof Theme !== "undefined") {
|
||||
Theme.switchTheme(themeIndex, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
function setWallpaperDynamicTheming(enabled) {
|
||||
wallpaperDynamicTheming = enabled;
|
||||
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) {
|
||||
fontFamily = family;
|
||||
@@ -832,30 +710,6 @@ Singleton {
|
||||
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) {
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,8 +424,8 @@ Singleton {
|
||||
if (isDynamicTheme) {
|
||||
currentThemeIndex = 10;
|
||||
isDynamicTheme = true;
|
||||
if (typeof Prefs !== "undefined")
|
||||
Prefs.setTheme(currentThemeIndex, isDynamicTheme);
|
||||
if (typeof SettingsData !== "undefined")
|
||||
SettingsData.setTheme(currentThemeIndex, isDynamicTheme);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,14 +442,14 @@ Singleton {
|
||||
currentThemeIndex = themeIndex;
|
||||
isDynamicTheme = false;
|
||||
}
|
||||
if (savePrefs && typeof Prefs !== "undefined")
|
||||
Prefs.setTheme(currentThemeIndex, isDynamicTheme);
|
||||
if (savePrefs && typeof SettingsData !== "undefined")
|
||||
SettingsData.setTheme(currentThemeIndex, isDynamicTheme);
|
||||
}
|
||||
|
||||
function toggleLightMode(savePrefs = true) {
|
||||
isLightMode = !isLightMode;
|
||||
if (savePrefs && typeof Prefs !== "undefined")
|
||||
Prefs.setLightMode(isLightMode);
|
||||
if (savePrefs && typeof SessionData !== "undefined")
|
||||
SessionData.setLightMode(isLightMode);
|
||||
}
|
||||
|
||||
function getCurrentThemeArray() {
|
||||
@@ -592,23 +592,23 @@ Singleton {
|
||||
if (typeof Colors !== "undefined")
|
||||
Colors.colorsUpdated.connect(root.onColorsUpdated);
|
||||
|
||||
if (typeof Prefs !== "undefined") {
|
||||
if (Prefs.popupTransparency !== undefined)
|
||||
root.popupTransparency = Prefs.popupTransparency;
|
||||
if (typeof SettingsData !== "undefined") {
|
||||
if (SettingsData.popupTransparency !== undefined)
|
||||
root.popupTransparency = SettingsData.popupTransparency;
|
||||
|
||||
if (Prefs.topBarWidgetTransparency !== undefined)
|
||||
root.widgetTransparency = Prefs.topBarWidgetTransparency;
|
||||
if (SettingsData.topBarWidgetTransparency !== undefined)
|
||||
root.widgetTransparency = SettingsData.topBarWidgetTransparency;
|
||||
|
||||
if (Prefs.popupTransparencyChanged)
|
||||
Prefs.popupTransparencyChanged.connect(function() {
|
||||
if (typeof Prefs !== "undefined" && Prefs.popupTransparency !== undefined)
|
||||
root.popupTransparency = Prefs.popupTransparency;
|
||||
if (SettingsData.popupTransparencyChanged)
|
||||
SettingsData.popupTransparencyChanged.connect(function() {
|
||||
if (typeof SettingsData !== "undefined" && SettingsData.popupTransparency !== undefined)
|
||||
root.popupTransparency = SettingsData.popupTransparency;
|
||||
});
|
||||
|
||||
if (Prefs.topBarWidgetTransparencyChanged)
|
||||
Prefs.topBarWidgetTransparencyChanged.connect(function() {
|
||||
if (typeof Prefs !== "undefined" && Prefs.topBarWidgetTransparency !== undefined)
|
||||
root.widgetTransparency = Prefs.topBarWidgetTransparency;
|
||||
if (SettingsData.topBarWidgetTransparencyChanged)
|
||||
SettingsData.topBarWidgetTransparencyChanged.connect(function() {
|
||||
if (typeof SettingsData !== "undefined" && SettingsData.topBarWidgetTransparency !== undefined)
|
||||
root.widgetTransparency = SettingsData.topBarWidgetTransparency;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ DankModal {
|
||||
function getLastPath() {
|
||||
var lastPath = "";
|
||||
if (browserType === "wallpaper") {
|
||||
lastPath = Prefs.wallpaperLastPath;
|
||||
lastPath = SessionData.wallpaperLastPath;
|
||||
} else if (browserType === "profile") {
|
||||
lastPath = Prefs.profileLastPath;
|
||||
lastPath = SessionData.profileLastPath;
|
||||
}
|
||||
|
||||
if (lastPath && lastPath !== "") {
|
||||
@@ -52,11 +52,10 @@ DankModal {
|
||||
|
||||
function saveLastPath(path) {
|
||||
if (browserType === "wallpaper") {
|
||||
Prefs.wallpaperLastPath = path;
|
||||
SessionData.setWallpaperLastPath(path);
|
||||
} else if (browserType === "profile") {
|
||||
Prefs.profileLastPath = path;
|
||||
SessionData.setProfileLastPath(path);
|
||||
}
|
||||
Prefs.saveSettings();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
||||
@@ -59,11 +59,11 @@ DankModal {
|
||||
AppLauncher {
|
||||
id: appLauncher
|
||||
|
||||
viewMode: Prefs.spotlightModalViewMode
|
||||
viewMode: SettingsData.spotlightModalViewMode
|
||||
gridColumns: 4
|
||||
onAppLaunched: hide()
|
||||
onViewModeSelected: function(mode) {
|
||||
Prefs.setSpotlightModalViewMode(mode);
|
||||
SettingsData.setSpotlightModalViewMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ DankModal {
|
||||
name: {
|
||||
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return "push_pin"
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
@@ -438,7 +438,7 @@ DankModal {
|
||||
text: {
|
||||
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return "Pin to Dock"
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
@@ -455,10 +455,10 @@ DankModal {
|
||||
onClicked: {
|
||||
if (!contextMenu.currentApp || !contextMenu.currentApp.desktopEntry) return
|
||||
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || ""
|
||||
if (Prefs.isPinnedApp(appId)) {
|
||||
Prefs.removePinnedApp(appId)
|
||||
if (SessionData.isPinnedApp(appId)) {
|
||||
SessionData.removePinnedApp(appId)
|
||||
} else {
|
||||
Prefs.addPinnedApp(appId)
|
||||
SessionData.addPinnedApp(appId)
|
||||
}
|
||||
contextMenu.close()
|
||||
}
|
||||
|
||||
@@ -62,11 +62,11 @@ PanelWindow {
|
||||
AppLauncher {
|
||||
id: appLauncher
|
||||
|
||||
viewMode: Prefs.appLauncherViewMode
|
||||
viewMode: SettingsData.appLauncherViewMode
|
||||
gridColumns: 4
|
||||
onAppLaunched: appDrawerPopout.hide()
|
||||
onViewModeSelected: function(mode) {
|
||||
Prefs.setAppLauncherViewMode(mode);
|
||||
SettingsData.setAppLauncherViewMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ PanelWindow {
|
||||
return "push_pin";
|
||||
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
@@ -528,7 +528,7 @@ PanelWindow {
|
||||
return "Pin to Dock";
|
||||
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
@@ -549,10 +549,10 @@ PanelWindow {
|
||||
return ;
|
||||
|
||||
var appId = contextMenu.currentApp.desktopEntry.id || contextMenu.currentApp.desktopEntry.execString || "";
|
||||
if (Prefs.isPinnedApp(appId))
|
||||
Prefs.removePinnedApp(appId);
|
||||
if (SessionData.isPinnedApp(appId))
|
||||
SessionData.removePinnedApp(appId);
|
||||
else
|
||||
Prefs.addPinnedApp(appId);
|
||||
SessionData.addPinnedApp(appId);
|
||||
contextMenu.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ Item {
|
||||
property var categoryIcons: categories.map((category) => {
|
||||
return AppSearchService.getCategoryIcon(category);
|
||||
})
|
||||
property var appUsageRanking: Prefs.appUsageRanking
|
||||
property var appUsageRanking: AppUsageHistoryData.appUsageRanking
|
||||
property alias model: filteredModel
|
||||
property var _watchApplications: AppSearchService.applications
|
||||
|
||||
@@ -144,7 +144,7 @@ Item {
|
||||
|
||||
appData.desktopEntry.execute();
|
||||
appLaunched(appData);
|
||||
Prefs.addAppUsage(appData.desktopEntry);
|
||||
AppUsageHistoryData.addAppUsage(appData.desktopEntry);
|
||||
}
|
||||
|
||||
function setCategory(category) {
|
||||
|
||||
@@ -227,13 +227,13 @@ PanelWindow {
|
||||
Weather {
|
||||
width: parent.width
|
||||
height: 140
|
||||
visible: Prefs.weatherEnabled
|
||||
visible: SettingsData.weatherEnabled
|
||||
}
|
||||
|
||||
SystemInfo {
|
||||
width: parent.width
|
||||
height: 140
|
||||
visible: !Prefs.weatherEnabled
|
||||
visible: !SettingsData.weatherEnabled
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ Rectangle {
|
||||
if (modelData.allDay) {
|
||||
return "All day";
|
||||
} 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);
|
||||
if (modelData.start.toDateString() !== modelData.end.toDateString() || modelData.start.getTime() !== modelData.end.getTime())
|
||||
return startTime + " – " + Qt.formatTime(modelData.end, timeFormat);
|
||||
|
||||
@@ -67,7 +67,7 @@ Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Light
|
||||
@@ -78,7 +78,7 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (WeatherService.weather.available)
|
||||
Prefs.setTemperatureUnit(!Prefs.useFahrenheit);
|
||||
SettingsData.setTemperatureUnit(!SettingsData.useFahrenheit);
|
||||
|
||||
}
|
||||
enabled: WeatherService.weather.available
|
||||
|
||||
@@ -763,9 +763,9 @@ PanelWindow {
|
||||
width: parent.width
|
||||
text: "Night Mode"
|
||||
description: "Apply warm color temperature to reduce eye strain"
|
||||
checked: Prefs.nightModeEnabled
|
||||
checked: SettingsData.nightModeEnabled
|
||||
onToggled: (checked) => {
|
||||
Prefs.setNightModeEnabled(checked);
|
||||
SettingsData.setNightModeEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,9 +773,9 @@ PanelWindow {
|
||||
width: parent.width
|
||||
text: "Light Mode"
|
||||
description: "Use light theme instead of dark theme"
|
||||
checked: Prefs.isLightMode
|
||||
checked: SessionData.isLightMode
|
||||
onToggled: (checked) => {
|
||||
Prefs.setLightMode(checked);
|
||||
SessionData.setLightMode(checked);
|
||||
Theme.isLightMode = checked;
|
||||
PortalService.setLightMode(checked);
|
||||
}
|
||||
|
||||
@@ -88,25 +88,25 @@ ScrollView {
|
||||
width: (parent.width - Theme.spacingM) / 2
|
||||
height: 80
|
||||
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))
|
||||
border.color: Prefs.nightModeEnabled ? Theme.primary : "transparent"
|
||||
border.width: Prefs.nightModeEnabled ? 1 : 0
|
||||
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: SettingsData.nightModeEnabled ? Theme.primary : "transparent"
|
||||
border.width: SettingsData.nightModeEnabled ? 1 : 0
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankIcon {
|
||||
name: Prefs.nightModeEnabled ? "nightlight" : "dark_mode"
|
||||
name: SettingsData.nightModeEnabled ? "nightlight" : "dark_mode"
|
||||
size: Theme.iconSizeLarge
|
||||
color: Prefs.nightModeEnabled ? Theme.primary : Theme.surfaceText
|
||||
color: SettingsData.nightModeEnabled ? Theme.primary : Theme.surfaceText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: "Night Mode"
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: Prefs.nightModeEnabled ? Theme.primary : Theme.surfaceText
|
||||
color: SettingsData.nightModeEnabled ? Theme.primary : Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
@@ -120,12 +120,12 @@ ScrollView {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (Prefs.nightModeEnabled) {
|
||||
if (SettingsData.nightModeEnabled) {
|
||||
nightModeDisableProcess.running = true;
|
||||
Prefs.setNightModeEnabled(false);
|
||||
SettingsData.setNightModeEnabled(false);
|
||||
} else {
|
||||
nightModeEnableProcess.running = true;
|
||||
Prefs.setNightModeEnabled(true);
|
||||
SettingsData.setNightModeEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ ScrollView {
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
|
||||
Prefs.setNightModeEnabled(false);
|
||||
SettingsData.setNightModeEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ PanelWindow {
|
||||
property var modelData
|
||||
property var contextMenu
|
||||
property var windowsMenu
|
||||
property bool autoHide: Prefs.dockAutoHide
|
||||
property real backgroundTransparency: Prefs.dockTransparency
|
||||
property bool autoHide: SettingsData.dockAutoHide
|
||||
property real backgroundTransparency: SettingsData.dockTransparency
|
||||
|
||||
|
||||
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
|
||||
|
||||
Connections {
|
||||
target: Prefs
|
||||
target: SettingsData
|
||||
function onDockTransparencyChanged() {
|
||||
dock.backgroundTransparency = Prefs.dockTransparency;
|
||||
dock.backgroundTransparency = SettingsData.dockTransparency;
|
||||
}
|
||||
}
|
||||
|
||||
screen: modelData
|
||||
visible: Prefs.showDock
|
||||
visible: SettingsData.showDock
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
|
||||
@@ -170,7 +170,7 @@ Item {
|
||||
if (appData && appData.appId) {
|
||||
var desktopEntry = DesktopEntries.byId(appData.appId)
|
||||
if (desktopEntry) {
|
||||
Prefs.addAppUsage({
|
||||
AppUsageHistoryData.addAppUsage({
|
||||
id: appData.appId,
|
||||
name: desktopEntry.name || appData.appId,
|
||||
icon: desktopEntry.icon || "",
|
||||
@@ -190,7 +190,7 @@ Item {
|
||||
if (appData && appData.appId) {
|
||||
var desktopEntry = DesktopEntries.byId(appData.appId)
|
||||
if (desktopEntry) {
|
||||
Prefs.addAppUsage({
|
||||
AppUsageHistoryData.addAppUsage({
|
||||
id: appData.appId,
|
||||
name: desktopEntry.name || appData.appId,
|
||||
icon: desktopEntry.icon || "",
|
||||
@@ -225,7 +225,7 @@ Item {
|
||||
if (!appData || !appData.appId) return ""
|
||||
var desktopEntry = DesktopEntries.byId(appData.appId)
|
||||
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 ""
|
||||
|
||||
@@ -19,13 +19,13 @@ Item {
|
||||
function movePinnedApp(fromIndex, toIndex) {
|
||||
if (fromIndex === toIndex) return
|
||||
|
||||
var currentPinned = [...Prefs.pinnedApps]
|
||||
var currentPinned = [...SessionData.pinnedApps]
|
||||
if (fromIndex < 0 || fromIndex >= currentPinned.length || toIndex < 0 || toIndex >= currentPinned.length) return
|
||||
|
||||
var movedApp = currentPinned.splice(fromIndex, 1)[0]
|
||||
currentPinned.splice(toIndex, 0, movedApp)
|
||||
|
||||
Prefs.setPinnedApps(currentPinned)
|
||||
SessionData.setPinnedApps(currentPinned)
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -46,7 +46,7 @@ Item {
|
||||
|
||||
var items = []
|
||||
var runningApps = NiriService.getRunningAppIds()
|
||||
var pinnedApps = [...Prefs.pinnedApps]
|
||||
var pinnedApps = [...SessionData.pinnedApps]
|
||||
var addedApps = new Set()
|
||||
|
||||
pinnedApps.forEach(appId => {
|
||||
@@ -63,7 +63,7 @@ Item {
|
||||
}
|
||||
})
|
||||
root.pinnedAppCount = pinnedApps.length
|
||||
var appUsageRanking = Prefs.appUsageRanking || {}
|
||||
var appUsageRanking = AppUsageHistoryData.appUsageRanking || {}
|
||||
var allUnpinnedApps = []
|
||||
|
||||
for (var appId in appUsageRanking) {
|
||||
@@ -151,7 +151,7 @@ Item {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Prefs
|
||||
target: SessionData
|
||||
function onPinnedAppsChanged() { dockModel.updateModel() }
|
||||
}
|
||||
}
|
||||
@@ -160,9 +160,9 @@ PanelWindow {
|
||||
onClicked: {
|
||||
if (!root.appData) return
|
||||
if (root.appData.isPinned) {
|
||||
Prefs.removePinnedApp(root.appData.appId)
|
||||
SessionData.removePinnedApp(root.appData.appId)
|
||||
} else {
|
||||
Prefs.addPinnedApp(root.appData.appId)
|
||||
SessionData.addPinnedApp(root.appData.appId)
|
||||
}
|
||||
root.close()
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ Item {
|
||||
Image {
|
||||
id: wallpaperBackground
|
||||
anchors.fill: parent
|
||||
source: Prefs.wallpaperPath || ""
|
||||
source: SessionData.wallpaperPath || ""
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
@@ -114,7 +114,7 @@ Item {
|
||||
id: clockText
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
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.weight: Font.Light
|
||||
color: "white"
|
||||
@@ -124,7 +124,7 @@ Item {
|
||||
interval: 1000
|
||||
running: 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.margins: Theme.spacingXL
|
||||
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
|
||||
color: "white"
|
||||
|
||||
@@ -26,11 +26,11 @@ Item {
|
||||
DankActionButton {
|
||||
id: doNotDisturbButton
|
||||
|
||||
iconName: Prefs.doNotDisturb ? "notifications_off" : "notifications"
|
||||
iconColor: Prefs.doNotDisturb ? Theme.error : Theme.surfaceText
|
||||
iconName: SessionData.doNotDisturb ? "notifications_off" : "notifications"
|
||||
iconColor: SessionData.doNotDisturb ? Theme.error : Theme.surfaceText
|
||||
buttonSize: 28
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked: Prefs.setDoNotDisturb(!Prefs.doNotDisturb)
|
||||
onClicked: SessionData.setDoNotDisturb(!SessionData.doNotDisturb)
|
||||
|
||||
Rectangle {
|
||||
id: doNotDisturbTooltip
|
||||
|
||||
@@ -68,7 +68,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: process ? process.displayName : ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
width: 250
|
||||
@@ -100,7 +100,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: SysMonitorService.formatCpuUsage(process ? process.cpu : 0)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: {
|
||||
if (process && process.cpu > 80)
|
||||
@@ -138,7 +138,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: SysMonitorService.formatMemoryUsage(process ? process.memoryKB : 0)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: {
|
||||
if (process && process.memoryKB > 1024 * 1024)
|
||||
@@ -157,7 +157,7 @@ Rectangle {
|
||||
StyledText {
|
||||
text: process ? process.pid.toString() : ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
opacity: 0.7
|
||||
width: 50
|
||||
|
||||
@@ -35,7 +35,7 @@ Column {
|
||||
StyledText {
|
||||
text: "Process"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: SysMonitorService.sortBy === "name" ? Font.Bold : Font.Medium
|
||||
color: Theme.surfaceText
|
||||
opacity: SysMonitorService.sortBy === "name" ? 1 : 0.7
|
||||
@@ -76,7 +76,7 @@ Column {
|
||||
StyledText {
|
||||
text: "CPU"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: SysMonitorService.sortBy === "cpu" ? Font.Bold : Font.Medium
|
||||
color: Theme.surfaceText
|
||||
opacity: SysMonitorService.sortBy === "cpu" ? 1 : 0.7
|
||||
@@ -117,7 +117,7 @@ Column {
|
||||
StyledText {
|
||||
text: "RAM"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: SysMonitorService.sortBy === "memory" ? Font.Bold : Font.Medium
|
||||
color: Theme.surfaceText
|
||||
opacity: SysMonitorService.sortBy === "memory" ? 1 : 0.7
|
||||
@@ -158,7 +158,7 @@ Column {
|
||||
StyledText {
|
||||
text: "PID"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: SysMonitorService.sortBy === "pid" ? Font.Bold : Font.Medium
|
||||
color: Theme.surfaceText
|
||||
opacity: SysMonitorService.sortBy === "pid" ? 1 : 0.7
|
||||
|
||||
@@ -54,7 +54,7 @@ Row {
|
||||
StyledText {
|
||||
text: SysMonitorService.totalCpuUsage.toFixed(1) + "%"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
@@ -62,7 +62,7 @@ Row {
|
||||
StyledText {
|
||||
text: SysMonitorService.cpuCount + " cores"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
opacity: 0.7
|
||||
}
|
||||
@@ -126,7 +126,7 @@ Row {
|
||||
StyledText {
|
||||
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB)
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
@@ -134,7 +134,7 @@ Row {
|
||||
StyledText {
|
||||
text: "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
opacity: 0.7
|
||||
}
|
||||
@@ -182,7 +182,7 @@ Row {
|
||||
StyledText {
|
||||
text: SysMonitorService.totalSwapKB > 0 ? SysMonitorService.formatSystemMemory(SysMonitorService.usedSwapKB) : "None"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
}
|
||||
@@ -190,7 +190,7 @@ Row {
|
||||
StyledText {
|
||||
text: SysMonitorService.totalSwapKB > 0 ? "of " + SysMonitorService.formatSystemMemory(SysMonitorService.totalSwapKB) : "No swap configured"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
opacity: 0.7
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: SysMonitorService.hostname
|
||||
font.pixelSize: Theme.fontSizeXLarge
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Light
|
||||
color: Theme.surfaceText
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
@@ -62,7 +62,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: SysMonitorService.distribution + " • " + SysMonitorService.architecture + " • " + SysMonitorService.kernelVersion
|
||||
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)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
@@ -70,7 +70,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Up " + UserInfoService.uptime + " • Boot: " + SysMonitorService.bootTime
|
||||
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)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
@@ -78,7 +78,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Load: " + SysMonitorService.loadAverage + " • " + SysMonitorService.processCount + " processes, " + SysMonitorService.threadCount + " threads"
|
||||
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)
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
@@ -128,7 +128,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Hardware"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -139,7 +139,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: SysMonitorService.cpuModel
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
width: parent.width
|
||||
@@ -152,7 +152,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: SysMonitorService.motherboard
|
||||
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)
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
@@ -164,7 +164,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "BIOS " + SysMonitorService.biosVersion
|
||||
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)
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
@@ -206,7 +206,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Memory"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.secondary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -217,7 +217,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) + " Total"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Medium
|
||||
color: Theme.surfaceText
|
||||
width: parent.width
|
||||
@@ -228,7 +228,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB) + " Used • " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB - SysMonitorService.usedMemoryKB) + " Available"
|
||||
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)
|
||||
width: parent.width
|
||||
elide: Text.ElideRight
|
||||
@@ -280,7 +280,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Storage & Disks"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -300,7 +300,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Device"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.25
|
||||
@@ -311,7 +311,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Mount"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.2
|
||||
@@ -322,7 +322,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Size"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.15
|
||||
@@ -333,7 +333,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Used"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.15
|
||||
@@ -344,7 +344,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Available"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.15
|
||||
@@ -355,7 +355,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: "Use%"
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
font.weight: Font.Bold
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.1
|
||||
@@ -390,7 +390,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: modelData.device
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.25
|
||||
elide: Text.ElideRight
|
||||
@@ -401,7 +401,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: modelData.mount
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.2
|
||||
elide: Text.ElideRight
|
||||
@@ -412,7 +412,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: modelData.size
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.15
|
||||
elide: Text.ElideRight
|
||||
@@ -423,7 +423,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: modelData.used
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.15
|
||||
elide: Text.ElideRight
|
||||
@@ -434,7 +434,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: modelData.avail
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: Theme.surfaceText
|
||||
width: parent.width * 0.15
|
||||
elide: Text.ElideRight
|
||||
@@ -445,7 +445,7 @@ ScrollView {
|
||||
StyledText {
|
||||
text: modelData.percent
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
font.family: Prefs.monoFontFamily
|
||||
font.family: SettingsData.monoFontFamily
|
||||
color: {
|
||||
const percent = parseInt(modelData.percent);
|
||||
if (percent > 90)
|
||||
|
||||
@@ -60,9 +60,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Night Mode"
|
||||
description: "Apply warm color temperature to reduce eye strain"
|
||||
checked: Prefs.nightModeEnabled
|
||||
checked: SettingsData.nightModeEnabled
|
||||
onToggled: (checked) => {
|
||||
Prefs.setNightModeEnabled(checked);
|
||||
SettingsData.setNightModeEnabled(checked);
|
||||
if (checked)
|
||||
nightModeEnableProcess.running = true;
|
||||
else
|
||||
@@ -74,9 +74,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Light Mode"
|
||||
description: "Use light theme instead of dark theme"
|
||||
checked: Prefs.isLightMode
|
||||
checked: SessionData.isLightMode
|
||||
onToggled: (checked) => {
|
||||
Prefs.setLightMode(checked);
|
||||
SessionData.setLightMode(checked);
|
||||
Theme.isLightMode = checked;
|
||||
PortalService.setLightMode(checked);
|
||||
}
|
||||
@@ -86,17 +86,17 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Icon Theme"
|
||||
description: "Select icon theme"
|
||||
currentValue: Prefs.iconTheme
|
||||
currentValue: SettingsData.iconTheme
|
||||
enableFuzzySearch: true
|
||||
popupWidthOffset: 100
|
||||
maxPopupHeight: 400
|
||||
options: {
|
||||
Prefs.detectAvailableIconThemes();
|
||||
return Prefs.availableIconThemes;
|
||||
SettingsData.detectAvailableIconThemes();
|
||||
return SettingsData.availableIconThemes;
|
||||
}
|
||||
onValueChanged: (value) => {
|
||||
Prefs.setIconTheme(value);
|
||||
if (value !== "System Default" && !Prefs.qt5ctAvailable && !Prefs.qt6ctAvailable)
|
||||
SettingsData.setIconTheme(value);
|
||||
if (value !== "System Default" && !SettingsData.qt5ctAvailable && !SettingsData.qt6ctAvailable)
|
||||
ToastService.showWarning("qt5ct or qt6ct not found - Qt app themes may not update without these tools");
|
||||
|
||||
}
|
||||
@@ -107,16 +107,16 @@ ScrollView {
|
||||
text: "Font Family"
|
||||
description: "Select system font family"
|
||||
currentValue: {
|
||||
if (Prefs.fontFamily === Prefs.defaultFontFamily)
|
||||
return "Default (" + Prefs.defaultFontFamily + ")";
|
||||
if (SettingsData.fontFamily === SettingsData.defaultFontFamily)
|
||||
return "Default (" + SettingsData.defaultFontFamily + ")";
|
||||
else
|
||||
return Prefs.fontFamily || "Default (" + Prefs.defaultFontFamily + ")";
|
||||
return SettingsData.fontFamily || "Default (" + SettingsData.defaultFontFamily + ")";
|
||||
}
|
||||
enableFuzzySearch: true
|
||||
popupWidthOffset: 100
|
||||
maxPopupHeight: 400
|
||||
options: {
|
||||
var fonts = ["Default (" + Prefs.defaultFontFamily + ")"];
|
||||
var fonts = ["Default (" + SettingsData.defaultFontFamily + ")"];
|
||||
var availableFonts = Qt.fontFamilies();
|
||||
var rootFamilies = [];
|
||||
var seenFamilies = new Set();
|
||||
@@ -125,7 +125,7 @@ ScrollView {
|
||||
if (fontName.startsWith("."))
|
||||
continue;
|
||||
|
||||
if (fontName === Prefs.defaultFontFamily)
|
||||
if (fontName === SettingsData.defaultFontFamily)
|
||||
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) {
|
||||
@@ -140,9 +140,9 @@ ScrollView {
|
||||
}
|
||||
onValueChanged: (value) => {
|
||||
if (value.startsWith("Default ("))
|
||||
Prefs.setFontFamily(Prefs.defaultFontFamily);
|
||||
SettingsData.setFontFamily(SettingsData.defaultFontFamily);
|
||||
else
|
||||
Prefs.setFontFamily(value);
|
||||
SettingsData.setFontFamily(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ ScrollView {
|
||||
text: "Font Weight"
|
||||
description: "Select font weight"
|
||||
currentValue: {
|
||||
switch (Prefs.fontWeight) {
|
||||
switch (SettingsData.fontWeight) {
|
||||
case Font.Thin:
|
||||
return "Thin";
|
||||
case Font.ExtraLight:
|
||||
@@ -209,7 +209,7 @@ ScrollView {
|
||||
weight = Font.Normal;
|
||||
break;
|
||||
}
|
||||
Prefs.setFontWeight(weight);
|
||||
SettingsData.setFontWeight(weight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,10 @@ ScrollView {
|
||||
text: "Monospace Font"
|
||||
description: "Select monospace font for process list and technical displays"
|
||||
currentValue: {
|
||||
if (Prefs.monoFontFamily === Prefs.defaultMonoFontFamily)
|
||||
if (SettingsData.monoFontFamily === SettingsData.defaultMonoFontFamily)
|
||||
return "Default";
|
||||
|
||||
return Prefs.monoFontFamily || "Default";
|
||||
return SettingsData.monoFontFamily || "Default";
|
||||
}
|
||||
enableFuzzySearch: true
|
||||
popupWidthOffset: 100
|
||||
@@ -236,7 +236,7 @@ ScrollView {
|
||||
if (fontName.startsWith("."))
|
||||
continue;
|
||||
|
||||
if (fontName === Prefs.defaultMonoFontFamily)
|
||||
if (fontName === SettingsData.defaultMonoFontFamily)
|
||||
continue;
|
||||
|
||||
var lowerName = fontName.toLowerCase();
|
||||
@@ -252,9 +252,9 @@ ScrollView {
|
||||
}
|
||||
onValueChanged: (value) => {
|
||||
if (value === "Default")
|
||||
Prefs.setMonoFontFamily(Prefs.defaultMonoFontFamily);
|
||||
SettingsData.setMonoFontFamily(SettingsData.defaultMonoFontFamily);
|
||||
else
|
||||
Prefs.setMonoFontFamily(value);
|
||||
SettingsData.setMonoFontFamily(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,13 +312,13 @@ ScrollView {
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
height: 24
|
||||
value: Math.round(Prefs.topBarTransparency * 100)
|
||||
value: Math.round(SettingsData.topBarTransparency * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
unit: ""
|
||||
showValue: true
|
||||
onSliderValueChanged: (newValue) => {
|
||||
Prefs.setTopBarTransparency(newValue / 100);
|
||||
SettingsData.setTopBarTransparency(newValue / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,13 +338,13 @@ ScrollView {
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
height: 24
|
||||
value: Math.round(Prefs.topBarWidgetTransparency * 100)
|
||||
value: Math.round(SettingsData.topBarWidgetTransparency * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
unit: ""
|
||||
showValue: true
|
||||
onSliderValueChanged: (newValue) => {
|
||||
Prefs.setTopBarWidgetTransparency(newValue / 100);
|
||||
SettingsData.setTopBarWidgetTransparency(newValue / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,13 +364,13 @@ ScrollView {
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
height: 24
|
||||
value: Math.round(Prefs.popupTransparency * 100)
|
||||
value: Math.round(SettingsData.popupTransparency * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
unit: ""
|
||||
showValue: true
|
||||
onSliderValueChanged: (newValue) => {
|
||||
Prefs.setPopupTransparency(newValue / 100);
|
||||
SettingsData.setPopupTransparency(newValue / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,9 +790,9 @@ ScrollView {
|
||||
text: "Theme GTK Applications"
|
||||
description: Colors.gtkThemingEnabled ? "File managers, text editors, and system dialogs will match your theme" : "GTK theming not available (install gsettings)"
|
||||
enabled: Colors.gtkThemingEnabled
|
||||
checked: Colors.gtkThemingEnabled && Prefs.gtkThemingEnabled
|
||||
checked: Colors.gtkThemingEnabled && SettingsData.gtkThemingEnabled
|
||||
onToggled: function(checked) {
|
||||
Prefs.setGtkThemingEnabled(checked);
|
||||
SettingsData.setGtkThemingEnabled(checked);
|
||||
if (checked && Theme.isDynamicTheme)
|
||||
Colors.generateGtkThemes();
|
||||
|
||||
@@ -804,9 +804,9 @@ ScrollView {
|
||||
text: "Theme Qt Applications"
|
||||
description: Colors.qtThemingEnabled ? "Qt applications will match your theme colors" : "Qt theming not available (install qt5ct or qt6ct)"
|
||||
enabled: Colors.qtThemingEnabled
|
||||
checked: Colors.qtThemingEnabled && Prefs.qtThemingEnabled
|
||||
checked: Colors.qtThemingEnabled && SettingsData.qtThemingEnabled
|
||||
onToggled: function(checked) {
|
||||
Prefs.setQtThemingEnabled(checked);
|
||||
SettingsData.setQtThemingEnabled(checked);
|
||||
if (checked && Theme.isDynamicTheme)
|
||||
Colors.generateQtThemes();
|
||||
|
||||
@@ -826,7 +826,7 @@ ScrollView {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
Prefs.setNightModeEnabled(true);
|
||||
SettingsData.setNightModeEnabled(true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -838,7 +838,7 @@ ScrollView {
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
Prefs.setNightModeEnabled(false);
|
||||
SettingsData.setNightModeEnabled(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,16 +37,16 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Use OS Logo"
|
||||
description: "Display operating system logo instead of apps icon"
|
||||
checked: Prefs.useOSLogo
|
||||
checked: SettingsData.useOSLogo
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setUseOSLogo(checked);
|
||||
return SettingsData.setUseOSLogo(checked);
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.width - Theme.spacingL
|
||||
spacing: Theme.spacingL
|
||||
visible: Prefs.useOSLogo
|
||||
visible: SettingsData.useOSLogo
|
||||
opacity: visible ? 1 : 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.spacingL
|
||||
@@ -66,7 +66,7 @@ ScrollView {
|
||||
width: 100
|
||||
height: 28
|
||||
placeholderText: "#ffffff"
|
||||
text: Prefs.osLogoColorOverride
|
||||
text: SettingsData.osLogoColorOverride
|
||||
maximumLength: 7
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
topPadding: Theme.spacingXS
|
||||
@@ -74,9 +74,9 @@ ScrollView {
|
||||
onEditingFinished: {
|
||||
var color = text.trim();
|
||||
if (color === "" || /^#[0-9A-Fa-f]{6}$/.test(color))
|
||||
Prefs.setOSLogoColorOverride(color);
|
||||
SettingsData.setOSLogoColorOverride(color);
|
||||
else
|
||||
text = Prefs.osLogoColorOverride;
|
||||
text = SettingsData.osLogoColorOverride;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ ScrollView {
|
||||
height: 20
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
value: Math.round(Prefs.osLogoBrightness * 100)
|
||||
value: Math.round(SettingsData.osLogoBrightness * 100)
|
||||
unit: "%"
|
||||
showValue: true
|
||||
onSliderValueChanged: (newValue) => {
|
||||
Prefs.setOSLogoBrightness(newValue / 100);
|
||||
SettingsData.setOSLogoBrightness(newValue / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ ScrollView {
|
||||
height: 20
|
||||
minimum: 0
|
||||
maximum: 200
|
||||
value: Math.round(Prefs.osLogoContrast * 100)
|
||||
value: Math.round(SettingsData.osLogoContrast * 100)
|
||||
unit: "%"
|
||||
showValue: true
|
||||
onSliderValueChanged: (newValue) => {
|
||||
Prefs.setOSLogoContrast(newValue / 100);
|
||||
SettingsData.setOSLogoContrast(newValue / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,9 +187,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Show Dock"
|
||||
description: "Display a dock at the bottom of the screen with pinned and running applications"
|
||||
checked: Prefs.showDock
|
||||
checked: SettingsData.showDock
|
||||
onToggled: (checked) => {
|
||||
Prefs.setShowDock(checked)
|
||||
SettingsData.setShowDock(checked)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,11 +197,11 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Auto-hide Dock"
|
||||
description: "Hide the dock when not in use and reveal it when hovering near the bottom of the screen"
|
||||
checked: Prefs.dockAutoHide
|
||||
visible: Prefs.showDock
|
||||
checked: SettingsData.dockAutoHide
|
||||
visible: SettingsData.showDock
|
||||
opacity: visible ? 1 : 0
|
||||
onToggled: (checked) => {
|
||||
Prefs.setDockAutoHide(checked)
|
||||
SettingsData.setDockAutoHide(checked)
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
@@ -215,7 +215,7 @@ ScrollView {
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
visible: Prefs.showDock
|
||||
visible: SettingsData.showDock
|
||||
opacity: visible ? 1 : 0
|
||||
|
||||
StyledText {
|
||||
@@ -228,13 +228,13 @@ ScrollView {
|
||||
DankSlider {
|
||||
width: parent.width
|
||||
height: 24
|
||||
value: Math.round(Prefs.dockTransparency * 100)
|
||||
value: Math.round(SettingsData.dockTransparency * 100)
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
unit: ""
|
||||
showValue: true
|
||||
onSliderValueChanged: (newValue) => {
|
||||
Prefs.setDockTransparency(newValue / 100);
|
||||
SettingsData.setDockTransparency(newValue / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,8 +262,8 @@ ScrollView {
|
||||
|
||||
property var rankedAppsModel: {
|
||||
var apps = [];
|
||||
for (var appId in Prefs.appUsageRanking) {
|
||||
var appData = Prefs.appUsageRanking[appId];
|
||||
for (var appId in AppUsageHistoryData.appUsageRanking) {
|
||||
var appData = AppUsageHistoryData.appUsageRanking[appId];
|
||||
apps.push({
|
||||
"id": appId,
|
||||
"name": appData.name,
|
||||
@@ -320,9 +320,9 @@ ScrollView {
|
||||
hoverColor: Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
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)
|
||||
onClicked: {
|
||||
var currentRanking = Object.assign({
|
||||
}, Prefs.appUsageRanking);
|
||||
}, AppUsageHistoryData.appUsageRanking);
|
||||
delete currentRanking[modelData.id];
|
||||
Prefs.appUsageRanking = currentRanking;
|
||||
Prefs.saveSettings();
|
||||
AppUsageHistoryData.appUsageRanking = currentRanking;
|
||||
SettingsData.saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -334,9 +334,9 @@ ScrollView {
|
||||
CachingImage {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 1
|
||||
imagePath: Prefs.wallpaperPath || ""
|
||||
imagePath: SessionData.wallpaperPath || ""
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
visible: Prefs.wallpaperPath !== ""
|
||||
visible: SessionData.wallpaperPath !== ""
|
||||
maxCacheSize: 160
|
||||
layer.enabled: true
|
||||
|
||||
@@ -365,7 +365,7 @@ ScrollView {
|
||||
name: "image"
|
||||
size: Theme.iconSizeLarge + 8
|
||||
color: Theme.surfaceVariantText
|
||||
visible: Prefs.wallpaperPath === ""
|
||||
visible: SessionData.wallpaperPath === ""
|
||||
}
|
||||
|
||||
}
|
||||
@@ -376,7 +376,7 @@ ScrollView {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideMiddle
|
||||
@@ -384,12 +384,12 @@ ScrollView {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: Prefs.wallpaperPath ? Prefs.wallpaperPath : ""
|
||||
text: SessionData.wallpaperPath ? SessionData.wallpaperPath : ""
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
elide: Text.ElideMiddle
|
||||
width: parent.width
|
||||
visible: Prefs.wallpaperPath !== ""
|
||||
visible: SessionData.wallpaperPath !== ""
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -437,7 +437,7 @@ ScrollView {
|
||||
height: 32
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceVariant
|
||||
opacity: Prefs.wallpaperPath !== "" ? 1 : 0.5
|
||||
opacity: SessionData.wallpaperPath !== "" ? 1 : 0.5
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
@@ -461,10 +461,10 @@ ScrollView {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: Prefs.wallpaperPath !== ""
|
||||
enabled: SessionData.wallpaperPath !== ""
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
Prefs.setWallpaperPath("");
|
||||
SessionData.setWallpaper("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ ScrollView {
|
||||
browserType: "wallpaper"
|
||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
|
||||
onFileSelected: (path) => {
|
||||
Prefs.setWallpaperPath(path);
|
||||
SessionData.setWallpaper(path);
|
||||
visible = false;
|
||||
}
|
||||
onDialogClosed: {}
|
||||
|
||||
@@ -55,9 +55,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "24-Hour Format"
|
||||
description: "Use 24-hour time format instead of 12-hour AM/PM"
|
||||
checked: Prefs.use24HourClock
|
||||
checked: SettingsData.use24HourClock
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setClockFormat(checked);
|
||||
return SettingsData.setClockFormat(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Enable Weather"
|
||||
description: "Show weather information in top bar and centcom center"
|
||||
checked: Prefs.weatherEnabled
|
||||
checked: SettingsData.weatherEnabled
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setWeatherEnabled(checked);
|
||||
return SettingsData.setWeatherEnabled(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Fahrenheit"
|
||||
description: "Use Fahrenheit instead of Celsius for temperature"
|
||||
checked: Prefs.useFahrenheit
|
||||
enabled: Prefs.weatherEnabled
|
||||
checked: SettingsData.useFahrenheit
|
||||
enabled: SettingsData.weatherEnabled
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setTemperatureUnit(checked);
|
||||
return SettingsData.setTemperatureUnit(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,17 +126,17 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Auto Location"
|
||||
description: "Allow wttr.in to determine location based on IP address"
|
||||
checked: Prefs.useAutoLocation
|
||||
enabled: Prefs.weatherEnabled
|
||||
checked: SettingsData.useAutoLocation
|
||||
enabled: SettingsData.weatherEnabled
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setAutoLocation(checked);
|
||||
return SettingsData.setAutoLocation(checked);
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXS
|
||||
visible: !Prefs.useAutoLocation && Prefs.weatherEnabled
|
||||
visible: !SettingsData.useAutoLocation && SettingsData.weatherEnabled
|
||||
|
||||
StyledText {
|
||||
text: "Location"
|
||||
@@ -147,10 +147,10 @@ ScrollView {
|
||||
|
||||
DankLocationSearch {
|
||||
width: parent.width
|
||||
currentLocation: Prefs.weatherLocation
|
||||
currentLocation: SettingsData.weatherLocation
|
||||
placeholderText: "New York, NY"
|
||||
onLocationSelected: (displayName, coordinates) => {
|
||||
Prefs.setWeatherLocation(displayName, coordinates);
|
||||
SettingsData.setWeatherLocation(displayName, coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,54 +141,54 @@ ScrollView {
|
||||
|
||||
var widgets = [];
|
||||
if (targetSection === "left") {
|
||||
widgets = Prefs.topBarLeftWidgets.slice();
|
||||
widgets = SettingsData.topBarLeftWidgets.slice();
|
||||
widgets.push(widgetObj);
|
||||
Prefs.setTopBarLeftWidgets(widgets);
|
||||
SettingsData.setTopBarLeftWidgets(widgets);
|
||||
} else if (targetSection === "center") {
|
||||
widgets = Prefs.topBarCenterWidgets.slice();
|
||||
widgets = SettingsData.topBarCenterWidgets.slice();
|
||||
widgets.push(widgetObj);
|
||||
Prefs.setTopBarCenterWidgets(widgets);
|
||||
SettingsData.setTopBarCenterWidgets(widgets);
|
||||
} else if (targetSection === "right") {
|
||||
widgets = Prefs.topBarRightWidgets.slice();
|
||||
widgets = SettingsData.topBarRightWidgets.slice();
|
||||
widgets.push(widgetObj);
|
||||
Prefs.setTopBarRightWidgets(widgets);
|
||||
SettingsData.setTopBarRightWidgets(widgets);
|
||||
}
|
||||
}
|
||||
|
||||
function removeWidgetFromSection(sectionId, itemId) {
|
||||
var widgets = [];
|
||||
if (sectionId === "left") {
|
||||
widgets = Prefs.topBarLeftWidgets.slice();
|
||||
widgets = SettingsData.topBarLeftWidgets.slice();
|
||||
widgets = widgets.filter((widget) => {
|
||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||
return widgetId !== itemId;
|
||||
});
|
||||
Prefs.setTopBarLeftWidgets(widgets);
|
||||
SettingsData.setTopBarLeftWidgets(widgets);
|
||||
} else if (sectionId === "center") {
|
||||
widgets = Prefs.topBarCenterWidgets.slice();
|
||||
widgets = SettingsData.topBarCenterWidgets.slice();
|
||||
widgets = widgets.filter((widget) => {
|
||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||
return widgetId !== itemId;
|
||||
});
|
||||
Prefs.setTopBarCenterWidgets(widgets);
|
||||
SettingsData.setTopBarCenterWidgets(widgets);
|
||||
} else if (sectionId === "right") {
|
||||
widgets = Prefs.topBarRightWidgets.slice();
|
||||
widgets = SettingsData.topBarRightWidgets.slice();
|
||||
widgets = widgets.filter((widget) => {
|
||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||
return widgetId !== itemId;
|
||||
});
|
||||
Prefs.setTopBarRightWidgets(widgets);
|
||||
SettingsData.setTopBarRightWidgets(widgets);
|
||||
}
|
||||
}
|
||||
|
||||
function handleItemEnabledChanged(sectionId, itemId, enabled) {
|
||||
var widgets = [];
|
||||
if (sectionId === "left")
|
||||
widgets = Prefs.topBarLeftWidgets.slice();
|
||||
widgets = SettingsData.topBarLeftWidgets.slice();
|
||||
else if (sectionId === "center")
|
||||
widgets = Prefs.topBarCenterWidgets.slice();
|
||||
widgets = SettingsData.topBarCenterWidgets.slice();
|
||||
else if (sectionId === "right")
|
||||
widgets = Prefs.topBarRightWidgets.slice();
|
||||
widgets = SettingsData.topBarRightWidgets.slice();
|
||||
for (var i = 0; i < widgets.length; i++) {
|
||||
var widget = widgets[i];
|
||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||
@@ -205,30 +205,30 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
if (sectionId === "left")
|
||||
Prefs.setTopBarLeftWidgets(widgets);
|
||||
SettingsData.setTopBarLeftWidgets(widgets);
|
||||
else if (sectionId === "center")
|
||||
Prefs.setTopBarCenterWidgets(widgets);
|
||||
SettingsData.setTopBarCenterWidgets(widgets);
|
||||
else if (sectionId === "right")
|
||||
Prefs.setTopBarRightWidgets(widgets);
|
||||
SettingsData.setTopBarRightWidgets(widgets);
|
||||
}
|
||||
|
||||
function handleItemOrderChanged(sectionId, newOrder) {
|
||||
if (sectionId === "left")
|
||||
Prefs.setTopBarLeftWidgets(newOrder);
|
||||
SettingsData.setTopBarLeftWidgets(newOrder);
|
||||
else if (sectionId === "center")
|
||||
Prefs.setTopBarCenterWidgets(newOrder);
|
||||
SettingsData.setTopBarCenterWidgets(newOrder);
|
||||
else if (sectionId === "right")
|
||||
Prefs.setTopBarRightWidgets(newOrder);
|
||||
SettingsData.setTopBarRightWidgets(newOrder);
|
||||
}
|
||||
|
||||
function handleSpacerSizeChanged(sectionId, itemId, newSize) {
|
||||
var widgets = [];
|
||||
if (sectionId === "left")
|
||||
widgets = Prefs.topBarLeftWidgets.slice();
|
||||
widgets = SettingsData.topBarLeftWidgets.slice();
|
||||
else if (sectionId === "center")
|
||||
widgets = Prefs.topBarCenterWidgets.slice();
|
||||
widgets = SettingsData.topBarCenterWidgets.slice();
|
||||
else if (sectionId === "right")
|
||||
widgets = Prefs.topBarRightWidgets.slice();
|
||||
widgets = SettingsData.topBarRightWidgets.slice();
|
||||
for (var i = 0; i < widgets.length; i++) {
|
||||
var widget = widgets[i];
|
||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||
@@ -246,22 +246,22 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
if (sectionId === "left")
|
||||
Prefs.setTopBarLeftWidgets(widgets);
|
||||
SettingsData.setTopBarLeftWidgets(widgets);
|
||||
else if (sectionId === "center")
|
||||
Prefs.setTopBarCenterWidgets(widgets);
|
||||
SettingsData.setTopBarCenterWidgets(widgets);
|
||||
else if (sectionId === "right")
|
||||
Prefs.setTopBarRightWidgets(widgets);
|
||||
SettingsData.setTopBarRightWidgets(widgets);
|
||||
}
|
||||
|
||||
function getItemsForSection(sectionId) {
|
||||
var widgets = [];
|
||||
var widgetData = [];
|
||||
if (sectionId === "left")
|
||||
widgetData = Prefs.topBarLeftWidgets || [];
|
||||
widgetData = SettingsData.topBarLeftWidgets || [];
|
||||
else if (sectionId === "center")
|
||||
widgetData = Prefs.topBarCenterWidgets || [];
|
||||
widgetData = SettingsData.topBarCenterWidgets || [];
|
||||
else if (sectionId === "right")
|
||||
widgetData = Prefs.topBarRightWidgets || [];
|
||||
widgetData = SettingsData.topBarRightWidgets || [];
|
||||
widgetData.forEach((widget) => {
|
||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||
var widgetEnabled = typeof widget === "string" ? true : widget.enabled;
|
||||
@@ -285,23 +285,23 @@ ScrollView {
|
||||
contentHeight: column.implicitHeight + Theme.spacingXL
|
||||
clip: true
|
||||
Component.onCompleted: {
|
||||
if (!Prefs.topBarLeftWidgets || Prefs.topBarLeftWidgets.length === 0)
|
||||
Prefs.setTopBarLeftWidgets(defaultLeftWidgets);
|
||||
if (!SettingsData.topBarLeftWidgets || SettingsData.topBarLeftWidgets.length === 0)
|
||||
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets);
|
||||
|
||||
if (!Prefs.topBarCenterWidgets || Prefs.topBarCenterWidgets.length === 0)
|
||||
Prefs.setTopBarCenterWidgets(defaultCenterWidgets);
|
||||
if (!SettingsData.topBarCenterWidgets || SettingsData.topBarCenterWidgets.length === 0)
|
||||
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets);
|
||||
|
||||
if (!Prefs.topBarRightWidgets || Prefs.topBarRightWidgets.length === 0)
|
||||
Prefs.setTopBarRightWidgets(defaultRightWidgets);
|
||||
if (!SettingsData.topBarRightWidgets || SettingsData.topBarRightWidgets.length === 0)
|
||||
SettingsData.setTopBarRightWidgets(defaultRightWidgets);
|
||||
|
||||
["left", "center", "right"].forEach((sectionId) => {
|
||||
var widgets = [];
|
||||
if (sectionId === "left")
|
||||
widgets = Prefs.topBarLeftWidgets.slice();
|
||||
widgets = SettingsData.topBarLeftWidgets.slice();
|
||||
else if (sectionId === "center")
|
||||
widgets = Prefs.topBarCenterWidgets.slice();
|
||||
widgets = SettingsData.topBarCenterWidgets.slice();
|
||||
else if (sectionId === "right")
|
||||
widgets = Prefs.topBarRightWidgets.slice();
|
||||
widgets = SettingsData.topBarRightWidgets.slice();
|
||||
var updated = false;
|
||||
for (var i = 0; i < widgets.length; i++) {
|
||||
var widget = widgets[i];
|
||||
@@ -315,11 +315,11 @@ ScrollView {
|
||||
}
|
||||
if (updated) {
|
||||
if (sectionId === "left")
|
||||
Prefs.setTopBarLeftWidgets(widgets);
|
||||
SettingsData.setTopBarLeftWidgets(widgets);
|
||||
else if (sectionId === "center")
|
||||
Prefs.setTopBarCenterWidgets(widgets);
|
||||
SettingsData.setTopBarCenterWidgets(widgets);
|
||||
else if (sectionId === "right")
|
||||
Prefs.setTopBarRightWidgets(widgets);
|
||||
SettingsData.setTopBarRightWidgets(widgets);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -393,9 +393,9 @@ ScrollView {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Prefs.setTopBarLeftWidgets(defaultLeftWidgets);
|
||||
Prefs.setTopBarCenterWidgets(defaultCenterWidgets);
|
||||
Prefs.setTopBarRightWidgets(defaultRightWidgets);
|
||||
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets);
|
||||
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets);
|
||||
SettingsData.setTopBarRightWidgets(defaultRightWidgets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,9 +473,9 @@ ScrollView {
|
||||
}
|
||||
onCompactModeChanged: (widgetId, enabled) => {
|
||||
if (widgetId === "clock") {
|
||||
Prefs.setClockCompactMode(enabled);
|
||||
SettingsData.setClockCompactMode(enabled);
|
||||
} else if (widgetId === "music") {
|
||||
Prefs.setMediaCompactMode(enabled);
|
||||
SettingsData.setMediaCompactMode(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,9 +506,9 @@ ScrollView {
|
||||
}
|
||||
onCompactModeChanged: (widgetId, enabled) => {
|
||||
if (widgetId === "clock") {
|
||||
Prefs.setClockCompactMode(enabled);
|
||||
SettingsData.setClockCompactMode(enabled);
|
||||
} else if (widgetId === "music") {
|
||||
Prefs.setMediaCompactMode(enabled);
|
||||
SettingsData.setMediaCompactMode(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,9 +539,9 @@ ScrollView {
|
||||
}
|
||||
onCompactModeChanged: (widgetId, enabled) => {
|
||||
if (widgetId === "clock") {
|
||||
Prefs.setClockCompactMode(enabled);
|
||||
SettingsData.setClockCompactMode(enabled);
|
||||
} else if (widgetId === "music") {
|
||||
Prefs.setMediaCompactMode(enabled);
|
||||
SettingsData.setMediaCompactMode(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,9 +588,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Workspace Index Numbers"
|
||||
description: "Show workspace index numbers in the top bar workspace switcher"
|
||||
checked: Prefs.showWorkspaceIndex
|
||||
checked: SettingsData.showWorkspaceIndex
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setShowWorkspaceIndex(checked);
|
||||
return SettingsData.setShowWorkspaceIndex(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,9 +598,9 @@ ScrollView {
|
||||
width: parent.width
|
||||
text: "Workspace Padding"
|
||||
description: "Always show a minimum of 3 workspaces, even if fewer are available"
|
||||
checked: Prefs.showWorkspacePadding
|
||||
checked: SettingsData.showWorkspacePadding
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setShowWorkspacePadding(checked);
|
||||
return SettingsData.setShowWorkspacePadding(checked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Rectangle {
|
||||
spacing: Theme.spacingS
|
||||
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -43,7 +43,7 @@ Rectangle {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.outlineButton
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !Prefs.clockCompactMode
|
||||
visible: !SettingsData.clockCompactMode
|
||||
}
|
||||
|
||||
StyledText {
|
||||
@@ -51,7 +51,7 @@ Rectangle {
|
||||
font.pixelSize: Theme.fontSizeMedium - 1
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !Prefs.clockCompactMode
|
||||
visible: !SettingsData.clockCompactMode
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,17 +22,17 @@ Rectangle {
|
||||
}
|
||||
|
||||
SystemLogo {
|
||||
visible: Prefs.useOSLogo
|
||||
visible: SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
width: Theme.iconSize - 3
|
||||
height: Theme.iconSize - 3
|
||||
colorOverride: Prefs.osLogoColorOverride
|
||||
brightnessOverride: Prefs.osLogoBrightness
|
||||
contrastOverride: Prefs.osLogoContrast
|
||||
colorOverride: SettingsData.osLogoColorOverride
|
||||
brightnessOverride: SettingsData.osLogoBrightness
|
||||
contrastOverride: SettingsData.osLogoContrast
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
visible: !Prefs.useOSLogo
|
||||
visible: !SettingsData.useOSLogo
|
||||
anchors.centerIn: parent
|
||||
name: "apps"
|
||||
size: Theme.iconSize - 6
|
||||
|
||||
@@ -33,7 +33,7 @@ Rectangle {
|
||||
PropertyChanges {
|
||||
target: root
|
||||
opacity: 1
|
||||
width: Prefs.mediaCompactMode ? compactContentWidth : normalContentWidth
|
||||
width: SettingsData.mediaCompactMode ? compactContentWidth : normalContentWidth
|
||||
}
|
||||
|
||||
},
|
||||
@@ -100,8 +100,8 @@ Rectangle {
|
||||
id: mediaText
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Prefs.mediaCompactMode ? 60 : 140
|
||||
visible: !Prefs.mediaCompactMode
|
||||
width: SettingsData.mediaCompactMode ? 60 : 140
|
||||
visible: !SettingsData.mediaCompactMode
|
||||
text: {
|
||||
if (!activePlayer || !activePlayer.trackTitle)
|
||||
return "";
|
||||
|
||||
@@ -23,9 +23,9 @@ Rectangle {
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: Prefs.doNotDisturb ? "notifications_off" : "notifications"
|
||||
name: SessionData.doNotDisturb ? "notifications_off" : "notifications"
|
||||
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 {
|
||||
|
||||
@@ -18,7 +18,7 @@ PanelWindow {
|
||||
|
||||
property var modelData
|
||||
property string screenName: modelData.name
|
||||
property real backgroundTransparency: Prefs.topBarTransparency
|
||||
property real backgroundTransparency: SettingsData.topBarTransparency
|
||||
readonly property int notificationCount: NotificationService.notifications.length
|
||||
|
||||
screen: modelData
|
||||
@@ -29,7 +29,7 @@ PanelWindow {
|
||||
if (fonts.indexOf("Material Symbols Rounded") === -1)
|
||||
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(() => {
|
||||
leftSection.visible = false;
|
||||
centerSection.visible = false;
|
||||
@@ -45,10 +45,10 @@ PanelWindow {
|
||||
|
||||
Connections {
|
||||
function onTopBarTransparencyChanged() {
|
||||
root.backgroundTransparency = Prefs.topBarTransparency;
|
||||
root.backgroundTransparency = SettingsData.topBarTransparency;
|
||||
}
|
||||
|
||||
target: Prefs
|
||||
target: SettingsData
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -246,7 +246,7 @@ PanelWindow {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Repeater {
|
||||
model: Prefs.topBarLeftWidgetsModel
|
||||
model: SettingsData.topBarLeftWidgetsModel
|
||||
|
||||
Loader {
|
||||
property string widgetId: model.widgetId
|
||||
@@ -367,7 +367,7 @@ PanelWindow {
|
||||
Repeater {
|
||||
id: centerRepeater
|
||||
|
||||
model: Prefs.topBarCenterWidgetsModel
|
||||
model: SettingsData.topBarCenterWidgetsModel
|
||||
|
||||
Loader {
|
||||
property string widgetId: model.widgetId
|
||||
@@ -401,7 +401,7 @@ PanelWindow {
|
||||
Qt.callLater(centerSection.updateLayout);
|
||||
}
|
||||
|
||||
target: Prefs.topBarCenterWidgetsModel
|
||||
target: SettingsData.topBarCenterWidgetsModel
|
||||
}
|
||||
|
||||
}
|
||||
@@ -415,7 +415,7 @@ PanelWindow {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Repeater {
|
||||
model: Prefs.topBarRightWidgetsModel
|
||||
model: SettingsData.topBarRightWidgetsModel
|
||||
|
||||
Loader {
|
||||
property string widgetId: model.widgetId
|
||||
|
||||
@@ -12,7 +12,7 @@ Rectangle {
|
||||
|
||||
signal clicked()
|
||||
|
||||
visible: Prefs.weatherEnabled
|
||||
visible: SettingsData.weatherEnabled
|
||||
width: visible ? Math.min(100, weatherRow.implicitWidth + Theme.spacingS * 2) : 0
|
||||
height: 30
|
||||
radius: Theme.cornerRadius
|
||||
@@ -39,7 +39,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
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
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -12,7 +12,7 @@ Rectangle {
|
||||
property int currentWorkspace: getDisplayActiveWorkspace()
|
||||
property var workspaceList: {
|
||||
var baseList = getDisplayWorkspaces();
|
||||
return Prefs.showWorkspacePadding ? padWorkspaces(baseList) : baseList;
|
||||
return SettingsData.showWorkspacePadding ? padWorkspaces(baseList) : baseList;
|
||||
}
|
||||
|
||||
function padWorkspaces(list) {
|
||||
@@ -54,7 +54,7 @@ Rectangle {
|
||||
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
|
||||
radius: Theme.cornerRadiusLarge
|
||||
color: {
|
||||
@@ -65,7 +65,7 @@ Rectangle {
|
||||
|
||||
Connections {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ Rectangle {
|
||||
|
||||
function onNiriAvailableChanged() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -86,10 +86,10 @@ Rectangle {
|
||||
Connections {
|
||||
function onShowWorkspacePaddingChanged() {
|
||||
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 {
|
||||
@@ -127,7 +127,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
visible: Prefs.showWorkspaceIndex
|
||||
visible: SettingsData.showWorkspaceIndex
|
||||
anchors.centerIn: parent
|
||||
text: isPlaceholder ? sequentialNumber : sequentialNumber
|
||||
color: isActive ? Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.95) : isPlaceholder ? Theme.surfaceTextAlpha : Theme.surfaceTextMedium
|
||||
|
||||
@@ -6,7 +6,7 @@ import qs.Common
|
||||
import qs.Widgets
|
||||
|
||||
LazyLoader {
|
||||
active: Prefs.wallpaperPath !== ""
|
||||
active: SessionData.wallpaperPath !== ""
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
@@ -32,7 +32,7 @@ LazyLoader {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
|
||||
property string source: Prefs.wallpaperPath || ""
|
||||
property string source: SessionData.wallpaperPath || ""
|
||||
property Image current: one
|
||||
|
||||
onSourceChanged: {
|
||||
|
||||
@@ -55,7 +55,7 @@ Singleton {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.userPreference = Prefs.networkPreference
|
||||
root.userPreference = SettingsData.networkPreference
|
||||
|
||||
if (root.networkStatus === "wifi" && root.wifiEnabled) {
|
||||
updateCurrentWifiInfo()
|
||||
@@ -402,7 +402,7 @@ Singleton {
|
||||
root.userPreference = preference
|
||||
root.changingPreference = true
|
||||
root.targetPreference = preference
|
||||
Prefs.setNetworkPreference(preference)
|
||||
SettingsData.setNetworkPreference(preference)
|
||||
|
||||
if (preference === "wifi") {
|
||||
// Set WiFi to low route metric (high priority), ethernet to high route metric (low priority)
|
||||
|
||||
@@ -57,7 +57,7 @@ Singleton {
|
||||
onNotification: notif => {
|
||||
notif.tracked = true;
|
||||
|
||||
const shouldShowPopup = !root.popupsDisabled && !Prefs.doNotDisturb;
|
||||
const shouldShowPopup = !root.popupsDisabled && !SessionData.doNotDisturb;
|
||||
const wrapper = notifComponent.createObject(root, {
|
||||
popup: shouldShowPopup,
|
||||
notification: notif
|
||||
@@ -226,7 +226,7 @@ Singleton {
|
||||
function processQueue() {
|
||||
if (addGateBusy) return;
|
||||
if (popupsDisabled) return;
|
||||
if (Prefs.doNotDisturb) return;
|
||||
if (SessionData.doNotDisturb) return;
|
||||
if (notificationQueue.length === 0) return;
|
||||
|
||||
const [next, ...rest] = notificationQueue;
|
||||
@@ -420,9 +420,9 @@ Singleton {
|
||||
|
||||
|
||||
Connections {
|
||||
target: Prefs
|
||||
target: SessionData
|
||||
function onDoNotDisturbChanged() {
|
||||
if (Prefs.doNotDisturb) {
|
||||
if (SessionData.doNotDisturb) {
|
||||
// Hide all current popups when DND is enabled
|
||||
for (const notif of visibleNotifications) {
|
||||
notif.popup = false;
|
||||
|
||||
@@ -149,8 +149,8 @@ Singleton {
|
||||
var shouldBeLightMode = (root.systemColorScheme === 2)
|
||||
if (Theme.isLightMode !== shouldBeLightMode) {
|
||||
Theme.isLightMode = shouldBeLightMode
|
||||
if (typeof Prefs !== "undefined") {
|
||||
Prefs.setLightMode(shouldBeLightMode)
|
||||
if (typeof SessionData !== "undefined") {
|
||||
SessionData.setLightMode(shouldBeLightMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,13 +92,13 @@ Singleton {
|
||||
}
|
||||
|
||||
function getWeatherUrl() {
|
||||
if (Prefs.useAutoLocation) {
|
||||
if (SettingsData.useAutoLocation) {
|
||||
const url = "wttr.in/?format=j1"
|
||||
console.log("Using auto location, URL:", 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`
|
||||
console.log("Using manual location:", location, "URL:", url)
|
||||
return url
|
||||
@@ -107,7 +107,7 @@ Singleton {
|
||||
function addRef() {
|
||||
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
|
||||
fetchWeather();
|
||||
}
|
||||
@@ -120,7 +120,7 @@ Singleton {
|
||||
|
||||
function fetchWeather() {
|
||||
// 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;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ Singleton {
|
||||
Timer {
|
||||
id: updateTimer
|
||||
interval: root.updateInterval
|
||||
running: root.refCount > 0 && !IdleService.isIdle && Prefs.weatherEnabled
|
||||
running: root.refCount > 0 && !IdleService.isIdle && SettingsData.weatherEnabled
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: {
|
||||
@@ -261,7 +261,7 @@ Singleton {
|
||||
console.log("WeatherService: System idle, pausing weather updates")
|
||||
} else {
|
||||
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
|
||||
root.fetchWeather()
|
||||
}
|
||||
@@ -291,7 +291,7 @@ Singleton {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Prefs.weatherCoordinatesChanged.connect(() => {
|
||||
SettingsData.weatherCoordinatesChanged.connect(() => {
|
||||
console.log("Weather location changed, force refreshing weather")
|
||||
root.weather = {
|
||||
available: false,
|
||||
@@ -311,13 +311,13 @@ Singleton {
|
||||
root.forceRefresh()
|
||||
})
|
||||
|
||||
Prefs.weatherLocationChanged.connect(() => {
|
||||
SettingsData.weatherLocationChanged.connect(() => {
|
||||
console.log("Weather location display name changed")
|
||||
const currentWeather = Object.assign({}, root.weather)
|
||||
root.weather = currentWeather
|
||||
})
|
||||
|
||||
Prefs.useAutoLocationChanged.connect(() => {
|
||||
SettingsData.useAutoLocationChanged.connect(() => {
|
||||
console.log("Auto location setting changed, force refreshing weather")
|
||||
root.weather = {
|
||||
available: false,
|
||||
@@ -337,12 +337,12 @@ Singleton {
|
||||
root.forceRefresh()
|
||||
})
|
||||
|
||||
Prefs.weatherEnabledChanged.connect(() => {
|
||||
console.log("Weather enabled setting changed:", Prefs.weatherEnabled)
|
||||
if (Prefs.weatherEnabled && root.refCount > 0 && !root.weather.available) {
|
||||
SettingsData.weatherEnabledChanged.connect(() => {
|
||||
console.log("Weather enabled setting changed:", SettingsData.weatherEnabled)
|
||||
if (SettingsData.weatherEnabled && root.refCount > 0 && !root.weather.available) {
|
||||
// Start fetching when weather is re-enabled
|
||||
root.forceRefresh()
|
||||
} else if (!Prefs.weatherEnabled) {
|
||||
} else if (!SettingsData.weatherEnabled) {
|
||||
// Stop all timers when weather is disabled
|
||||
updateTimer.stop()
|
||||
retryTimer.stop()
|
||||
|
||||
@@ -102,7 +102,7 @@ GridView {
|
||||
id: iconImg
|
||||
|
||||
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
|
||||
asynchronous: true
|
||||
visible: status === Image.Ready
|
||||
|
||||
@@ -89,7 +89,7 @@ ListView {
|
||||
id: iconImg
|
||||
|
||||
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
|
||||
asynchronous: true
|
||||
visible: status === Image.Ready
|
||||
|
||||
@@ -141,14 +141,14 @@ Column {
|
||||
id: compactModeButton
|
||||
anchors.fill: parent
|
||||
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
|
||||
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: {
|
||||
if (modelData.id === "clock") {
|
||||
root.compactModeChanged("clock", !Prefs.clockCompactMode);
|
||||
root.compactModeChanged("clock", !SettingsData.clockCompactMode);
|
||||
} else if (modelData.id === "music") {
|
||||
root.compactModeChanged("music", !Prefs.mediaCompactMode);
|
||||
root.compactModeChanged("music", !SettingsData.mediaCompactMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ Text {
|
||||
color: Theme.surfaceText
|
||||
font.pixelSize: Appearance.fontSize.normal
|
||||
font.family: {
|
||||
var requestedFont = isMonospace ? Prefs.monoFontFamily : Prefs.fontFamily;
|
||||
var defaultFont = isMonospace ? Prefs.defaultMonoFontFamily : Prefs.defaultFontFamily;
|
||||
var requestedFont = isMonospace ? SettingsData.monoFontFamily : SettingsData.fontFamily;
|
||||
var defaultFont = isMonospace ? SettingsData.defaultMonoFontFamily : SettingsData.defaultFontFamily;
|
||||
if (requestedFont === defaultFont) {
|
||||
var availableFonts = Qt.fontFamilies();
|
||||
if (!availableFonts.includes(requestedFont))
|
||||
@@ -20,7 +20,7 @@ Text {
|
||||
}
|
||||
return requestedFont;
|
||||
}
|
||||
font.weight: Prefs.fontWeight
|
||||
font.weight: SettingsData.fontWeight
|
||||
wrapMode: Text.WordWrap
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
Reference in New Issue
Block a user