forked from Shinonome/dots-hyprland
first run experience
This commit is contained in:
@@ -29,6 +29,7 @@ Singleton {
|
|||||||
property string notificationsPath: FileUtils.trimFileProtocol(`${Directories.cache}/notifications/notifications.json`)
|
property string notificationsPath: FileUtils.trimFileProtocol(`${Directories.cache}/notifications/notifications.json`)
|
||||||
property string generatedMaterialThemePath: FileUtils.trimFileProtocol(`${Directories.state}/user/generated/colors.json`)
|
property string generatedMaterialThemePath: FileUtils.trimFileProtocol(`${Directories.state}/user/generated/colors.json`)
|
||||||
property string cliphistDecode: FileUtils.trimFileProtocol(`/tmp/quickshell/media/cliphist`)
|
property string cliphistDecode: FileUtils.trimFileProtocol(`/tmp/quickshell/media/cliphist`)
|
||||||
|
property string wallpaperSwitchScriptPath: FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/switchwall.sh`)
|
||||||
// Cleanup on init
|
// Cleanup on init
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Hyprland.dispatch(`exec mkdir -p '${favicons}'`)
|
Hyprland.dispatch(`exec mkdir -p '${favicons}'`)
|
||||||
|
|||||||
@@ -43,27 +43,27 @@ Item { // Wrapper
|
|||||||
{
|
{
|
||||||
action: "img",
|
action: "img",
|
||||||
execute: () => {
|
execute: () => {
|
||||||
executor.executeCommand(`${xdgConfigHome}/quickshell/scripts/switchwall.sh`.replace(/file:\/\//, ""))
|
executor.executeCommand(Directories.wallpaperSwitchScriptPath)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: "dark",
|
action: "dark",
|
||||||
execute: () => {
|
execute: () => {
|
||||||
executor.executeCommand(`${xdgConfigHome}/quickshell/scripts/switchwall.sh --mode dark --noswitch`.replace(/file:\/\//, ""))
|
executor.executeCommand(`${Directories.wallpaperSwitchScriptPath} --mode dark --noswitch`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: "light",
|
action: "light",
|
||||||
execute: () => {
|
execute: () => {
|
||||||
executor.executeCommand(`${xdgConfigHome}/quickshell/scripts/switchwall.sh --mode light --noswitch`.replace(/file:\/\//, ""))
|
executor.executeCommand(`${Directories.wallpaperSwitchScriptPath} --mode light --noswitch`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
action: "accentcolor",
|
action: "accentcolor",
|
||||||
execute: (args) => {
|
execute: (args) => {
|
||||||
executor.executeCommand(
|
executor.executeCommand(
|
||||||
`${xdgConfigHome}/quickshell/scripts/switchwall.sh --noswitch --color ${args != '' ? ("'"+args+"'") : ""}`
|
`${Directories.wallpaperSwitchScriptPath} --noswitch --color ${args != '' ? ("'"+args+"'") : ""}`
|
||||||
.replace(/file:\/\//, ""))
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@ ShellRoot {
|
|||||||
ConfigLoader.loadConfig()
|
ConfigLoader.loadConfig()
|
||||||
PersistentStateManager.loadStates()
|
PersistentStateManager.loadStates()
|
||||||
Cliphist.refresh()
|
Cliphist.refresh()
|
||||||
|
FirstRunExperience.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader { active: enableBar; sourceComponent: Bar {} }
|
Loader { active: enableBar; sourceComponent: Bar {} }
|
||||||
|
|||||||
Reference in New Issue
Block a user