aboutsummaryrefslogtreecommitdiffstats
path: root/shared/Workspaces.qml
blob: ca4f5b08ac3b163e69ab9ebfaadb7b4f9d8de25b (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
// 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.

pragma Singleton

import Quickshell
import QtQuick

// The desktop icon for each workspace, the eight waybar drew and the window
// switcher and the island show. Names, not paths: they are resolved through
// the active icon theme, so an icon theme switch changes them everywhere.
// A named workspace, or one past eight, has none, and callers fall back to
// its number.
Singleton {
    readonly property var icons: ({
        1: "web-browser",
        2: "text-editor",
        3: "utilities-terminal",
        4: "network-server",
        5: "document-edit",
        6: "applications-graphics",
        7: "dialog-messages",
        8: "input-gaming",
    })

    function icon(name) {
        const n = parseInt(String(name), 10);
        if (isNaN(n)) return "";
        return icons[n] ?? "";
    }
}