add script for changing volume and displaying notification

This commit is contained in:
zoe 2022-10-31 18:32:36 +01:00
parent 7f859fa821
commit a764425702
3 changed files with 44 additions and 14 deletions

33
i3/audio.py Normal file
View File

@ -0,0 +1,33 @@
# script that changes the volume and then shows a notfication with it using dunst
import subprocess
import argparse
def get_amixer_volume() -> int:
s: str = str(subprocess.check_output(["amixer", "get", "Master"]))
try:
# turns the front left argument into an int
return int(
# the thing we're looking for is in the fifth line
s.split(r"\n")[5]
.strip()
# and is the 4th word
.split(" ")[4]
.replace("[", "")
.replace("]", "")
.replace("%", "")
)
except:
return -1
def display_volume(volume: int):
subprocess.call(
["dunstify", "volume 蓼", "-h", "int:value:" + str(volume), "-r", "39489384"]
)
parser = argparse.ArgumentParser()
parser.add_argument("volchange")
args = parser.parse_args()
subprocess.check_output(["amixer", "set", "Master", args.volchange])
display_volume(get_amixer_volume())

View File

@ -14,12 +14,21 @@ pkgs:
'';
plugins = with pkgs.vimPlugins; [
# coc
# autocompletion
coc-nvim
# rust
coc-rust-analyzer
coc-lua
# python
coc-pyright
# nix
vim-nix
# lua
coc-lua
# make brackets nicer
nvim-autopairs

View File

@ -25,14 +25,6 @@
# music / sound
cmus
pavucontrol
## production
### daw
lmms
### plugin
surge-XT
zynaddsubfx
fluidsynth
carla
# video
mpv
@ -64,10 +56,6 @@
## python
python311
black
## haskell
stylish-haskell
haskell-language-server
ghc
# help
tldr