aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/autostart/AutostartModule.qml
blob: 24c69da9448ccf6dae6574d31693ee53ccbbf5de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

import Quickshell
import Quickshell.Io
import QtQuick
import "../.."
import "Autostart.js" as A

// What Hyprland launches at login, from hypr-theme's autostart.lua. Set once
// and left alone, so it lives in the settings window, not on a tile.
Module {
    id: am
    name: "autostart"
    label: "Autostart"
    // nf-fa-rocket, present in Inconsolata Nerd Font.
    icon: ""
    settings: true
    keywords: ["login", "startup", "launch", "exec", "daemon", "session",
               "workspace", "silent", "scratchpad", "autostart.lua", "hyprland"]

    readonly property string file: (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config")
                                   + "/hypr/sections/autostart.lua"

    // Every entry, as the page lists it; key is the row's objectName there.
    function refresh() { fv.reload(); }
    property FileView fv: FileView {
        path: am.file
        printErrors: false
        watchChanges: true
        onFileChanged: reload()
        onLoaded: am.searchItems = A.parse(text()).map(e => ({ text: e.cmd, key: e.cmd }))
    }

    page: Component {
        Page {
            title: "Autostart"
            AutostartPage { width: parent.width; file: am.file }
        }
    }
}