Skip to content

Instantly share code, notes, and snippets.

@naranyala
Created May 21, 2024 10:25
Show Gist options
  • Save naranyala/7d378a0b7fdf4a252fbc154d160b65eb to your computer and use it in GitHub Desktop.
Save naranyala/7d378a0b7fdf4a252fbc154d160b65eb to your computer and use it in GitHub Desktop.
easy select volume in range
#!/bin/bash
# Define the options for volume levels
options="0%\n5%\n10%\n15%\n20%\n25%\n30%\n35%\n40%\n45%\n50%\n55%\n60%\n65%\n70%\n75%\n80%\n85%\n90%\n95%\n100%"
# Use rofi to select a volume level
chosen=$(echo -e "$options" | rofi -dmenu -p "Set Volume Level")
# If the user made a selection, set the volume
if [ -n "$chosen" ]; then
amixer -D pulse sset Master "$chosen"
else
echo "No volume level selected."
fi
# [module/rofi-volume-range]
# type = custom/script
# exec = amixer get Master | grep -oP '\d+%' | head -1
# interval = 5
# label = "[vol:%output%]"
# click-left = ~/.config/polybar/scripts/rofi-volume-range.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment