mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-02-13 10:50:20 +01:00
Add modules for personal (CLI) machines
(NixOS + Home Manager)
This commit is contained in:
parent
4fece8d5d7
commit
ceff26b4e1
8 changed files with 69 additions and 46 deletions
35
personal-cli/scripts/spot_volume.sh
Executable file
35
personal-cli/scripts/spot_volume.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
id=$(pw-dump | jq '
|
||||
map(
|
||||
select(
|
||||
.info.props."application.name" == "spotify" and
|
||||
.type == "PipeWire:Interface:Node")
|
||||
)[-1].id'
|
||||
)
|
||||
current_volume=$(pw-dump | jq "
|
||||
.[] |
|
||||
select(.id == $id) |
|
||||
.info.params.Props[0].volume"
|
||||
)
|
||||
|
||||
new_volume=current_volume
|
||||
|
||||
case $1 in
|
||||
*+)
|
||||
if [ "$(bc <<< "$current_volume < 1")" -eq 1 ]; then
|
||||
new_volume=$(bc <<< "$current_volume + ${1%+}")
|
||||
fi
|
||||
;;
|
||||
*-)
|
||||
if [ "$(bc <<< "$current_volume > 0")" -eq 1 ]; then
|
||||
new_volume=$(bc <<< "$current_volume - ${1%-}")
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
new_volume=$1
|
||||
;;
|
||||
esac
|
||||
|
||||
pw-cli set-param "$id" Props "{volume: $new_volume}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue