add script for changing volume and displaying notification
This commit is contained in:
parent
7f859fa821
commit
a764425702
|
@ -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())
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue