mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
Add support for default-session.json
This commit is contained in:
@@ -23,6 +23,10 @@ Singleton {
|
|||||||
property int nightModeTemperature: 4500
|
property int nightModeTemperature: 4500
|
||||||
property bool nightModeAutoEnabled: false
|
property bool nightModeAutoEnabled: false
|
||||||
property string nightModeAutoMode: "time"
|
property string nightModeAutoMode: "time"
|
||||||
|
|
||||||
|
property bool hasTriedDefaultSession: false
|
||||||
|
readonly property string _stateUrl: StandardPaths.writableLocation(StandardPaths.GenericStateLocation)
|
||||||
|
readonly property string _stateDir: _stateUrl.startsWith("file://") ? _stateUrl.substring(7) : _stateUrl
|
||||||
property int nightModeStartHour: 18
|
property int nightModeStartHour: 18
|
||||||
property int nightModeStartMinute: 0
|
property int nightModeStartMinute: 0
|
||||||
property int nightModeEndHour: 6
|
property int nightModeEndHour: 6
|
||||||
@@ -96,6 +100,17 @@ Singleton {
|
|||||||
wallpaperCyclingTime = settings.wallpaperCyclingTime !== undefined ? settings.wallpaperCyclingTime : "06:00"
|
wallpaperCyclingTime = settings.wallpaperCyclingTime !== undefined ? settings.wallpaperCyclingTime : "06:00"
|
||||||
lastBrightnessDevice = settings.lastBrightnessDevice !== undefined ? settings.lastBrightnessDevice : ""
|
lastBrightnessDevice = settings.lastBrightnessDevice !== undefined ? settings.lastBrightnessDevice : ""
|
||||||
notepadContent = settings.notepadContent !== undefined ? settings.notepadContent : ""
|
notepadContent = settings.notepadContent !== undefined ? settings.notepadContent : ""
|
||||||
|
|
||||||
|
// Apply dynamic theming if wallpaper exists and dynamic theming is enabled
|
||||||
|
if (wallpaperPath && wallpaperPath !== "") {
|
||||||
|
if (typeof Theme !== "undefined") {
|
||||||
|
if (typeof SettingsData !== "undefined" && SettingsData.wallpaperDynamicTheming) {
|
||||||
|
Theme.switchTheme("dynamic")
|
||||||
|
Theme.extractColors()
|
||||||
|
}
|
||||||
|
Theme.generateSystemThemesFromCurrentTheme()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
@@ -388,8 +403,28 @@ Singleton {
|
|||||||
watchChanges: true
|
watchChanges: true
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
parseSettings(settingsFile.text())
|
parseSettings(settingsFile.text())
|
||||||
|
hasTriedDefaultSession = false
|
||||||
|
}
|
||||||
|
onLoadFailed: error => {
|
||||||
|
if (!hasTriedDefaultSession) {
|
||||||
|
hasTriedDefaultSession = true
|
||||||
|
defaultSessionCheckProcess.running = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: defaultSessionCheckProcess
|
||||||
|
|
||||||
|
command: ["sh", "-c", "CONFIG_DIR=\"" + _stateDir
|
||||||
|
+ "/DankMaterialShell\"; if [ -f \"$CONFIG_DIR/default-session.json\" ] && [ ! -f \"$CONFIG_DIR/session.json\" ]; then cp \"$CONFIG_DIR/default-session.json\" \"$CONFIG_DIR/session.json\" && echo 'copied'; else echo 'not_found'; fi"]
|
||||||
|
running: false
|
||||||
|
onExited: exitCode => {
|
||||||
|
if (exitCode === 0) {
|
||||||
|
console.log("Copied default-session.json to session.json")
|
||||||
|
settingsFile.reload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onLoadFailed: error => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ Rectangle {
|
|||||||
const relativeX = globalPos.x - screenX;
|
const relativeX = globalPos.x - screenX;
|
||||||
menuAnchor.menu = trayItem.menu;
|
menuAnchor.menu = trayItem.menu;
|
||||||
menuAnchor.anchor.window = parentWindow;
|
menuAnchor.anchor.window = parentWindow;
|
||||||
menuAnchor.anchor.rect = Qt.rect(relativeX, Theme.barHeight + Theme.spacingS, parent.width, 1);
|
menuAnchor.anchor.rect = Qt.rect(relativeX, parentWindow.effectiveBarHeight + SettingsData.topBarSpacing, parent.width, 1);
|
||||||
menuAnchor.open();
|
menuAnchor.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user