pi-ext bugabingas pi extensions
owned by bugabinga
README Source History Refs Compare Notes Search skill: add quickshell advanced examples
4e9487b91554cbc3b379a8cd2dbd12acfab87df5
Review <review@example.invalid > · 16 Jun 2026
unsigned
Browse files Compare with HEAD
Changed files (7) skills/quickshell/examples/04-pipewire-volume/Bar.qml Added new file mode 100644 5 + import QtQuick.Layouts
7 + import Quickshell.Services.Pipewire
8 + import Quickshell.Widgets
11 + anchors {
top :
true ;
left :
true ;
right :
true }
18 + objects : [
Pipewire .defaultAudioSink ]
22 + anchors.fill: parent
23 + anchors.leftMargin:
12 24 + anchors.rightMargin:
12 30 + source :
Quickshell .iconPath(
31 + (
Pipewire .defaultAudioSink
? .audio.muted
?? false )
32 + ? "audio-volume-muted-symbolic" 33 + : "audio-volume-high-symbolic" 43 + anchors.fill: parent
44 + cursorShape :
Qt .PointingHandCursor
45 + onClicked :
Pipewire .defaultAudioSink.audio.muted
= ! Pipewire .defaultAudioSink.audio.muted
49 + Item {
Layout .fillWidth:
true ;
width :
1 }
54 + Layout .preferredWidth:
240 57 + value :
Pipewire .defaultAudioSink
? .audio.volume
?? 0 58 + onMoved :
Pipewire .defaultAudioSink.audio.volume
= value
62 + text :
` ${
Math .
floor ((
Pipewire .defaultAudioSink
? .audio.volume
?? 0 )
* 100 )}
%` 65 + Layout .preferredWidth:
40 skills/quickshell/examples/04-pipewire-volume/README.md Added new file mode 100644 1 + #
04 — pipewire volume 3 + A bar that displays and controls the default audio sink's volume via Pipewire. The same shape generalizes to per-app volume, source/sink switching, mic mute, etc.
5 + **Run:** `qs -p examples/04-pipewire-volume/shell.qml`
9 + - `PwObjectTracker { objects: [ ... ] }` to keep a service object alive.
10 + - Reading reactive state with `?.` and `??` for safe defaults.
11 + - Writing to the same property is fine — but never also `bind` a Slider's `value:` to it (binding loop). Use `value: ...; onMoved: ... = value`.
12 + - `Quickshell.iconPath` for the volume/mute icon.
13 + - `MouseArea` over a `Text` for a clickable label.
15 + **What to break and learn from:**
17 + - Remove the `PwObjectTracker` → volume may show as 0% even when audio plays (object got collected).
18 + - Replace `onMoved` with `onValueChanged` → fires while the user drags (very chatty, but works).
19 + - Add `Connections { target: ...audio; function onVolumeChanged() { flash() } }` to react to OS-level volume changes (e.g. from a media key) — the OSD-on-volume-change pattern.
20 + - Read `Pipewire.defaultAudioSource` instead → mic volume instead of speaker.
24 + - `references/services.md` for the full Pipewire API.
25 + - The `volume-osd/` example in the official examples repo for a LazyLoader + OSD variant.
skills/quickshell/examples/04-pipewire-volume/shell.qml Added new file mode 100644 6 + import QtQuick.Layouts
8 + import Quickshell.Services.Pipewire
12 + model :
Quickshell .screens
13 + delegate : Component {
15 + required property
var modelData
skills/quickshell/examples/05-osd-volume/README.md Added new file mode 100644 3 + An on-screen-display volume bar that appears for one second when the default sink's volume changes (or it gets muted). The canonical OSD pattern.
5 + **Run:** `qs -p examples/05-osd-volume/shell.qml`
10 + wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.5
11 + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
14 + You should see a pill-shaped OSD pop up at the bottom of the focused monitor for one second.
18 + - `Scope` as the root — used here to host shared state (`shouldShowOsd`) and a `Timer`.
19 + - `Connections { target: ...; function onXxx() { ... } }` to react to service signals.
20 + - `Timer { interval: 1000; onTriggered: ... }` to debounce/show-duration.
21 + - `LazyLoader { active: ... }` to create/destroy a window on demand (memory-aware).
22 + - `FloatingWindow` + `WlrLayershell.layer: WlrLayer.Overlay` to appear over fullscreen apps.
23 + - `mask: Region {}` for click-through.
24 + - `exclusiveZone: 0` so the OSD doesn't push windows around.
25 + - `screen.height / 5` for proportional placement.
27 + **What to break and learn from:**
29 + - Replace `LazyLoader` with `visible: false` → the OSD is always in memory; cheaper to build, but worse for big trees.
30 + - Remove `mask: Region {}` → the OSD swallows clicks until it disappears; you'll see the cursor change when you hover it.
31 + - Add a second `Connections` block on `Pipewire.defaultAudioSource?.audio` for mic-level OSD.
32 + - Swap `WlrLayer.Overlay` for `WlrLayer.Top` (default) → OSD is hidden behind fullscreen apps.
34 + **Why it didn't appear (debug checklist):**
36 + - Pipewire not running → no `defaultAudioSink`. The OSD never triggers. Check `wpctl status`.
37 + - No active audio stream → some pipewire nodes don't update volume if there's no stream.
38 + - LazyLoader only loads `active: true`; check `shouldShowOsd` is being set (`console.log` in the Connections handler).
skills/quickshell/examples/05-osd-volume/shell.qml Added new file mode 100644 8 + import QtQuick.Layouts
10 + import Quickshell.Services.Pipewire
11 + import Quickshell.Widgets
17 + PwObjectTracker {
objects : [
Pipewire .defaultAudioSink ] }
21 + target :
Pipewire .defaultAudioSink
? .audio
22 + function onVolumeChanged () {
23 + root.shouldShowOsd
= true 26 + function onMutedChanged () {
27 + root.shouldShowOsd
= true 32 + property bool
shouldShowOsd :
false 37 + onTriggered : root.shouldShowOsd
= false 42 + active : root.shouldShowOsd
46 + anchors.bottom:
true 47 + margins.bottom: screen.height
/ 5 52 + color :
"transparent" 58 + WlrLayershell .layer:
WlrLayer .Overlay
59 + WlrLayershell .keyboardFocus:
WlrKeyboardFocus .None
60 + WlrLayershell .namespace:
"qs-example-osd" 63 + anchors.fill: parent
77 + source :
Quickshell .iconPath(
78 + (
Pipewire .defaultAudioSink
? .audio.muted
?? false )
79 + ? "audio-volume-muted-symbolic" 80 + : "audio-volume-high-symbolic" 85 + Layout .fillWidth:
true 94 + bottom : parent.bottom
98 + implicitWidth : parent.width
* Math .
min (
1 ,
Pipewire .defaultAudioSink
? .audio.volume
?? 0 )
105 + text :
` ${
Math .
floor ((
Pipewire .defaultAudioSink
? .audio.volume
?? 0 )
* 100 )}
%` 108 + Layout .preferredWidth:
50 skills/quickshell/examples/06-ipc-control/README.md Added new file mode 100644 3 + Expose quickshell functions to be called from outside (e.g. by a keybind daemon, a script, or another quickshell instance). The standard pattern for "open launcher", "toggle bar", "set bar text".
5 + **Run (in a terminal):**
8 + qs -p examples/06-ipc-control/shell.qml
11 + **From another terminal:**
15 + qs ipc call mybar show
16 + qs ipc call mybar hide
17 + qs ipc call mybar toggle
20 + qs ipc call mybar setText
"hello from outside" 23 + The bar is hidden by default; call `show` to make it appear.
27 + - `IpcHandler { target: "mybar" }` registers an IPC namespace.
28 + - Functions declared inside `IpcHandler` are callable from outside via `qs ipc call <target> <fn> [args]`.
29 + - `Scope` as root to share state (`label`) between the handler and the visible widget.
30 + - `visible: false` initial state, controlled externally.
32 + **What to break and learn from:**
34 + - Forget the `target:` → IPC won't register. You'll get a "no such target" error from the outside `qs ipc` call.
35 + - Try `qs ipc call mybar setText` (no arg) → runtime error in the shell, the bar's text will go blank.
36 + - Add a `signal` to `IpcHandler` and listen from another quickshell instance via `Connections` — the v0.3.0 IPC signal listener feature.
40 + - `hyprctl dispatch exec qs ipc call mybar toggle` in a Hyprland keybind.
41 + - `qs ipc call mybar focusWorkspace 3` from a script that wants to move the user to workspace 3.
42 + - `qs ipc call mybar notify "title" "body"` from a notification script that wants to use your quickshell notification daemon.
44 + **Note on `-c` vs `-p`:** IPC target names are global per shell ID, not per config name. If you run with `-p`, the shell ID is derived from the file path. Using a stable `-c <name>` makes the IPC target discoverable.
skills/quickshell/examples/06-ipc-control/shell.qml Added new file mode 100644 16 + property string
label :
"idle" 21 + function show ():
void { bar.visible
= true }
22 + function hide ():
void { bar.visible
= false }
23 + function toggle ():
void { bar.visible
= ! bar.visible }
24 + function setText (s: string):
void { root.label
= s }
30 + anchors {
top :
true ;
left :
true ;
right :
true }
35 + anchors.centerIn: parent