no gnome
This commit is contained in:
parent
3edd56b8c1
commit
ebe5cdf9e4
|
@ -147,6 +147,7 @@
|
||||||
", XF86AudioRaiseVolume, exec, sh ~/nix/home/hyprland/volume.sh -i"
|
", XF86AudioRaiseVolume, exec, sh ~/nix/home/hyprland/volume.sh -i"
|
||||||
", XF86AudioLowerVolume, exec, sh ~/nix/home/hyprland/volume.sh -d"
|
", XF86AudioLowerVolume, exec, sh ~/nix/home/hyprland/volume.sh -d"
|
||||||
", XF86AudioMute, exec, sh ~/nix/home/hyprland/volume.sh -m"
|
", XF86AudioMute, exec, sh ~/nix/home/hyprland/volume.sh -m"
|
||||||
|
", XF86AudioMicMute, exec, sh ~/nix/home/hyprland/volume.sh -t"
|
||||||
];
|
];
|
||||||
|
|
||||||
general = {
|
general = {
|
||||||
|
|
|
@ -1,43 +1,68 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Function to display usage
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [-d|-i|-m]"
|
echo "Usage: $0 [-d|-i|-m|-t]"
|
||||||
echo " -d Decrease volume by 10%"
|
echo " -d Decrease volume by 10%"
|
||||||
echo " -i Increase volume by 10%"
|
echo " -i Increase volume by 10%"
|
||||||
echo " -m Toggle mute/unmute"
|
echo " -m Toggle mute/unmute for the sink"
|
||||||
|
echo " -t Toggle mute/unmute for the microphone"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the default sink
|
get_default_sink() {
|
||||||
sink=$(pactl info | grep "Default Sink" | awk '{print $3}')
|
pactl info | grep "Default Sink" | awk '{print $3}'
|
||||||
|
}
|
||||||
|
|
||||||
# Check if a sink was found
|
get_default_source() {
|
||||||
if [ -z "$sink" ]; then
|
pactl info | grep "Default Source" | awk '{print $3}'
|
||||||
echo "No default sink found."
|
}
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Process command-line options
|
while getopts "dimt" opt; do
|
||||||
while getopts "dim" opt; do
|
|
||||||
case $opt in
|
case $opt in
|
||||||
d)
|
d)
|
||||||
# Decrease volume by 10%
|
sink=$(get_default_sink)
|
||||||
pactl set-sink-volume "$sink" -10%
|
if [ -n "$sink" ]; then
|
||||||
|
pactl set-sink-volume "$sink" -10%
|
||||||
|
else
|
||||||
|
echo "No default sink found."
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
i)
|
i)
|
||||||
# Increase volume by 10%
|
sink=$(get_default_sink)
|
||||||
pactl set-sink-volume "$sink" +10%
|
if [ -n "$sink" ]; then
|
||||||
|
pactl set-sink-volume "$sink" +10%
|
||||||
|
else
|
||||||
|
echo "No default sink found."
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
m)
|
m)
|
||||||
# Toggle mute/unmute
|
sink=$(get_default_sink)
|
||||||
current_mute=$(pactl get-sink-mute "$sink" | awk '{print $2}')
|
if [ -n "$sink" ]; then
|
||||||
if [ "$current_mute" = "yes" ]; then
|
current_mute=$(pactl get-sink-mute "$sink" | awk '{print $2}')
|
||||||
pactl set-sink-mute "$sink" 0
|
if [ "$current_mute" = "yes" ]; then
|
||||||
echo "Unmuted"
|
pactl set-sink-mute "$sink" 0
|
||||||
|
echo "Unmuted sink"
|
||||||
|
else
|
||||||
|
pactl set-sink-mute "$sink" 1
|
||||||
|
echo "Muted sink"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
pactl set-sink-mute "$sink" 1
|
echo "No default sink found."
|
||||||
echo "Muted"
|
fi
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
source=$(get_default_source)
|
||||||
|
if [ -n "$source" ]; then
|
||||||
|
current_mute=$(pactl get-source-mute "$source" | awk '{print $2}')
|
||||||
|
if [ "$current_mute" = "yes" ]; then
|
||||||
|
pactl set-source-mute "$source" 0
|
||||||
|
echo "Unmuted microphone"
|
||||||
|
else
|
||||||
|
pactl set-source-mute "$source" 1
|
||||||
|
echo "Muted microphone"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No default source found."
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -46,6 +71,8 @@ while getopts "dim" opt; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Display current volume level
|
sink=$(get_default_sink)
|
||||||
echo "Current volume:"
|
if [ -n "$sink" ]; then
|
||||||
pactl list sinks | grep -A 15 "$sink" | grep "Volume:"
|
echo "Current volume for sink:"
|
||||||
|
pactl list sinks | grep -A 15 "$sink" | grep "Volume:"
|
||||||
|
fi
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
{
|
{
|
||||||
networking.hostName = "laptop";
|
networking.hostName = "laptop";
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
Loading…
Reference in a new issue