make volume icon clickable
This commit is contained in:
parent
b97ac0276c
commit
86474f0663
@ -17,7 +17,9 @@ PanelWindow {
|
|||||||
id: leftLayout
|
id: leftLayout
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Workspaces {}
|
Workspaces {
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell.Services.Pipewire
|
import Quickshell.Services.Pipewire
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@ -8,7 +9,23 @@ Item {
|
|||||||
implicitHeight: volRow.implicitHeight
|
implicitHeight: volRow.implicitHeight
|
||||||
// grab the default speaker (Sink)
|
// grab the default speaker (Sink)
|
||||||
property var sink: Pipewire.defaultAudioSink
|
property var sink: Pipewire.defaultAudioSink
|
||||||
|
Process {
|
||||||
|
id: pavu
|
||||||
|
command: ["pavucontrol"] // The command and args list
|
||||||
|
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
cursorShape: Qt.OpenHandCursor
|
||||||
|
onClicked: mouse => {
|
||||||
|
if (mouse.button === Qt.LeftButton) {
|
||||||
|
// Left Click: Summon the Mixer!
|
||||||
|
console.log("Summoning Pavucontrol... Nya!");
|
||||||
|
pavu.startDetached();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anchors.fill: parent
|
||||||
|
// Scroll to change volume (The fancy stuff!)
|
||||||
|
}
|
||||||
// Logic to pick the correct icon name
|
// Logic to pick the correct icon name
|
||||||
function getVolumeIcon() {
|
function getVolumeIcon() {
|
||||||
// Safety check: if Pipewire is dead or sink is missing
|
// Safety check: if Pipewire is dead or sink is missing
|
||||||
@ -57,24 +74,6 @@ Item {
|
|||||||
font.family: Appearance.font
|
font.family: Appearance.font
|
||||||
font.pixelSize: Appearance.fontSize
|
font.pixelSize: Appearance.fontSize
|
||||||
text: Math.round(Pipewire.defaultAudioSink.audio.volume * 100) + "%"
|
text: Math.round(Pipewire.defaultAudioSink.audio.volume * 100) + "%"
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
if (root.sink) {
|
|
||||||
root.sink.audio.muted = !root.sink.audio.muted;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Scroll to change volume (The fancy stuff!)
|
|
||||||
onWheel: wheel => {
|
|
||||||
if (root.sink) {
|
|
||||||
if (wheel.angleDelta.y > 0) {
|
|
||||||
root.sink.audio.volume += 0.05; // Up 5%
|
|
||||||
} else {
|
|
||||||
root.sink.audio.volume -= 0.05; // Down 5%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click to toggle mute! (Bonus feature)
|
// Click to toggle mute! (Bonus feature)
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
implicitWidth: workspaceRepeater.count * 30
|
implicitWidth: workspaceRow.implicitWidth
|
||||||
height: 30
|
height: 30
|
||||||
Row {
|
Row {
|
||||||
|
id: workspaceRow
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 10 // Slightly increase spacing between workspace buttons
|
spacing: 10 // Slightly increase spacing between workspace buttons
|
||||||
|
|
||||||
@ -17,8 +16,9 @@ Item {
|
|||||||
model: Hyprland.workspaces
|
model: Hyprland.workspaces
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 20
|
id: workspaceCircle
|
||||||
height: 20
|
width: 16
|
||||||
|
height: 16
|
||||||
radius: 20
|
radius: 20
|
||||||
//color: modelData.active ? myPallete.accent : myPallete.window
|
//color: modelData.active ? myPallete.accent : myPallete.window
|
||||||
color: modelData.active ? Colors.foreground : "transparent"
|
color: modelData.active ? Colors.foreground : "transparent"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user