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

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

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

View File

@@ -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();
}
}

View File

@@ -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) {

View File

@@ -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
}
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);
}
}
}

View File

@@ -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 {

View File

@@ -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 ""

View File

@@ -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() }
}
}

View File

@@ -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()
}

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
}

View File

@@ -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)

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -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: {}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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
}
}

View File

@@ -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

View File

@@ -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 "";

View File

@@ -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 {

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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: {