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
+57 -36
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,48 +22,68 @@ Rectangle {
spacing: 4 spacing: 4
anchors.centerIn: parent anchors.centerIn: parent
CircleUtilButton { Loader {
Layout.alignment: Qt.AlignVCenter active: ConfigOptions.bar.utilButtons.showScreenSnip
onClicked: Hyprland.dispatch("exec hyprshot --freeze --clipboard-only --mode region --silent") visible: ConfigOptions.bar.utilButtons.showScreenSnip
sourceComponent: CircleUtilButton {
MaterialSymbol { Layout.alignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter onClicked: Hyprland.dispatch("exec hyprshot --freeze --clipboard-only --mode region --silent")
fill: 1 MaterialSymbol {
text: "screenshot_region" horizontalAlignment: Qt.AlignHCenter
iconSize: Appearance.font.pixelSize.large fill: 1
color: Appearance.colors.colOnLayer2 text: "screenshot_region"
iconSize: Appearance.font.pixelSize.large
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 Layout.alignment: Qt.AlignVCenter
// color: Appearance.colors.colOnLayer2 onClicked: Hyprland.dispatch("global quickshell:oskToggle")
// } MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
// } fill: 0
text: "keyboard"
CircleUtilButton { iconSize: Appearance.font.pixelSize.large
Layout.alignment: Qt.AlignVCenter color: Appearance.colors.colOnLayer2
onClicked: Hyprland.dispatch("global quickshell:oskToggle") }
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 0
text: "keyboard"
iconSize: Appearance.font.pixelSize.large
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