diff --git a/.config/quickshell/modules/common/Directories.qml b/.config/quickshell/modules/common/Directories.qml index 2a1b55b72..9e3e3000f 100644 --- a/.config/quickshell/modules/common/Directories.qml +++ b/.config/quickshell/modules/common/Directories.qml @@ -29,6 +29,7 @@ Singleton { property string notificationsPath: FileUtils.trimFileProtocol(`${Directories.cache}/notifications/notifications.json`) property string generatedMaterialThemePath: FileUtils.trimFileProtocol(`${Directories.state}/user/generated/colors.json`) property string cliphistDecode: FileUtils.trimFileProtocol(`/tmp/quickshell/media/cliphist`) + property string wallpaperSwitchScriptPath: FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/switchwall.sh`) // Cleanup on init Component.onCompleted: { Hyprland.dispatch(`exec mkdir -p '${favicons}'`) diff --git a/.config/quickshell/modules/overview/SearchWidget.qml b/.config/quickshell/modules/overview/SearchWidget.qml index 59740a06d..df3972944 100644 --- a/.config/quickshell/modules/overview/SearchWidget.qml +++ b/.config/quickshell/modules/overview/SearchWidget.qml @@ -43,27 +43,27 @@ Item { // Wrapper { action: "img", execute: () => { - executor.executeCommand(`${xdgConfigHome}/quickshell/scripts/switchwall.sh`.replace(/file:\/\//, "")) + executor.executeCommand(Directories.wallpaperSwitchScriptPath) } }, { action: "dark", execute: () => { - executor.executeCommand(`${xdgConfigHome}/quickshell/scripts/switchwall.sh --mode dark --noswitch`.replace(/file:\/\//, "")) + executor.executeCommand(`${Directories.wallpaperSwitchScriptPath} --mode dark --noswitch`) } }, { action: "light", execute: () => { - executor.executeCommand(`${xdgConfigHome}/quickshell/scripts/switchwall.sh --mode light --noswitch`.replace(/file:\/\//, "")) + executor.executeCommand(`${Directories.wallpaperSwitchScriptPath} --mode light --noswitch`) } }, { action: "accentcolor", execute: (args) => { executor.executeCommand( - `${xdgConfigHome}/quickshell/scripts/switchwall.sh --noswitch --color ${args != '' ? ("'"+args+"'") : ""}` - .replace(/file:\/\//, "")) + `${Directories.wallpaperSwitchScriptPath} --noswitch --color ${args != '' ? ("'"+args+"'") : ""}` + ) } }, { diff --git a/.config/quickshell/services/FirstRunExperience.qml b/.config/quickshell/services/FirstRunExperience.qml new file mode 100644 index 000000000..eee995a55 --- /dev/null +++ b/.config/quickshell/services/FirstRunExperience.qml @@ -0,0 +1,36 @@ +pragma Singleton + +import "root:/modules/common/functions/file_utils.js" as FileUtils +import "root:/modules/common" +import Quickshell +import Quickshell.Io +import Quickshell.Hyprland + +Singleton { + id: root + property string firstRunFilePath: `${Directories.state}/user/first_run.txt` + property string firstRunFileContent: "This file is just here to confirm you've been greeted :>" + property string firstRunNotifSummary: "Welcome!" + property string firstRunNotifBody: "Hit Super+/ for a list of keybinds" + property string defaultWallpaperPath: FileUtils.trimFileProtocol(`${Directories.config}/quickshell/assets/images/default_wallpaper.png`) + + function load() { + firstRunFileView.reload() + } + + function handleFirstRun() { + Hyprland.dispatch(`exec notify-send '${root.firstRunNotifSummary}' '${root.firstRunNotifBody}' -a 'Shell'`) + Hyprland.dispatch(`exec '${Directories.wallpaperSwitchScriptPath}' '${root.defaultWallpaperPath}'`) + } + + FileView { + id: firstRunFileView + path: Qt.resolvedUrl(firstRunFilePath) + onLoadFailed: (error) => { + if (error == FileViewError.FileNotFound) { + firstRunFileView.setText(root.firstRunFileContent) + root.handleFirstRun() + } + } + } +} diff --git a/.config/quickshell/shell.qml b/.config/quickshell/shell.qml index edd72ba92..29ab0f327 100644 --- a/.config/quickshell/shell.qml +++ b/.config/quickshell/shell.qml @@ -44,6 +44,7 @@ ShellRoot { ConfigLoader.loadConfig() PersistentStateManager.loadStates() Cliphist.refresh() + FirstRunExperience.load() } Loader { active: enableBar; sourceComponent: Bar {} }