Configure hyprlock, work on waybar
This commit is contained in:
43
packages/pulseaudio-popup/default.nix
Normal file
43
packages/pulseaudio-popup/default.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
# Snowfall Lib provides a customized `lib` instance with access to your flake's library
|
||||
# as well as the libraries available from your flake's inputs.
|
||||
lib,
|
||||
# You also have access to your flake's inputs.
|
||||
inputs,
|
||||
|
||||
# All other arguments come from NixPkgs. You can use `pkgs` to pull packages or helpers
|
||||
# programmatically or you may add the named attributes as arguments here.
|
||||
pkgs,
|
||||
stdenv,
|
||||
...
|
||||
}:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "pulseaudio-popup";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
pavucontrol
|
||||
jgmenu
|
||||
];
|
||||
|
||||
text = ''
|
||||
HDMI_SINK="alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink"
|
||||
LAPTOP_SINK="alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink"
|
||||
|
||||
HDMI_ICON=$(pactl info | grep -q $HDMI_SINK && echo "checkbox")
|
||||
LAPTOP_ICON=$(pactl info | grep -q $LAPTOP_SINK && echo "checkbox")
|
||||
|
||||
HDMI_VOLUME=$(pactl get-sink-volume $HDMI_SINK | head -n 1 | awk '{print $5}')
|
||||
LAPTOP_VOLUME=$(pactl get-sink-volume $LAPTOP_SINK | head -n 1 | awk '{print $5}')
|
||||
|
||||
read -r -d "" CONF <<EOF
|
||||
Open Pavucontrol,pavucontrol,pavucontrol
|
||||
|
||||
^sep()
|
||||
HDMI - $HDMI_VOLUME,pactl set-default-sink $HDMI_SINK,$HDMI_ICON
|
||||
Laptop - $LAPTOP_VOLUME,pactl set-default-sink $LAPTOP_SINK,$LAPTOP_ICON
|
||||
EOF
|
||||
|
||||
echo "$CONF" | jgmenu --simple
|
||||
'';
|
||||
}
|
Reference in New Issue
Block a user