Compare commits
2 commits
f8369a340b
...
76d680a95b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76d680a95b | ||
|
|
56cd758dd5 |
4 changed files with 92 additions and 6 deletions
|
|
@ -11,6 +11,7 @@ Singleton {
|
||||||
property Bar bar: Bar {}
|
property Bar bar: Bar {}
|
||||||
property Mpris mpris: Mpris {}
|
property Mpris mpris: Mpris {}
|
||||||
property Clock clock: Clock {}
|
property Clock clock: Clock {}
|
||||||
|
property Pipewire pipewire: Pipewire {}
|
||||||
property Caffeine caffeine: Caffeine {}
|
property Caffeine caffeine: Caffeine {}
|
||||||
property Workspace workspace: Workspace {}
|
property Workspace workspace: Workspace {}
|
||||||
property Tray tray: Tray {}
|
property Tray tray: Tray {}
|
||||||
|
|
@ -46,10 +47,19 @@ Singleton {
|
||||||
property int verticalPadding: 6
|
property int verticalPadding: 6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component Pipewire: QtObject {
|
||||||
|
id: clock
|
||||||
|
|
||||||
|
property int fontSize: 14
|
||||||
|
property int height: 30
|
||||||
|
property int horizontalPadding: 8
|
||||||
|
property int verticalPadding: 6
|
||||||
|
}
|
||||||
|
|
||||||
component Caffeine: QtObject {
|
component Caffeine: QtObject {
|
||||||
id: clock
|
id: clock
|
||||||
|
|
||||||
property int iconSize: 14
|
property int fontSize: 16
|
||||||
property int height: 30
|
property int height: 30
|
||||||
property int horizontalPadding: 8
|
property int horizontalPadding: 8
|
||||||
property int verticalPadding: 6
|
property int verticalPadding: 6
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,10 @@ Scope {
|
||||||
|
|
||||||
spacing: Dimensions.bar.spacing
|
spacing: Dimensions.bar.spacing
|
||||||
|
|
||||||
|
Pipewire {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
Caffeine {
|
Caffeine {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,17 @@ Clickable {
|
||||||
id: text
|
id: text
|
||||||
|
|
||||||
font.family: Theme.lucide.font.family
|
font.family: Theme.lucide.font.family
|
||||||
font.pixelSize: Dimensions.workspace.iconSize
|
font.pixelSize: Dimensions.caffeine.fontSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: Icons.coffee
|
text: Icons.coffee
|
||||||
|
|
||||||
color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent
|
color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
topPadding: Dimensions.mpris.verticalPadding
|
topPadding: Dimensions.caffeine.verticalPadding
|
||||||
bottomPadding: Dimensions.mpris.verticalPadding
|
bottomPadding: Dimensions.caffeine.verticalPadding
|
||||||
leftPadding: Dimensions.mpris.horizontalPadding
|
leftPadding: Dimensions.caffeine.horizontalPadding
|
||||||
rightPadding: Dimensions.mpris.horizontalPadding
|
rightPadding: Dimensions.caffeine.horizontalPadding
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
|
|
|
||||||
72
modules/bar/components/Pipewire.qml
Normal file
72
modules/bar/components/Pipewire.qml
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell.Services.Pipewire
|
||||||
|
import "../../../config/"
|
||||||
|
import "../../../styled/"
|
||||||
|
|
||||||
|
Clickable {
|
||||||
|
id: clickable
|
||||||
|
|
||||||
|
property var sink: Pipewire.defaultAudioSink
|
||||||
|
|
||||||
|
implicitWidth: text.width
|
||||||
|
implicitHeight: Dimensions.pipewire.height
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
id: bound
|
||||||
|
objects: [clickable.sink]
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: mouse => {
|
||||||
|
if (mouse.button == Qt.LeftButton) {
|
||||||
|
sink.audio.muted = !sink.audio.muted;
|
||||||
|
} else if (mouse.button == Qt.RightButton) {
|
||||||
|
// show menu
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onWheel: event => {
|
||||||
|
if (event.angleDelta.y > 0) {
|
||||||
|
sink.audio.volume = Math.min(sink.audio.volume + 0.02, 1.0);
|
||||||
|
} else if (event.angleDelta.y < 0) {
|
||||||
|
sink.audio.volume -= 0.02;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "muted"
|
||||||
|
when: clickable.sink.audio.muted
|
||||||
|
PropertyChanges {
|
||||||
|
text {
|
||||||
|
icon: " "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "off"
|
||||||
|
when: clickable.sink.audio.volume <= 0
|
||||||
|
PropertyChanges {
|
||||||
|
text {
|
||||||
|
icon: " "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
id: text
|
||||||
|
|
||||||
|
property string icon: " "
|
||||||
|
|
||||||
|
text: `${icon} ${(Pipewire.defaultAudioSink.audio.volume * 100).toFixed()}%`
|
||||||
|
font.pixelSize: Dimensions.pipewire.fontSize
|
||||||
|
|
||||||
|
color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
topPadding: Dimensions.pipewire.verticalPadding
|
||||||
|
bottomPadding: Dimensions.pipewire.verticalPadding
|
||||||
|
leftPadding: Dimensions.pipewire.horizontalPadding
|
||||||
|
rightPadding: Dimensions.pipewire.horizontalPadding
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue