-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathwaffleSettings.qml
More file actions
157 lines (138 loc) · 4.6 KB
/
waffleSettings.qml
File metadata and controls
157 lines (138 loc) · 4.6 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//@ pragma UseQApplication
//@ pragma Env QS_NO_RELOAD_POPUP=1
//@ pragma Env QT_QUICK_CONTROLS_STYLE=Basic
//@ pragma Env QT_QUICK_FLICKABLE_WHEEL_DECELERATION=10000
//@ pragma Env QT_SCALE_FACTOR=1
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import Quickshell
import qs.services
import qs.modules.common
import qs.modules.common.functions as CF
import qs.modules.waffle.looks
import qs.modules.waffle.settings
ApplicationWindow {
id: root
property bool uiReady: Config.ready && ThemeService.ready
property var pages: [
{
name: Translation.tr("Quick"),
icon: "flash-on",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WQuickPage.qml")
},
{
name: Translation.tr("General"),
icon: "settings",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WGeneralPage.qml")
},
{
name: Translation.tr("Taskbar"),
icon: "desktop",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WBarPage.qml")
},
{
name: Translation.tr("Background"),
icon: "image",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WBackgroundPage.qml")
},
{
name: Translation.tr("Themes"),
icon: "dark-theme",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WThemesPage.qml")
},
{
name: Translation.tr("Interface"),
icon: "apps",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WInterfacePage.qml")
},
{
name: Translation.tr("Modules"),
icon: "settings-cog-multiple",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WModulesPage.qml")
},
{
name: Translation.tr("Waffle Style"),
icon: "desktop",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WWaffleStylePage.qml")
},
{
name: Translation.tr("Shortcuts"),
icon: "keyboard",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WShortcutsPage.qml")
},
{
name: Translation.tr("About"),
icon: "info",
component: Qt.resolvedUrl("modules/waffle/settings/pages/WAboutPage.qml")
}
]
property int currentPage: 0
visible: true
onClosing: Qt.quit()
title: "Settings — illogical-impulse"
Component.onCompleted: {
Config.readWriteDelay = 0
const startPage = Quickshell.env("QS_SETTINGS_PAGE");
if (startPage) root.currentPage = parseInt(startPage);
const startSection = Quickshell.env("QS_SETTINGS_SECTION");
if (startSection) {
root.pendingSpotlightSection = startSection;
root.pendingSpotlightPageIndex = root.currentPage;
root.trySpotlight();
}
}
Connections {
target: Config
function onReadyChanged() {
if (Config.ready) ThemeService.applyCurrentTheme()
}
}
minimumWidth: 700
minimumHeight: 450
width: 1000
height: 650
color: root.uiReady ? Looks.colors.bg0Opaque : "transparent"
// Loading state
Item {
anchors.fill: parent
visible: !root.uiReady
WText {
anchors.centerIn: parent
text: Translation.tr("Loading...")
font.pixelSize: Looks.font.pixelSize.larger
color: Looks.colors.subfg
}
}
// Main content
WSettingsContent {
anchors.fill: parent
visible: root.uiReady
opacity: visible ? 1 : 0
pages: root.pages
currentPage: root.currentPage
onCurrentPageChanged: root.currentPage = currentPage
onCloseRequested: root.close()
Behavior on opacity {
NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
}
}
// Keyboard shortcuts
Shortcut {
sequence: "Ctrl+PageDown"
onActivated: root.currentPage = Math.min(root.currentPage + 1, root.pages.length - 1)
}
Shortcut {
sequence: "Ctrl+PageUp"
onActivated: root.currentPage = Math.max(root.currentPage - 1, 0)
}
Shortcut {
sequence: "Ctrl+Tab"
onActivated: root.currentPage = (root.currentPage + 1) % root.pages.length
}
Shortcut {
sequence: "Ctrl+Shift+Tab"
onActivated: root.currentPage = (root.currentPage - 1 + root.pages.length) % root.pages.length
}
}