Simplify volume service

This commit is contained in:
Sem
2026-07-12 16:15:07 +02:00
parent 80dbe763f8
commit ba1d3ba357
2 changed files with 50 additions and 50 deletions

View File

@@ -1,104 +1,104 @@
return {
image = "/home/sem/Pictures/wallpapers/wall13.jpg",
image = "/home/sem/Pictures/wallpapers/DSC00789.jpg",
background = "0xff0e1514",
background = "0xff121318",
error = "0xffff5449",
error_container = "0xff7b0007",
inverse_on_surface = "0xff5f6665",
inverse_on_surface = "0xff64646a",
inverse_primary = "0xff348d8a",
inverse_primary = "0xff737db7",
inverse_surface = "0xffdde4e2",
inverse_surface = "0xffe3e1e9",
on_background = "0xff5d6463",
on_background = "0xff626268",
on_error = "0xff5c0003",
on_error_container = "0xffff7d70",
on_primary = "0xff004d4b",
on_primary = "0xff374176",
on_primary_container = "0xff5cb2ae",
on_primary_container = "0xff97a0dd",
on_primary_fixed = "0xff7ed2ce",
on_primary_fixed = "0xffb7c0ff",
on_primary_fixed_variant = "0xff58aeaa",
on_primary_fixed_variant = "0xff939dd9",
on_secondary = "0xff142e2d",
on_secondary = "0xff26293b",
on_secondary_container = "0xff8ea9a7",
on_secondary_container = "0xffa0a2b9",
on_secondary_fixed = "0xffaec9c7",
on_secondary_fixed = "0xffc1c2da",
on_secondary_fixed_variant = "0xff8aa5a3",
on_secondary_fixed_variant = "0xff9d9fb5",
on_surface = "0xff9ea4a3",
on_surface = "0xffa3a2a9",
on_surface_variant = "0xff7b8584",
on_surface_variant = "0xff82828c",
on_tertiary = "0xff132b44",
on_tertiary = "0xff3d2037",
on_tertiary_container = "0xff8fa6c4",
on_tertiary_container = "0xffc198b5",
on_tertiary_fixed = "0xffafc6e5",
on_tertiary_fixed = "0xffe3b7d5",
on_tertiary_fixed_variant = "0xff8ba2c0",
on_tertiary_fixed_variant = "0xffbd94b1",
outline = "0xff4c5655",
outline = "0xff53535c",
outline_variant = "0xff323c3b",
outline_variant = "0xff393942",
primary = "0xff479e9a",
primary = "0xff838dc8",
primary_container = "0xff004240",
primary_container = "0xff2c366b",
primary_fixed = "0xff005b59",
primary_fixed = "0xff434d84",
primary_fixed_dim = "0xff004240",
primary_fixed_dim = "0xff2c366b",
scrim = "0xff000000",
secondary = "0xff7b9694",
secondary = "0xff8d8fa6",
secondary_container = "0xff253e3d",
secondary_container = "0xff36394c",
secondary_fixed = "0xff3c5654",
secondary_fixed = "0xff4d5064",
secondary_fixed_dim = "0xff253e3d",
secondary_fixed_dim = "0xff36394c",
shadow = "0xff000000",
source_color = "0xff2a5a58",
source_color = "0xff1c1d25",
surface = "0xff0e1514",
surface = "0xff121318",
surface_bright = "0xff343a3a",
surface_bright = "0xff39393f",
surface_container = "0xff1a2120",
surface_container = "0xff1f1f25",
surface_container_high = "0xff252b2b",
surface_container_high = "0xff29292f",
surface_container_highest = "0xff2f3635",
surface_container_highest = "0xff34343a",
surface_container_low = "0xff161d1c",
surface_container_low = "0xff1b1b21",
surface_container_lowest = "0xff090f0f",
surface_container_lowest = "0xff0d0e13",
surface_dim = "0xff0e1514",
surface_dim = "0xff121318",
surface_tint = "0xff80d5d1",
surface_tint = "0xffbac3ff",
surface_variant = "0xff3f4948",
surface_variant = "0xff46464f",
tertiary = "0xff7c93b0",
tertiary = "0xffac85a1",
tertiary_container = "0xff253c55",
tertiary_container = "0xff4f3048",
tertiary_fixed = "0xff3c536d",
tertiary_fixed = "0xff684660",
tertiary_fixed_dim = "0xff253c55",
tertiary_fixed_dim = "0xff4f3048",
}

View File

@@ -6,10 +6,10 @@ Item {
id: root
signal volumeChanged(int volume)
// process to get the volume level: first active playback stream, falling back to the sink
// process to get the volume level
Process {
id: audioVolumeProcess
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}'"]
command: ["sh", "-c", "wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d. -f 2"]
stdout: StdioCollector {
onStreamFinished: {
if (this.text) {
@@ -22,12 +22,12 @@ Item {
Process {
id: volumeUpProcess
command: ["sh", "-c", "pactl list sink-inputs | awk '/^Sink Input #/{sub(/^Sink Input #/,x);id=$1;got=0} /^[[:space:]]+Volume:/ && id && !got{match($0,/[0-9]+%/);if(substr($0,RSTART,RLENGTH-1)+0<100)print id;got=1}' | xargs -r -I{} pactl set-sink-input-volume {} +1%"]
command: ["sh", "-c", "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+"]
}
Process {
id: volumeDownProcess
command: ["sh", "-c", "pactl list short sink-inputs | awk '{print $1}' | xargs -r -I{} pactl set-sink-input-volume {} -1%"]
command: ["sh", "-c", "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-"]
}
function volumeUp() {
@@ -49,4 +49,4 @@ Item {
}
Component.onCompleted: audioVolumeProcess.running = true
}
}