mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
in freaking 2 lines
This commit is contained in:
parent
c8b4a2b1ed
commit
5bc535583f
2 changed files with 3 additions and 27 deletions
|
|
@ -27,18 +27,9 @@ function trimTrackTitle(title) {
|
|||
}
|
||||
|
||||
function adjustVolume(direction) {
|
||||
const step = 0.03;
|
||||
execAsync(['playerctl', 'volume'])
|
||||
.then((output) => {
|
||||
let currentVolume = parseFloat(output.trim());
|
||||
let newVolume = direction === 'up' ? currentVolume + step : currentVolume - step;
|
||||
|
||||
if (newVolume > 1.0) newVolume = 1.0;
|
||||
if (newVolume < 0.0) newVolume = 0.0;
|
||||
|
||||
execAsync(['playerctl', 'volume', newVolume.toFixed(2)]).catch(print);
|
||||
})
|
||||
.catch(print);
|
||||
const step = 0.1; // We use a larger step because this is player instance volume, not global
|
||||
const mpris = Mpris.getPlayer('');
|
||||
mpris.volume += (direction === 'up') ? step : -step
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
change=$1
|
||||
|
||||
current_volume=$(playerctl volume)
|
||||
|
||||
new_volume=$(echo "$current_volume + $change" | bc)
|
||||
|
||||
if (( $(echo "$new_volume > 1.0" | bc -l) )); then
|
||||
new_volume=1.0
|
||||
elif (( $(echo "$new_volume < 0.0" | bc -l) )); then
|
||||
new_volume=0.0
|
||||
fi
|
||||
|
||||
playerctl volume "$new_volume"
|
||||
Loading…
Reference in a new issue