mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 21:45:38 -05:00
config refacotr: separate settings.json, session.json, appusage.json
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user