finish volume icon

This commit is contained in:
Sem
2026-05-31 21:43:28 +02:00
parent 8dd32e2632
commit f59959c871
4 changed files with 51 additions and 49 deletions

View File

@@ -10,9 +10,6 @@ Text {
id: root
required property TopBar parentWindow
property string lowVolumeIconGlyph: "\uf027"
property string highVolumeIconGlyph: "\uf028"
property string iconGlyph: lowVolumeIconGlyph
property string volumeText: ""
property list<string> volumeDudes: ["⸝(°-°)⸜","ヽ(°∘°)ノ","ヽ(°o°)ノ","ヽ(°O°)ノ","ヽ(°ᗜ°)ノ","ヽ(°〇°)ノ","ᕙ( ᗒᗣᗕ )ᕗ"]
property int volumeDudeIndex: 0
@@ -20,12 +17,17 @@ Text {
property AudioService audioService: AudioService {
onVolumeChanged: function (volume) {
var dudeIndex = Math.min(Math.floor(volume / root.dudeStep), root.volumeDudes.length - 1);
root.text = volume + "% " + root.volumeDudes[dudeIndex];
root.changeVolume(volume);
}
}
text: iconGlyph
function changeVolume(volume) {
var dudeIndex = Math.min(Math.floor(volume / root.dudeStep), root.volumeDudes.length - 1);
root.text = volume + "% " + root.volumeDudes[dudeIndex];
volumeText = volume + "% " + root.volumeDudes[dudeIndex];
}
text: volumeText
color: Colors.md3.on_primary_fixed
font {
@@ -39,7 +41,7 @@ Text {
hoverEnabled: true
onClicked: {
// TODO open volume control panel
pavuControlProcess.running = true;
}
onWheel: function (wheel) {
@@ -50,4 +52,13 @@ Text {
}
}
}
Process {
id: pavuControlProcess
command: ["pavucontrol"]
}
Component.onCompleted: {
root.audioService.volumeUp(); // trigger initial volume fetch
}
}

View File

@@ -50,15 +50,6 @@ Text {
onClicked: {
bluemanManagerProcess.running = true;
popupWindow.visible = true;
}
}
PopupWindow {
id: popupWindow
visible: false
implicitWidth: 200
implicitHeight: 100
anchor.window: parentWindow
}
}