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

@@ -1,5 +1,5 @@
return {
image = "/home/sem/Pictures/wallpapers/DSC00789.jpg",
image = "/home/sem/Pictures/wallpapers/DSC00792.jpg",
background = "0xff121318",
@@ -9,7 +9,7 @@ return {
inverse_on_surface = "0xff64646a",
inverse_primary = "0xff737db7",
inverse_primary = "0xff717eb7",
inverse_surface = "0xffe3e1e9",
@@ -19,67 +19,67 @@ return {
on_error_container = "0xffff7d70",
on_primary = "0xff374176",
on_primary = "0xff354176",
on_primary_container = "0xff97a0dd",
on_primary_container = "0xff94a1dd",
on_primary_fixed = "0xffb7c0ff",
on_primary_fixed = "0xffb4c1ff",
on_primary_fixed_variant = "0xff939dd9",
on_primary_fixed_variant = "0xff919dd9",
on_secondary = "0xff26293b",
on_secondary = "0xff25293b",
on_secondary_container = "0xffa0a2b9",
on_secondary_container = "0xffa0a3b9",
on_secondary_fixed = "0xffc1c2da",
on_secondary_fixed = "0xffc0c3da",
on_secondary_fixed_variant = "0xff9d9fb5",
on_secondary_fixed_variant = "0xff9c9fb5",
on_surface = "0xffa3a2a9",
on_surface_variant = "0xff82828c",
on_tertiary = "0xff3d2037",
on_tertiary = "0xff3c2038",
on_tertiary_container = "0xffc198b5",
on_tertiary_container = "0xffc098b6",
on_tertiary_fixed = "0xffe3b7d5",
on_tertiary_fixed = "0xffe1b8d7",
on_tertiary_fixed_variant = "0xffbd94b1",
on_tertiary_fixed_variant = "0xffbb94b2",
outline = "0xff53535c",
outline_variant = "0xff393942",
outline_variant = "0xff393a42",
primary = "0xff838dc8",
primary = "0xff818ec8",
primary_container = "0xff2c366b",
primary_container = "0xff2a366b",
primary_fixed = "0xff434d84",
primary_fixed = "0xff414e84",
primary_fixed_dim = "0xff2c366b",
primary_fixed_dim = "0xff2a366b",
scrim = "0xff000000",
secondary = "0xff8d8fa6",
secondary = "0xff8c8fa6",
secondary_container = "0xff36394c",
secondary_container = "0xff35394c",
secondary_fixed = "0xff4d5064",
secondary_fixed = "0xff4c5064",
secondary_fixed_dim = "0xff36394c",
secondary_fixed_dim = "0xff35394c",
shadow = "0xff000000",
source_color = "0xff1c1d25",
source_color = "0xff13141a",
surface = "0xff121318",
surface_bright = "0xff39393f",
surface_bright = "0xff38393f",
surface_container = "0xff1f1f25",
surface_container_high = "0xff29292f",
surface_container_high = "0xff292a2f",
surface_container_highest = "0xff34343a",
@@ -89,16 +89,16 @@ return {
surface_dim = "0xff121318",
surface_tint = "0xffbac3ff",
surface_tint = "0xffb8c4ff",
surface_variant = "0xff46464f",
surface_variant = "0xff45464f",
tertiary = "0xffac85a1",
tertiary = "0xffab85a2",
tertiary_container = "0xff4f3048",
tertiary_container = "0xff4e3049",
tertiary_fixed = "0xff684660",
tertiary_fixed = "0xff674761",
tertiary_fixed_dim = "0xff4f3048",
tertiary_fixed_dim = "0xff4e3049",
}

View File

@@ -9,7 +9,7 @@ Item {
// process to get the volume level: first active playback stream, falling back to the sink
Process {
id: audioVolumeProcess
command: ["sh", "-c", "pactl list sink-inputs | grep -m1 'Volume:' | grep -oP '\\d+(?=%)' | head -1 || wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf \"%d\", $2 * 100}'"]
command: ["sh", "-c", "vol=$(pactl list sink-inputs | grep -m1 'Volume:' | grep -oP '\\d+(?=%)' | head -1); [ -n \"$vol\" ] && echo \"$vol\" || wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf \"%d\", $2 * 100}'"]
stdout: StdioCollector {
onStreamFinished: {
if (this.text) {

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
}
}