QS Rewrite: bar: add microphone control to util buttons (#1365)

This commit is contained in:
end-4
2025-06-12 15:33:58 +02:00
committed by GitHub
2 changed files with 63 additions and 36 deletions
+41 -20
View File
@@ -5,6 +5,7 @@ import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Hyprland import Quickshell.Hyprland
import Quickshell.Services.Pipewire
Rectangle { Rectangle {
id: root id: root
@@ -21,10 +22,12 @@ Rectangle {
spacing: 4 spacing: 4
anchors.centerIn: parent anchors.centerIn: parent
CircleUtilButton { Loader {
active: ConfigOptions.bar.utilButtons.showScreenSnip
visible: ConfigOptions.bar.utilButtons.showScreenSnip
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec hyprshot --freeze --clipboard-only --mode region --silent") onClicked: Hyprland.dispatch("exec hyprshot --freeze --clipboard-only --mode region --silent")
MaterialSymbol { MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
fill: 1 fill: 1
@@ -32,27 +35,31 @@ Rectangle {
iconSize: Appearance.font.pixelSize.large iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2 color: Appearance.colors.colOnLayer2
} }
}
} }
// CircleUtilButton { Loader {
// Layout.alignment: Qt.AlignVCenter active: ConfigOptions.bar.utilButtons.showColorPicker
// onClicked: Hyprland.dispatch("exec hyprpicker -a") visible: ConfigOptions.bar.utilButtons.showColorPicker
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec hyprpicker -a")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 1
text: "colorize"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
// MaterialSymbol { Loader {
// horizontalAlignment: Qt.AlignHCenter active: ConfigOptions.bar.utilButtons.showKeyboardToggle
// fill: 1 visible: ConfigOptions.bar.utilButtons.showKeyboardToggle
// text: "colorize" sourceComponent: CircleUtilButton {
// iconSize: Appearance.font.pixelSize.large
// color: Appearance.colors.colOnLayer2
// }
// }
CircleUtilButton {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("global quickshell:oskToggle") onClicked: Hyprland.dispatch("global quickshell:oskToggle")
MaterialSymbol { MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
fill: 0 fill: 0
@@ -60,9 +67,23 @@ Rectangle {
iconSize: Appearance.font.pixelSize.large iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2 color: Appearance.colors.colOnLayer2
} }
}
} }
Loader {
active: ConfigOptions.bar.utilButtons.showMicToggle
visible: ConfigOptions.bar.utilButtons.showMicToggle
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: Hyprland.dispatch("exec wpctl set-mute @DEFAULT_SOURCE@ toggle")
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 0
text: Pipewire.defaultAudioSource?.audio?.muted ? "mic_off" : "mic"
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
} }
} }
@@ -45,6 +45,12 @@ Singleton {
property bool alwaysShowSwap: true property bool alwaysShowSwap: true
property bool alwaysShowCpu: false property bool alwaysShowCpu: false
} }
property QtObject utilButtons: QtObject {
property bool showMicToggle: true
property bool showKeyboardToggle: true
property bool showScreenSnip: true
property bool showColorPicker: true
}
property QtObject workspaces: QtObject { property QtObject workspaces: QtObject {
property int shown: 10 property int shown: 10
property bool alwaysShowNumbers: false property bool alwaysShowNumbers: false