diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell')
17 files changed, 768 insertions, 235 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml b/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml index 57ade488..883f9001 100644 --- a/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml +++ b/accounts/gkleen@sif/shell/quickshell/ActiveWindowDisplay.qml | |||
@@ -22,72 +22,144 @@ Item { | |||
22 | width: activeWindowDisplayContent.width | 22 | width: activeWindowDisplayContent.width |
23 | height: parent.height | 23 | height: parent.height |
24 | 24 | ||
25 | Row { | 25 | WrapperMouseArea { |
26 | id: activeWindowDisplayContent | 26 | id: widgetMouseArea |
27 | 27 | ||
28 | width: childrenRect.width | 28 | anchors.fill: parent |
29 | height: parent.height | ||
30 | anchors.verticalCenter: parent.verticalCenter | ||
31 | spacing: 8 | ||
32 | 29 | ||
33 | IconImage { | 30 | hoverEnabled: true |
34 | id: activeWindowIcon | ||
35 | 31 | ||
36 | height: 14 | 32 | Item { |
37 | width: 14 | 33 | anchors.fill: parent |
38 | 34 | ||
39 | anchors.verticalCenter: parent.verticalCenter | 35 | Row { |
36 | id: activeWindowDisplayContent | ||
40 | 37 | ||
41 | source: { | 38 | width: childrenRect.width |
42 | let icon = activeWindowDisplay.windowEntry?.icon | 39 | height: parent.height |
43 | if (typeof icon === 'string' || icon instanceof String) { | 40 | anchors.verticalCenter: parent.verticalCenter |
44 | if (icon.includes("?path=")) { | 41 | spacing: 8 |
45 | const split = icon.split("?path=") | 42 | |
46 | if (split.length !== 2) | 43 | IconImage { |
44 | id: activeWindowIcon | ||
45 | |||
46 | implicitSize: 14 | ||
47 | |||
48 | anchors.verticalCenter: parent.verticalCenter | ||
49 | |||
50 | source: { | ||
51 | let icon = activeWindowDisplay.windowEntry?.icon | ||
52 | if (typeof icon === 'string' || icon instanceof String) { | ||
53 | if (icon.includes("?path=")) { | ||
54 | const split = icon.split("?path=") | ||
55 | if (split.length !== 2) | ||
56 | return icon | ||
57 | const name = split[0] | ||
58 | const path = split[1] | ||
59 | const fileName = name.substring( | ||
60 | name.lastIndexOf("/") + 1) | ||
61 | return `file://${path}/${fileName}` | ||
62 | } else | ||
63 | icon = Quickshell.iconPath(icon); | ||
47 | return icon | 64 | return icon |
48 | const name = split[0] | 65 | } |
49 | const path = split[1] | 66 | return "" |
50 | const fileName = name.substring( | 67 | } |
51 | name.lastIndexOf("/") + 1) | 68 | asynchronous: true |
52 | return `file://${path}/${fileName}` | 69 | smooth: true |
53 | } else | 70 | mipmap: true |
54 | icon = Quickshell.iconPath(icon); | 71 | } |
55 | return icon | 72 | |
73 | Text { | ||
74 | id: windowTitle | ||
75 | |||
76 | width: Math.min(implicitWidth, activeWindowDisplay.maxWidth - activeWindowIcon.width - activeWindowDisplayContent.spacing) | ||
77 | |||
78 | property var appAliases: { "Firefox": "Mozilla Firefox", "mpv Media Player": "mpv", "Thunderbird": "Mozilla Thunderbird", "Thunderbird (LMU)": "Mozilla Thunderbird" } | ||
79 | |||
80 | elide: Text.ElideRight | ||
81 | maximumLineCount: 1 | ||
82 | color: "white" | ||
83 | anchors.verticalCenter: parent.verticalCenter | ||
84 | text: { | ||
85 | if (!activeWindowDisplay.activeWindow) | ||
86 | return ""; | ||
87 | |||
88 | var title = activeWindowDisplay.activeWindow.title; | ||
89 | var appName = activeWindowDisplay.windowEntry?.name; | ||
90 | if (appAliases[appName]) | ||
91 | appName = appAliases[appName]; | ||
92 | if (appName && title.endsWith(appName)) { | ||
93 | const oldTitle = title; | ||
94 | title = title.substring(0, title.length - appName.length); | ||
95 | title = title.replace(/\s*(—|-)\s*$/, ""); | ||
96 | if (!title) | ||
97 | title = oldTitle; | ||
98 | } | ||
99 | return title; | ||
100 | } | ||
56 | } | 101 | } |
57 | return "" | ||
58 | } | 102 | } |
59 | asynchronous: true | ||
60 | smooth: true | ||
61 | mipmap: true | ||
62 | } | 103 | } |
104 | } | ||
105 | |||
106 | Loader { | ||
107 | id: tooltipLoader | ||
108 | |||
109 | active: false | ||
110 | |||
111 | Connections { | ||
112 | target: widgetMouseArea | ||
113 | function onContainsMouseChanged() { | ||
114 | if (widgetMouseArea.containsMouse) | ||
115 | tooltipLoader.active = true; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | PopupWindow { | ||
120 | id: tooltip | ||
121 | |||
122 | property bool nextVisible: widgetMouseArea.containsMouse || tooltipMouseArea.containsMouse | ||
123 | |||
124 | anchor { | ||
125 | item: widgetMouseArea | ||
126 | edges: Edges.Bottom | Edges.Left | ||
127 | } | ||
128 | visible: false | ||
129 | |||
130 | onNextVisibleChanged: hangTimer.restart() | ||
131 | |||
132 | Timer { | ||
133 | id: hangTimer | ||
134 | interval: tooltip.visible ? 100 : 500 | ||
135 | onTriggered: { | ||
136 | tooltip.visible = tooltip.nextVisible; | ||
137 | if (!tooltip.visible) | ||
138 | tooltipLoader.active = false; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | implicitWidth: widgetTooltipText.contentWidth + 16 | ||
143 | implicitHeight: widgetTooltipText.contentHeight + 16 | ||
144 | color: "black" | ||
145 | |||
146 | WrapperMouseArea { | ||
147 | id: tooltipMouseArea | ||
148 | |||
149 | hoverEnabled: true | ||
150 | enabled: true | ||
151 | |||
152 | anchors.centerIn: parent | ||
153 | |||
154 | Text { | ||
155 | id: widgetTooltipText | ||
156 | |||
157 | font.pointSize: 10 | ||
158 | font.family: "Fira Mono" | ||
159 | color: "white" | ||
63 | 160 | ||
64 | Text { | 161 | text: JSON.stringify(Object.assign({}, activeWindowDisplay.activeWindow), null, 2) |
65 | id: windowTitle | ||
66 | |||
67 | width: Math.min(implicitWidth, activeWindowDisplay.maxWidth - activeWindowIcon.width - activeWindowDisplayContent.spacing) | ||
68 | |||
69 | property var appAliases: { "Firefox": "Mozilla Firefox", "mpv Media Player": "mpv", "Thunderbird": "Mozilla Thunderbird", "Thunderbird (LMU)": "Mozilla Thunderbird" } | ||
70 | |||
71 | elide: Text.ElideRight | ||
72 | maximumLineCount: 1 | ||
73 | color: "white" | ||
74 | anchors.verticalCenter: parent.verticalCenter | ||
75 | text: { | ||
76 | if (!activeWindowDisplay.activeWindow) | ||
77 | return ""; | ||
78 | |||
79 | var title = activeWindowDisplay.activeWindow.title; | ||
80 | var appName = activeWindowDisplay.windowEntry?.name; | ||
81 | if (appAliases[appName]) | ||
82 | appName = appAliases[appName]; | ||
83 | if (appName && title.endsWith(appName)) { | ||
84 | const oldTitle = title; | ||
85 | title = title.substring(0, title.length - appName.length); | ||
86 | title = title.replace(/\s*(—|-)\s*$/, ""); | ||
87 | if (!title) | ||
88 | title = oldTitle; | ||
89 | } | 162 | } |
90 | return title; | ||
91 | } | 163 | } |
92 | } | 164 | } |
93 | } | 165 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index d52740b2..f8092604 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml | |||
@@ -63,35 +63,37 @@ PanelWindow { | |||
63 | anchors.verticalCenter: parent.verticalCenter | 63 | anchors.verticalCenter: parent.verticalCenter |
64 | spacing: 0 | 64 | spacing: 0 |
65 | 65 | ||
66 | PrivacyWidget { | 66 | KeyboardLayout {} |
67 | id: privacy | ||
68 | } | ||
69 | 67 | ||
70 | Item { | 68 | Item { |
71 | enabled: privacy.active | 69 | visible: privacy.visible |
72 | height: parent.height | 70 | height: parent.height |
73 | width: 8 | 71 | width: 8 - 4 |
74 | } | 72 | } |
75 | 73 | ||
76 | BatteryWidget {} | 74 | PrivacyWidget { |
77 | 75 | id: privacy | |
78 | Item { | ||
79 | height: parent.height | ||
80 | width: 8 | ||
81 | } | 76 | } |
82 | 77 | ||
83 | BrightnessWidget {} | ||
84 | |||
85 | Item { | 78 | Item { |
79 | visible: privacy.visible | ||
86 | height: parent.height | 80 | height: parent.height |
87 | width: 4 | 81 | width: 8 - 4 |
88 | } | 82 | } |
89 | 83 | ||
84 | SystemTray {} | ||
85 | |||
90 | PipewireWidget {} | 86 | PipewireWidget {} |
91 | 87 | ||
92 | SystemTray {} | 88 | BrightnessWidget {} |
93 | 89 | ||
94 | KeyboardLayout {} | 90 | BatteryWidget {} |
91 | |||
92 | WaylandInhibitorWidget { | ||
93 | window: bar | ||
94 | } | ||
95 | |||
96 | LidSwitchInhibitorWidget {} | ||
95 | 97 | ||
96 | Item { | 98 | Item { |
97 | height: parent.height | 99 | height: parent.height |
diff --git a/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml b/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml index 896440f1..fd031627 100644 --- a/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/BatteryWidget.qml | |||
@@ -7,7 +7,7 @@ Item { | |||
7 | id: root | 7 | id: root |
8 | 8 | ||
9 | height: parent.height | 9 | height: parent.height |
10 | width: batteryIcon.width | 10 | width: batteryIcon.width + 8 |
11 | anchors.verticalCenter: parent.verticalCenter | 11 | anchors.verticalCenter: parent.verticalCenter |
12 | 12 | ||
13 | property var batteryDevice: Array.from(UPower.devices.values).find(dev => dev.isLaptopBattery) | 13 | property var batteryDevice: Array.from(UPower.devices.values).find(dev => dev.isLaptopBattery) |
@@ -55,7 +55,76 @@ Item { | |||
55 | return "#555"; | 55 | return "#555"; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | } | ||
59 | } | ||
60 | |||
61 | PopupWindow { | ||
62 | id: tooltip | ||
63 | |||
64 | property bool nextVisible: widgetMouseArea.containsMouse || tooltipMouseArea.containsMouse | ||
65 | |||
66 | anchor { | ||
67 | item: widgetMouseArea | ||
68 | edges: Edges.Bottom | Edges.Left | ||
69 | } | ||
70 | visible: false | ||
71 | |||
72 | onNextVisibleChanged: hangTimer.restart() | ||
73 | |||
74 | Timer { | ||
75 | id: hangTimer | ||
76 | interval: 100 | ||
77 | onTriggered: tooltip.visible = tooltip.nextVisible | ||
78 | } | ||
79 | |||
80 | implicitWidth: widgetTooltipText.contentWidth + 16 | ||
81 | implicitHeight: widgetTooltipText.contentHeight + 16 | ||
82 | color: "black" | ||
58 | 83 | ||
84 | WrapperMouseArea { | ||
85 | id: tooltipMouseArea | ||
86 | |||
87 | hoverEnabled: true | ||
88 | enabled: true | ||
89 | |||
90 | anchors.centerIn: parent | ||
91 | |||
92 | Text { | ||
93 | id: widgetTooltipText | ||
94 | |||
95 | font.pointSize: 10 | ||
96 | font.family: "Fira Sans" | ||
97 | color: "white" | ||
98 | |||
99 | text: { | ||
100 | const stateStr = UPowerDeviceState.toString(root.batteryDevice.state); | ||
101 | var outStr = stateStr; | ||
102 | if (root.batteryDevice.state != UPowerDeviceState.FullyCharged) | ||
103 | outStr += ` ${Math.round(root.batteryDevice.percentage * 100)}%`; | ||
104 | |||
105 | function formatTime(t) { | ||
106 | var res = ""; | ||
107 | for (const unit of [{ "s": "h", "v": 3600 }, { "s": "m", "v": 60 }, { "s": "s", "v": 1 }]) { | ||
108 | if (t < unit.v) | ||
109 | continue; | ||
110 | res += Math.floor(t / unit.v) + unit.s; | ||
111 | t %= unit.v; | ||
112 | } | ||
113 | return res; | ||
114 | } | ||
115 | if (root.batteryDevice.timeToEmpty != 0) { | ||
116 | const tStr = formatTime(Math.floor(root.batteryDevice.timeToEmpty / 60) * 60); | ||
117 | if (tStr) | ||
118 | outStr += " " + tStr; | ||
119 | } else if (root.batteryDevice.timeToFull != 0) { | ||
120 | const tStr = formatTime(Math.ceil(root.batteryDevice.timeToFull / 60) * 60); | ||
121 | if (tStr) | ||
122 | outStr += " " + tStr; | ||
123 | } | ||
124 | |||
125 | return outStr; | ||
126 | } | ||
127 | } | ||
59 | } | 128 | } |
60 | } | 129 | } |
61 | } | 130 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml index 664b28e2..7f9c1ad0 100644 --- a/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/BrightnessWidget.qml | |||
@@ -5,7 +5,7 @@ import qs.Services | |||
5 | 5 | ||
6 | Item { | 6 | Item { |
7 | height: parent.height | 7 | height: parent.height |
8 | width: brightnessIcon.width | 8 | width: brightnessIcon.width + 8 |
9 | anchors.verticalCenter: parent.verticalCenter | 9 | anchors.verticalCenter: parent.verticalCenter |
10 | 10 | ||
11 | WrapperMouseArea { | 11 | WrapperMouseArea { |
@@ -13,6 +13,8 @@ Item { | |||
13 | 13 | ||
14 | anchors.fill: parent | 14 | anchors.fill: parent |
15 | 15 | ||
16 | hoverEnabled: true | ||
17 | |||
16 | property real sensitivity: (1 / 50) / 120 | 18 | property real sensitivity: (1 / 50) / 120 |
17 | onWheel: event => Brightness.currBrightness += event.angleDelta.y * sensitivity | 19 | onWheel: event => Brightness.currBrightness += event.angleDelta.y * sensitivity |
18 | 20 | ||
@@ -30,4 +32,47 @@ Item { | |||
30 | } | 32 | } |
31 | } | 33 | } |
32 | } | 34 | } |
35 | |||
36 | PopupWindow { | ||
37 | id: tooltip | ||
38 | |||
39 | property bool nextVisible: widgetMouseArea.containsMouse || tooltipMouseArea.containsMouse | ||
40 | |||
41 | anchor { | ||
42 | item: widgetMouseArea | ||
43 | edges: Edges.Bottom | Edges.Left | ||
44 | } | ||
45 | visible: false | ||
46 | |||
47 | onNextVisibleChanged: hangTimer.restart() | ||
48 | |||
49 | Timer { | ||
50 | id: hangTimer | ||
51 | interval: 100 | ||
52 | onTriggered: tooltip.visible = tooltip.nextVisible | ||
53 | } | ||
54 | |||
55 | implicitWidth: widgetTooltipText.contentWidth + 16 | ||
56 | implicitHeight: widgetTooltipText.contentHeight + 16 | ||
57 | color: "black" | ||
58 | |||
59 | WrapperMouseArea { | ||
60 | id: tooltipMouseArea | ||
61 | |||
62 | hoverEnabled: true | ||
63 | enabled: true | ||
64 | |||
65 | anchors.centerIn: parent | ||
66 | |||
67 | Text { | ||
68 | id: widgetTooltipText | ||
69 | |||
70 | font.pointSize: 10 | ||
71 | font.family: "Fira Sans" | ||
72 | color: "white" | ||
73 | |||
74 | text: `${Math.round(Brightness.currBrightness * 100)}%` | ||
75 | } | ||
76 | } | ||
77 | } | ||
33 | } | 78 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index 4644d5e7..bb618f6a 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml | |||
@@ -73,7 +73,11 @@ Item { | |||
73 | Timer { | 73 | Timer { |
74 | id: hangTimer | 74 | id: hangTimer |
75 | interval: 100 | 75 | interval: 100 |
76 | onTriggered: tooltip.visible = tooltip.nextVisible | 76 | onTriggered: { |
77 | tooltip.visible = tooltip.nextVisible; | ||
78 | if (!tooltip.visible) | ||
79 | tooltipLoader.active = false; | ||
80 | } | ||
77 | } | 81 | } |
78 | 82 | ||
79 | implicitWidth: clockTooltipContent.width | 83 | implicitWidth: clockTooltipContent.width |
diff --git a/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml b/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml new file mode 100644 index 00000000..2be0692a --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/LidSwitchInhibitorWidget.qml | |||
@@ -0,0 +1,46 @@ | |||
1 | import Quickshell | ||
2 | import QtQuick | ||
3 | import Quickshell.Widgets | ||
4 | import qs.Services | ||
5 | |||
6 | Item { | ||
7 | id: root | ||
8 | |||
9 | width: icon.width + 8 | ||
10 | height: parent.height | ||
11 | anchors.verticalCenter: parent.verticalCenter | ||
12 | |||
13 | WrapperMouseArea { | ||
14 | id: widgetMouseArea | ||
15 | |||
16 | anchors.fill: parent | ||
17 | |||
18 | hoverEnabled: true | ||
19 | |||
20 | onClicked: InhibitorState.lidSwitchInhibited = !InhibitorState.lidSwitchInhibited | ||
21 | |||
22 | Rectangle { | ||
23 | anchors.fill: parent | ||
24 | color: { | ||
25 | if (widgetMouseArea.containsMouse) { | ||
26 | return "#33808080"; | ||
27 | } | ||
28 | return "transparent"; | ||
29 | } | ||
30 | |||
31 | Item { | ||
32 | anchors.fill: parent | ||
33 | |||
34 | MaterialDesignIcon { | ||
35 | id: icon | ||
36 | |||
37 | implicitSize: 14 | ||
38 | anchors.centerIn: parent | ||
39 | |||
40 | icon: InhibitorState.lidSwitchInhibited ? "laptop-off" : "laptop" | ||
41 | color: InhibitorState.lidSwitchInhibited ? "#f28a21" : "#555" | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml index 8e739359..ac2e38f8 100644 --- a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml +++ b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml | |||
@@ -38,6 +38,43 @@ Scope { | |||
38 | function getLocked(): bool { return lock.locked; } | 38 | function getLocked(): bool { return lock.locked; } |
39 | } | 39 | } |
40 | 40 | ||
41 | Connections { | ||
42 | target: Custom.Systemd | ||
43 | function onSleep(before: bool) { | ||
44 | console.log(`received prepare for sleep ${before}`); | ||
45 | if (before) | ||
46 | lock.locked = true; | ||
47 | } | ||
48 | function onLock() { lock.locked = true; } | ||
49 | function onUnlock() { lock.locked = false; } | ||
50 | } | ||
51 | |||
52 | IdleMonitor { | ||
53 | id: idleMonitor | ||
54 | enabled: !lock.secure | ||
55 | timeout: 600 | ||
56 | respectInhibitors: true | ||
57 | |||
58 | onIsIdleChanged: { | ||
59 | if (idleMonitor.isIdle) | ||
60 | lock.locked = true; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | Custom.SystemdInhibitor { | ||
65 | enabled: !lock.secure | ||
66 | |||
67 | what: Custom.SystemdInhibitorParams.Sleep | ||
68 | who: "quickshell" | ||
69 | why: "Lock session" | ||
70 | mode: Custom.SystemdInhibitorParams.Delay | ||
71 | } | ||
72 | |||
73 | Scope { | ||
74 | id: mprisProxy | ||
75 | property list<var> players: Mpris.players.values | ||
76 | } | ||
77 | |||
41 | WlSessionLock { | 78 | WlSessionLock { |
42 | id: lock | 79 | id: lock |
43 | 80 | ||
@@ -47,7 +84,7 @@ Scope { | |||
47 | 84 | ||
48 | if (locked) { | 85 | if (locked) { |
49 | Custom.KeePassXC.lockAllDatabases(); | 86 | Custom.KeePassXC.lockAllDatabases(); |
50 | Array.from(Mpris.players.values).forEach(player => { | 87 | Array.from(mprisProxy.players).forEach(player => { |
51 | if (player.canPause && player.isPlaying) | 88 | if (player.canPause && player.isPlaying) |
52 | player.pause(); | 89 | player.pause(); |
53 | }); | 90 | }); |
@@ -56,6 +93,8 @@ Scope { | |||
56 | } | 93 | } |
57 | } | 94 | } |
58 | 95 | ||
96 | onSecureStateChanged: Custom.Systemd.lockedHint = lock.secure | ||
97 | |||
59 | WlSessionLockSurface { | 98 | WlSessionLockSurface { |
60 | id: lockSurface | 99 | id: lockSurface |
61 | 100 | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml b/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml new file mode 100644 index 00000000..faa77c3f --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml | |||
@@ -0,0 +1,30 @@ | |||
1 | import QtQml | ||
2 | import Quickshell | ||
3 | import Quickshell.Wayland | ||
4 | import qs.Services | ||
5 | import Custom as Custom | ||
6 | |||
7 | Scope { | ||
8 | IdleMonitor { | ||
9 | id: idleMonitor30 | ||
10 | timeout: 30 | ||
11 | |||
12 | onIsIdleChanged: Custom.Systemd.setIdleHint(idleMonitor30.isIdle) | ||
13 | } | ||
14 | IdleMonitor { | ||
15 | id: idleMonitor540 | ||
16 | timeout: 540 | ||
17 | |||
18 | onIsIdleChanged: { | ||
19 | if (idleMonitor540.isIdle) | ||
20 | NiriService.sendCommand({ "Action": "PowerOffMonitors" }); | ||
21 | } | ||
22 | } | ||
23 | Connections { | ||
24 | target: Custom.Systemd | ||
25 | function onSleep(before: bool) { | ||
26 | if (!before) | ||
27 | NiriService.sendCommand({ "Action": "PowerOnMonitors" }); | ||
28 | } | ||
29 | } | ||
30 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml b/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml index 007ce100..3e0b8fd9 100644 --- a/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/PipewireWidget.qml | |||
@@ -114,232 +114,350 @@ Item { | |||
114 | 114 | ||
115 | implicitWidth: tooltipContent.width | 115 | implicitWidth: tooltipContent.width |
116 | implicitHeight: tooltipContent.height | 116 | implicitHeight: tooltipContent.height |
117 | color: "black" | 117 | color: "transparent" |
118 | 118 | ||
119 | WrapperMouseArea { | 119 | Rectangle { |
120 | id: tooltipMouseArea | 120 | width: tooltip.width |
121 | height: tooltipLayout.childrenRect.height + 16 | ||
122 | color: "black" | ||
123 | } | ||
121 | 124 | ||
122 | hoverEnabled: true | 125 | WrapperItem { |
123 | enabled: true | 126 | id: tooltipContent |
124 | 127 | ||
125 | anchors.fill: parent | 128 | bottomMargin: Math.max(0, 200 - tooltipLayout.implicitHeight) |
129 | |||
130 | WrapperMouseArea { | ||
131 | id: tooltipMouseArea | ||
126 | 132 | ||
127 | WrapperItem { | 133 | hoverEnabled: true |
128 | id: tooltipContent | 134 | enabled: true |
129 | 135 | ||
130 | margin: 8 | 136 | WrapperItem { |
131 | bottomMargin: 8 + Math.max(0, 200 - tooltipLayout.implicitHeight) | 137 | margin: 8 |
138 | bottomMargin: 8 | ||
132 | 139 | ||
133 | GridLayout { | 140 | GridLayout { |
134 | id: tooltipLayout | 141 | id: tooltipLayout |
135 | 142 | ||
136 | columns: 4 | 143 | columns: 4 |
137 | 144 | ||
138 | Repeater { | 145 | Repeater { |
139 | model: Array.from(Pipewire.devices.values).filter(dev => dev.type == "Audio/Device") | 146 | model: Array.from(Pipewire.devices.values).filter(dev => dev.type == "Audio/Device") |
140 | 147 | ||
141 | Item { | 148 | Item { |
142 | id: descItem | 149 | id: descItem |
143 | 150 | ||
144 | required property var modelData | 151 | required property var modelData |
145 | required property int index | 152 | required property int index |
146 | 153 | ||
147 | Layout.column: 0 | 154 | Layout.column: 0 |
148 | Layout.row: index | 155 | Layout.row: index |
149 | 156 | ||
150 | implicitWidth: descText.contentWidth | 157 | implicitWidth: descText.contentWidth |
151 | implicitHeight: descText.contentHeight | 158 | implicitHeight: descText.contentHeight |
152 | 159 | ||
153 | Text { | 160 | Text { |
154 | id: descText | 161 | id: descText |
155 | 162 | ||
156 | color: "white" | 163 | color: "white" |
157 | font.pointSize: 10 | 164 | font.pointSize: 10 |
158 | font.family: "Fira Sans" | 165 | font.family: "Fira Sans" |
159 | 166 | ||
160 | text: descItem.modelData.description | 167 | text: descItem.modelData.description |
168 | } | ||
161 | } | 169 | } |
162 | } | 170 | } |
163 | } | ||
164 | 171 | ||
165 | Repeater { | 172 | Repeater { |
166 | id: defaultSinkRepeater | 173 | id: defaultSinkRepeater |
167 | 174 | ||
168 | model: { | 175 | model: { |
169 | Array.from(Pipewire.devices.values) | 176 | Array.from(Pipewire.devices.values) |
170 | .filter(dev => dev.type == "Audio/Device") | 177 | .filter(dev => dev.type == "Audio/Device") |
171 | .map(device => Array.from(Pipewire.nodes.values).find(node => node.type == PwNodeType.AudioSink && node.device?.id == device.id )); | 178 | .map(device => Array.from(Pipewire.nodes.values).find(node => node.type == PwNodeType.AudioSink && node.device?.id == device.id )); |
172 | } | 179 | } |
173 | 180 | ||
174 | Item { | 181 | Item { |
175 | id: defaultSinkItem | 182 | id: defaultSinkItem |
176 | 183 | ||
177 | required property var modelData | 184 | required property var modelData |
178 | required property int index | 185 | required property int index |
179 | 186 | ||
180 | PwObjectTracker { | 187 | visible: Boolean(modelData) |
181 | objects: [defaultSinkItem.modelData] | ||
182 | } | ||
183 | 188 | ||
184 | Layout.column: 1 | 189 | PwObjectTracker { |
185 | Layout.row: index | 190 | objects: [defaultSinkItem.modelData] |
191 | } | ||
186 | 192 | ||
187 | Layout.fillHeight: true | 193 | Layout.column: 1 |
194 | Layout.row: index | ||
188 | 195 | ||
189 | implicitWidth: 16 + 8 | 196 | Layout.fillHeight: true |
190 | 197 | ||
191 | WrapperMouseArea { | 198 | implicitWidth: 16 + 8 |
192 | id: defaultSinkMouseArea | ||
193 | 199 | ||
194 | anchors.fill: parent | 200 | WrapperMouseArea { |
195 | hoverEnabled: true | 201 | id: defaultSinkMouseArea |
196 | cursorShape: Qt.PointingHandCursor | ||
197 | 202 | ||
198 | onClicked: { | 203 | anchors.fill: parent |
199 | Pipewire.preferredDefaultAudioSink = defaultSinkItem.modelData | 204 | hoverEnabled: true |
200 | } | 205 | cursorShape: Qt.PointingHandCursor |
201 | 206 | ||
202 | Rectangle { | 207 | onClicked: { |
203 | id: defaultSinkWidget | 208 | Pipewire.preferredDefaultAudioSink = defaultSinkItem.modelData |
209 | } | ||
204 | 210 | ||
205 | anchors.fill: parent | 211 | onWheel: event => scrollVolume(event); |
206 | color: { | 212 | property real sensitivity: (1 / 40) / 120 |
207 | if (defaultSinkMouseArea.containsMouse) | 213 | function scrollVolume(event) { |
208 | return "#33808080"; | 214 | defaultSinkItem.modelData.audio.volume += event.angleDelta.y * sensitivity; |
209 | return "transparent"; | ||
210 | } | 215 | } |
211 | 216 | ||
212 | MaterialDesignIcon { | 217 | Rectangle { |
213 | width: 16 | 218 | id: defaultSinkWidget |
214 | height: 16 | 219 | |
220 | anchors.fill: parent | ||
221 | color: { | ||
222 | if (defaultSinkMouseArea.containsMouse) | ||
223 | return "#33808080"; | ||
224 | return "transparent"; | ||
225 | } | ||
226 | |||
227 | MaterialDesignIcon { | ||
228 | width: 16 | ||
229 | height: 16 | ||
230 | anchors.centerIn: parent | ||
231 | |||
232 | icon: { | ||
233 | if (defaultSinkItem.modelData?.id == Pipewire.defaultAudioSink?.id) | ||
234 | return "speaker"; | ||
235 | return "speaker-off"; | ||
236 | } | ||
237 | color: icon == "speaker" ? "white" : "#555" | ||
238 | } | ||
239 | } | ||
240 | } | ||
241 | |||
242 | PopupWindow { | ||
243 | id: volumeTooltip | ||
244 | |||
245 | property bool nextVisible: defaultSinkMouseArea.containsMouse || volumeTooltipMouseArea.containsMouse | ||
246 | |||
247 | anchor { | ||
248 | item: defaultSinkMouseArea | ||
249 | edges: Edges.Bottom | Edges.Left | ||
250 | } | ||
251 | visible: false | ||
252 | |||
253 | onNextVisibleChanged: volumeHangTimer.restart() | ||
254 | |||
255 | onVisibleChanged: tooltip.openPopup = volumeTooltip.visible | ||
256 | |||
257 | Timer { | ||
258 | id: volumeHangTimer | ||
259 | interval: 100 | ||
260 | onTriggered: volumeTooltip.visible = volumeTooltip.nextVisible | ||
261 | } | ||
262 | |||
263 | implicitWidth: volumeTooltipText.contentWidth + 16 | ||
264 | implicitHeight: volumeTooltipText.contentHeight + 16 | ||
265 | color: "black" | ||
266 | |||
267 | WrapperMouseArea { | ||
268 | id: volumeTooltipMouseArea | ||
269 | |||
270 | hoverEnabled: true | ||
271 | enabled: true | ||
272 | |||
273 | onWheel: event => defaultSinkMouseArea.scrollVolume(event); | ||
274 | |||
215 | anchors.centerIn: parent | 275 | anchors.centerIn: parent |
216 | 276 | ||
217 | icon: { | 277 | Text { |
218 | if (defaultSinkItem.modelData?.id == Pipewire.defaultAudioSink?.id) | 278 | id: volumeTooltipText |
219 | return "speaker"; | 279 | |
220 | return "speaker-off"; | 280 | font.pointSize: 10 |
281 | font.family: "Fira Sans" | ||
282 | color: "white" | ||
283 | |||
284 | text: `${Math.round(defaultSinkItem.modelData?.audio?.volume * 100)}%` | ||
221 | } | 285 | } |
222 | color: icon == "speaker" ? "white" : "#555" | ||
223 | } | 286 | } |
224 | } | 287 | } |
225 | } | 288 | } |
226 | } | 289 | } |
227 | } | ||
228 | 290 | ||
229 | Repeater { | 291 | Repeater { |
230 | id: defaultSourceRepeater | 292 | id: defaultSourceRepeater |
231 | 293 | ||
232 | model: { | 294 | model: { |
233 | Array.from(Pipewire.devices.values) | 295 | Array.from(Pipewire.devices.values) |
234 | .filter(dev => dev.type == "Audio/Device") | 296 | .filter(dev => dev.type == "Audio/Device") |
235 | .map(device => Array.from(Pipewire.nodes.values).find(node => node.type == PwNodeType.AudioSource && node.device?.id == device.id )); | 297 | .map(device => Array.from(Pipewire.nodes.values).find(node => node.type == PwNodeType.AudioSource && node.device?.id == device.id )); |
236 | } | 298 | } |
237 | 299 | ||
238 | Item { | 300 | Item { |
239 | id: defaultSourceItem | 301 | id: defaultSourceItem |
240 | 302 | ||
241 | required property var modelData | 303 | required property var modelData |
242 | required property int index | 304 | required property int index |
243 | 305 | ||
244 | PwObjectTracker { | 306 | visible: Boolean(modelData) |
245 | objects: [defaultSourceItem.modelData] | 307 | |
246 | } | 308 | PwObjectTracker { |
309 | objects: [defaultSourceItem.modelData] | ||
310 | } | ||
311 | |||
312 | Layout.column: 2 | ||
313 | Layout.row: index | ||
247 | 314 | ||
248 | Layout.column: 2 | 315 | Layout.fillHeight: true |
249 | Layout.row: index | 316 | |
317 | implicitWidth: 16 + 8 | ||
318 | |||
319 | WrapperMouseArea { | ||
320 | id: defaultSourceMouseArea | ||
321 | |||
322 | anchors.fill: parent | ||
323 | hoverEnabled: true | ||
324 | cursorShape: Qt.PointingHandCursor | ||
250 | 325 | ||
251 | Layout.fillHeight: true | 326 | onClicked: { |
327 | Pipewire.preferredDefaultAudioSource = defaultSourceItem.modelData | ||
328 | } | ||
252 | 329 | ||
253 | implicitWidth: 16 + 8 | 330 | onWheel: event => scrollVolume(event); |
331 | property real sensitivity: (1 / 40) / 120 | ||
332 | function scrollVolume(event) { | ||
333 | defaultSourceItem.modelData.audio.volume += event.angleDelta.y * sensitivity; | ||
334 | } | ||
254 | 335 | ||
255 | WrapperMouseArea { | 336 | Rectangle { |
256 | id: defaultSourceMouseArea | 337 | id: defaultSourceWidget |
257 | 338 | ||
258 | anchors.fill: parent | 339 | anchors.fill: parent |
259 | hoverEnabled: true | 340 | color: { |
260 | cursorShape: Qt.PointingHandCursor | 341 | if (defaultSourceMouseArea.containsMouse) |
342 | return "#33808080"; | ||
343 | return "transparent"; | ||
344 | } | ||
261 | 345 | ||
262 | onClicked: { | 346 | MaterialDesignIcon { |
263 | Pipewire.preferredDefaultAudioSource = defaultSourceItem.modelData | 347 | width: 16 |
348 | height: 16 | ||
349 | anchors.centerIn: parent | ||
350 | |||
351 | icon: { | ||
352 | if (defaultSourceItem.modelData?.id == Pipewire.defaultAudioSource?.id) | ||
353 | return "microphone"; | ||
354 | return "microphone-off"; | ||
355 | } | ||
356 | color: icon == "microphone" ? "white" : "#555" | ||
357 | } | ||
358 | } | ||
264 | } | 359 | } |
265 | 360 | ||
266 | Rectangle { | 361 | PopupWindow { |
267 | id: defaultSourceWidget | 362 | id: volumeTooltip |
268 | 363 | ||
269 | anchors.fill: parent | 364 | property bool nextVisible: defaultSourceMouseArea.containsMouse || volumeTooltipMouseArea.containsMouse |
270 | color: { | 365 | |
271 | if (defaultSourceMouseArea.containsMouse) | 366 | anchor { |
272 | return "#33808080"; | 367 | item: defaultSourceMouseArea |
273 | return "transparent"; | 368 | edges: Edges.Bottom | Edges.Left |
274 | } | 369 | } |
370 | visible: false | ||
371 | |||
372 | onNextVisibleChanged: volumeHangTimer.restart() | ||
373 | |||
374 | onVisibleChanged: tooltip.openPopup = volumeTooltip.visible | ||
375 | |||
376 | Timer { | ||
377 | id: volumeHangTimer | ||
378 | interval: 100 | ||
379 | onTriggered: volumeTooltip.visible = volumeTooltip.nextVisible | ||
380 | } | ||
381 | |||
382 | implicitWidth: volumeTooltipText.contentWidth + 16 | ||
383 | implicitHeight: volumeTooltipText.contentHeight + 16 | ||
384 | color: "black" | ||
385 | |||
386 | WrapperMouseArea { | ||
387 | id: volumeTooltipMouseArea | ||
388 | |||
389 | hoverEnabled: true | ||
390 | enabled: true | ||
391 | |||
392 | onWheel: event => defaultSourceMouseArea.scrollVolume(event); | ||
275 | 393 | ||
276 | MaterialDesignIcon { | ||
277 | width: 16 | ||
278 | height: 16 | ||
279 | anchors.centerIn: parent | 394 | anchors.centerIn: parent |
280 | 395 | ||
281 | icon: { | 396 | Text { |
282 | if (defaultSourceItem.modelData?.id == Pipewire.defaultAudioSource?.id) | 397 | id: volumeTooltipText |
283 | return "microphone"; | 398 | |
284 | return "microphone-off"; | 399 | font.pointSize: 10 |
400 | font.family: "Fira Sans" | ||
401 | color: "white" | ||
402 | |||
403 | text: `${Math.round(defaultSourceItem.modelData?.audio?.volume * 100)}%` | ||
285 | } | 404 | } |
286 | color: icon == "microphone" ? "white" : "#555" | ||
287 | } | 405 | } |
288 | } | 406 | } |
289 | } | 407 | } |
290 | } | 408 | } |
291 | } | ||
292 | 409 | ||
293 | Repeater { | 410 | Repeater { |
294 | id: profileRepeater | 411 | id: profileRepeater |
295 | 412 | ||
296 | model: Array.from(Pipewire.devices.values).filter(dev => dev.type == "Audio/Device") | 413 | model: Array.from(Pipewire.devices.values).filter(dev => dev.type == "Audio/Device") |
297 | 414 | ||
298 | Item { | 415 | Item { |
299 | id: profileItem | 416 | id: profileItem |
300 | 417 | ||
301 | required property var modelData | 418 | required property var modelData |
302 | required property int index | 419 | required property int index |
303 | 420 | ||
304 | PwObjectTracker { | 421 | PwObjectTracker { |
305 | objects: [profileItem.modelData] | 422 | objects: [profileItem.modelData] |
306 | } | 423 | } |
307 | 424 | ||
308 | Layout.column: 3 | 425 | Layout.column: 3 |
309 | Layout.row: index | 426 | Layout.row: index |
310 | 427 | ||
311 | Layout.fillWidth: true | 428 | Layout.fillWidth: true |
312 | 429 | ||
313 | implicitWidth: Math.max(profileBox.implicitWidth, 300) | 430 | implicitWidth: Math.max(profileBox.implicitWidth, 300) |
314 | implicitHeight: profileBox.height | 431 | implicitHeight: profileBox.height |
315 | 432 | ||
316 | ComboBox { | 433 | ComboBox { |
317 | id: profileBox | 434 | id: profileBox |
318 | 435 | ||
319 | model: profileItem.modelData.profiles | 436 | model: profileItem.modelData.profiles |
320 | 437 | ||
321 | textRole: "description" | 438 | textRole: "description" |
322 | valueRole: "index" | 439 | valueRole: "index" |
323 | onActivated: profileItem.modelData.setProfile(currentValue) | 440 | onActivated: profileItem.modelData.setProfile(currentValue) |
324 | 441 | ||
325 | anchors.fill: parent | 442 | anchors.fill: parent |
326 | 443 | ||
327 | implicitContentWidthPolicy: ComboBox.WidestText | 444 | implicitContentWidthPolicy: ComboBox.WidestText |
328 | 445 | ||
329 | Connections { | 446 | Connections { |
330 | target: profileItem.modelData | 447 | target: profileItem.modelData |
331 | function onCurrentProfileChanged() { | 448 | function onCurrentProfileChanged() { |
449 | profileBox.currentIndex = Array.from(profileItem.modelData.profiles).findIndex(profile => profile.index == profileItem.modelData.currentProfile); | ||
450 | } | ||
451 | } | ||
452 | Component.onCompleted: { | ||
332 | profileBox.currentIndex = Array.from(profileItem.modelData.profiles).findIndex(profile => profile.index == profileItem.modelData.currentProfile); | 453 | profileBox.currentIndex = Array.from(profileItem.modelData.profiles).findIndex(profile => profile.index == profileItem.modelData.currentProfile); |
333 | } | 454 | } |
334 | } | ||
335 | Component.onCompleted: { | ||
336 | profileBox.currentIndex = Array.from(profileItem.modelData.profiles).findIndex(profile => profile.index == profileItem.modelData.currentProfile); | ||
337 | } | ||
338 | 455 | ||
339 | Connections { | 456 | Connections { |
340 | target: profileBox.popup | 457 | target: profileBox.popup |
341 | function onVisibleChanged() { | 458 | function onVisibleChanged() { |
342 | tooltip.openPopup = profileBox.popup.visible | 459 | tooltip.openPopup = profileBox.popup.visible |
460 | } | ||
343 | } | 461 | } |
344 | } | 462 | } |
345 | } | 463 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/PrivacyWidget.qml b/accounts/gkleen@sif/shell/quickshell/PrivacyWidget.qml index bb02528b..d7ffadfe 100644 --- a/accounts/gkleen@sif/shell/quickshell/PrivacyWidget.qml +++ b/accounts/gkleen@sif/shell/quickshell/PrivacyWidget.qml | |||
@@ -9,7 +9,7 @@ Item { | |||
9 | width: layout.childrenRect.width | 9 | width: layout.childrenRect.width |
10 | anchors.verticalCenter: parent.verticalCenter | 10 | anchors.verticalCenter: parent.verticalCenter |
11 | 11 | ||
12 | readonly property bool active: Boolean(Privacy.activeItems) | 12 | visible: Array.from(Privacy.activeItems).length > 0 |
13 | 13 | ||
14 | RowLayout { | 14 | RowLayout { |
15 | id: layout | 15 | id: layout |
diff --git a/accounts/gkleen@sif/shell/quickshell/Services/Brightness.qml b/accounts/gkleen@sif/shell/quickshell/Services/Brightness.qml index 87c7c05b..8318df50 100644 --- a/accounts/gkleen@sif/shell/quickshell/Services/Brightness.qml +++ b/accounts/gkleen@sif/shell/quickshell/Services/Brightness.qml | |||
@@ -23,14 +23,21 @@ Singleton { | |||
23 | return val; | 23 | return val; |
24 | } | 24 | } |
25 | 25 | ||
26 | Component.onCompleted: root.currBrightness = root.calcCurrBrightness() | ||
27 | Connections { | 26 | Connections { |
28 | target: currFile | 27 | target: currFile |
29 | function onLoaded() { root.currBrightness = root.calcCurrBrightness(); } | 28 | function onLoaded() { |
29 | const b = root.calcCurrBrightness(); | ||
30 | if (typeof b !== 'undefined') | ||
31 | root.currBrightness = b; | ||
32 | } | ||
30 | } | 33 | } |
31 | Connections { | 34 | Connections { |
32 | target: maxFile | 35 | target: maxFile |
33 | function onLoaded() { root.currBrightness = root.calcCurrBrightness(); } | 36 | function onLoaded() { |
37 | const b = root.calcCurrBrightness(); | ||
38 | if (typeof b !== 'undefined') | ||
39 | root.currBrightness = b; | ||
40 | } | ||
34 | } | 41 | } |
35 | 42 | ||
36 | onCurrBrightnessChanged: { | 43 | onCurrBrightnessChanged: { |
diff --git a/accounts/gkleen@sif/shell/quickshell/Services/InhibitorState.qml b/accounts/gkleen@sif/shell/quickshell/Services/InhibitorState.qml new file mode 100644 index 00000000..fe48fd7f --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/Services/InhibitorState.qml | |||
@@ -0,0 +1,22 @@ | |||
1 | pragma Singleton | ||
2 | |||
3 | import Quickshell | ||
4 | import Custom as Custom | ||
5 | |||
6 | Singleton { | ||
7 | id: inhibitorState | ||
8 | |||
9 | property bool waylandIdleInhibited: false | ||
10 | property alias lidSwitchInhibited: lidSwitchInhibitor.enabled | ||
11 | |||
12 | Custom.SystemdInhibitor { | ||
13 | id: lidSwitchInhibitor | ||
14 | |||
15 | enabled: false | ||
16 | |||
17 | what: Custom.SystemdInhibitorParams.HandleLidSwitch | ||
18 | who: "quickshell" | ||
19 | why: "User request" | ||
20 | mode: Custom.SystemdInhibitorParams.BlockWeak | ||
21 | } | ||
22 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml index 6f70be29..351e74ee 100644 --- a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml +++ b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml | |||
@@ -1,4 +1,5 @@ | |||
1 | import QtQuick | 1 | import QtQuick |
2 | import QtQuick.Effects | ||
2 | import Quickshell | 3 | import Quickshell |
3 | import Quickshell.Widgets | 4 | import Quickshell.Widgets |
4 | import Quickshell.Services.SystemTray | 5 | import Quickshell.Services.SystemTray |
@@ -28,6 +29,9 @@ Item { | |||
28 | delegate: Item { | 29 | delegate: Item { |
29 | id: trayItemWrapper | 30 | id: trayItemWrapper |
30 | 31 | ||
32 | required property var modelData | ||
33 | required property int index | ||
34 | |||
31 | property var trayItem: modelData | 35 | property var trayItem: modelData |
32 | property string iconSource: { | 36 | property string iconSource: { |
33 | let icon = trayItem && trayItem.icon | 37 | let icon = trayItem && trayItem.icon |
@@ -91,15 +95,32 @@ Item { | |||
91 | return "transparent"; | 95 | return "transparent"; |
92 | } | 96 | } |
93 | 97 | ||
94 | IconImage { | 98 | Item { |
95 | id: icon | 99 | anchors.fill: parent |
100 | |||
101 | layer.enabled: true | ||
102 | layer.effect: MultiEffect { | ||
103 | colorization: 1 | ||
104 | colorizationColor: "#555" | ||
105 | } | ||
106 | |||
107 | IconImage { | ||
108 | id: icon | ||
96 | 109 | ||
97 | anchors.centerIn: parent | 110 | anchors.centerIn: parent |
98 | implicitSize: 16 | 111 | implicitSize: 16 |
99 | source: trayItemWrapper.iconSource | 112 | source: trayItemWrapper.iconSource |
100 | asynchronous: true | 113 | asynchronous: true |
101 | smooth: true | 114 | smooth: true |
102 | mipmap: true | 115 | mipmap: true |
116 | |||
117 | layer.enabled: true | ||
118 | layer.effect: MultiEffect { | ||
119 | id: effect | ||
120 | |||
121 | brightness: 1 | ||
122 | } | ||
123 | } | ||
103 | } | 124 | } |
104 | } | 125 | } |
105 | } | 126 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml b/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml index 16fb5dea..653f4763 100644 --- a/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml +++ b/accounts/gkleen@sif/shell/quickshell/VolumeOSD.qml | |||
@@ -122,6 +122,8 @@ Scope { | |||
122 | } else if (root.show == "source") { | 122 | } else if (root.show == "source") { |
123 | if (!Pipewire.defaultAudioSource || Pipewire.defaultAudioSource.audio.muted) | 123 | if (!Pipewire.defaultAudioSource || Pipewire.defaultAudioSource.audio.muted) |
124 | return "microphone-off"; | 124 | return "microphone-off"; |
125 | if (Pipewire.defaultAudioSource.audio.volume > 1) | ||
126 | return "microphone-plus"; | ||
125 | return "microphone"; | 127 | return "microphone"; |
126 | } | 128 | } |
127 | return "volume-high"; | 129 | return "volume-high"; |
@@ -148,7 +150,7 @@ Scope { | |||
148 | if (root.show == "sink") | 150 | if (root.show == "sink") |
149 | return parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0); | 151 | return parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0); |
150 | else if (root.show == "source") | 152 | else if (root.show == "source") |
151 | return parent.width * (Pipewire.defaultAudioSource?.audio.volume ?? 0); | 153 | return parent.width * Math.min(1, (Pipewire.defaultAudioSource?.audio.volume ?? 0)); |
152 | return 0; | 154 | return 0; |
153 | } | 155 | } |
154 | } | 156 | } |
diff --git a/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml b/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml new file mode 100644 index 00000000..0633f350 --- /dev/null +++ b/accounts/gkleen@sif/shell/quickshell/WaylandInhibitorWidget.qml | |||
@@ -0,0 +1,55 @@ | |||
1 | import Quickshell | ||
2 | import QtQuick | ||
3 | import Quickshell.Widgets | ||
4 | import Quickshell.Wayland | ||
5 | import qs.Services | ||
6 | |||
7 | Item { | ||
8 | id: root | ||
9 | |||
10 | required property var window | ||
11 | |||
12 | width: icon.width + 8 | ||
13 | height: parent.height | ||
14 | anchors.verticalCenter: parent.verticalCenter | ||
15 | |||
16 | IdleInhibitor { | ||
17 | id: inhibitor | ||
18 | enabled: InhibitorState.waylandIdleInhibited | ||
19 | window: root.window | ||
20 | } | ||
21 | |||
22 | WrapperMouseArea { | ||
23 | id: widgetMouseArea | ||
24 | |||
25 | anchors.fill: parent | ||
26 | |||
27 | hoverEnabled: true | ||
28 | |||
29 | onClicked: InhibitorState.waylandIdleInhibited = !InhibitorState.waylandIdleInhibited | ||
30 | |||
31 | Rectangle { | ||
32 | anchors.fill: parent | ||
33 | color: { | ||
34 | if (widgetMouseArea.containsMouse) { | ||
35 | return "#33808080"; | ||
36 | } | ||
37 | return "transparent"; | ||
38 | } | ||
39 | |||
40 | Item { | ||
41 | anchors.fill: parent | ||
42 | |||
43 | MaterialDesignIcon { | ||
44 | id: icon | ||
45 | |||
46 | implicitSize: 14 | ||
47 | anchors.centerIn: parent | ||
48 | |||
49 | icon: inhibitor.enabled ? "eye" : "eye-off" | ||
50 | color: inhibitor.enabled ? "white" : "#555" | ||
51 | } | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | } | ||
diff --git a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml index c8c017c3..4cbebcc9 100644 --- a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml +++ b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml | |||
@@ -48,7 +48,7 @@ Row { | |||
48 | cursorShape: Qt.PointingHandCursor | 48 | cursorShape: Qt.PointingHandCursor |
49 | enabled: true | 49 | enabled: true |
50 | onClicked: { | 50 | onClicked: { |
51 | NiriService.sendCommand({ "Action": { "FocusWorkspace": { "reference": { "Id": workspaceData.id } } } }, _ => {}) | 51 | NiriService.sendCommand({ "Action": { "FocusWorkspace": { "reference": { "Id": workspaceData.id } } } }, _ => {}); |
52 | } | 52 | } |
53 | 53 | ||
54 | Rectangle { | 54 | Rectangle { |
diff --git a/accounts/gkleen@sif/shell/quickshell/shell.qml b/accounts/gkleen@sif/shell/quickshell/shell.qml index 0fa45f79..693d741f 100644 --- a/accounts/gkleen@sif/shell/quickshell/shell.qml +++ b/accounts/gkleen@sif/shell/quickshell/shell.qml | |||
@@ -41,6 +41,7 @@ ShellRoot { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | Lockscreen {} | 43 | Lockscreen {} |
44 | NiriIdle {} | ||
44 | 45 | ||
45 | VolumeOSD {} | 46 | VolumeOSD {} |
46 | BrightnessOSD {} | 47 | BrightnessOSD {} |