diff options
| author | AlexanderCurl <alexc@alexc.hu> | 2026-04-18 17:46:06 +0100 |
|---|---|---|
| committer | AlexanderCurl <alexc@alexc.hu> | 2026-04-18 17:46:06 +0100 |
| commit | 70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch) | |
| tree | ab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Services/FirstLaunchService.qml | |
| parent | 5d94c0a7d44a2255b81815a52a7056a94a39842d (diff) | |
| download | RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip | |
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Services/FirstLaunchService.qml')
| -rw-r--r-- | raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Services/FirstLaunchService.qml | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Services/FirstLaunchService.qml b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Services/FirstLaunchService.qml new file mode 100644 index 0000000..8b7acd3 --- /dev/null +++ b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Services/FirstLaunchService.qml @@ -0,0 +1,111 @@ +pragma Singleton +pragma ComponentBehavior: Bound + +import QtCore +import QtQuick +import Quickshell +import Quickshell.Io +import qs.Common + +Singleton { + id: root + + readonly property string configDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation)) + "/DankMaterialShell" + readonly property string settingsPath: configDir + "/settings.json" + readonly property string firstLaunchMarkerPath: configDir + "/.firstlaunch" + + property bool isFirstLaunch: false + property bool checkComplete: false + property bool greeterDismissed: false + property int requestedStartPage: 0 + + readonly property bool shouldShowGreeter: checkComplete && isFirstLaunch && !greeterDismissed + + signal greeterRequested + signal greeterCompleted + + function showGreeter(startPage) { + requestedStartPage = startPage || 0; + greeterRequested(); + } + + function showWelcome() { + showGreeter(0); + } + + function showDoctor() { + showGreeter(1); + } + + Component.onCompleted: { + checkFirstLaunch(); + } + + function checkFirstLaunch() { + firstLaunchCheckProcess.running = true; + } + + function markFirstLaunchComplete() { + greeterDismissed = true; + touchMarkerProcess.running = true; + greeterCompleted(); + } + + function dismissGreeter() { + greeterDismissed = true; + } + + Process { + id: firstLaunchCheckProcess + + command: ["sh", "-c", ` + SETTINGS='` + settingsPath + `' + MARKER='` + firstLaunchMarkerPath + `' + if [ -f "$MARKER" ]; then + echo 'skip' + elif [ -f "$SETTINGS" ]; then + echo 'existing_user' + else + echo 'first' + fi + `] + running: false + + stdout: SplitParser { + onRead: data => { + const result = data.trim(); + + if (result === "first") { + root.isFirstLaunch = true; + console.info("FirstLaunchService: First launch detected, greeter will be shown"); + } else if (result === "existing_user") { + root.isFirstLaunch = false; + console.info("FirstLaunchService: Existing user detected, silently creating marker"); + touchMarkerProcess.running = true; + } else { + root.isFirstLaunch = false; + } + + root.checkComplete = true; + + if (root.isFirstLaunch) + root.greeterRequested(); + } + } + } + + Process { + id: touchMarkerProcess + + command: ["sh", "-c", "mkdir -p '" + configDir + "' && touch '" + firstLaunchMarkerPath + "'"] + running: false + + onExited: exitCode => { + if (exitCode === 0) { + console.info("FirstLaunchService: First launch marker created"); + } else { + console.warn("FirstLaunchService: Failed to create first launch marker"); + } + } + } +} |