fix(waybar): dont depend on pulseaudio
This commit is contained in:
parent
136ac9fba0
commit
ee1df8983a
4 changed files with 55 additions and 69 deletions
|
|
@ -65,12 +65,12 @@ exec-once = hypr windowrules
|
|||
exec-once = hypr spawnfocus --ws 1 $TERMINAL -e mux
|
||||
exec-once = hypr spawnfocus --ws 2 $BROWSER
|
||||
|
||||
bindul = , XF86AudioRaiseVolume, exec, hypr volume up
|
||||
bindul = , XF86AudioLowerVolume, exec, hypr volume down
|
||||
bindul = , XF86AudioMute, exec, hypr volume toggle
|
||||
bindul = , XF86AudioRaiseVolume, exec, ctl volume up
|
||||
bindul = , XF86AudioLowerVolume, exec, ctl volume down
|
||||
bindul = , XF86AudioMute, exec, ctl volume toggle
|
||||
|
||||
bindul = , XF86MonBrightnessUp, exec, hypr brightness up
|
||||
bindul = , XF86MonBrightnessDown, exec, hypr brightness down
|
||||
bindul = , XF86MonBrightnessUp, exec, ctl brightness up
|
||||
bindul = , XF86MonBrightnessDown, exec, ctl brightness down
|
||||
|
||||
bind = ALT, SPACE, exec, fuzzel --list-executables-in-path
|
||||
bind = ALT, TAB, workspace, previous
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ in
|
|||
slurp
|
||||
libnotify
|
||||
brightnessctl
|
||||
pamixer
|
||||
socat
|
||||
glib.bin
|
||||
gsettings-desktop-schemas
|
||||
|
|
@ -135,9 +134,9 @@ in
|
|||
};
|
||||
signal = 1;
|
||||
tooltip = false;
|
||||
on-click = "pamixer -t";
|
||||
on-scroll-up = "pamixer -i 5";
|
||||
on-scroll-down = "pamixer -d 5";
|
||||
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
||||
on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ --limit 1.0";
|
||||
on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
|
||||
};
|
||||
|
||||
network = {
|
||||
|
|
@ -269,8 +268,8 @@ in
|
|||
foreground = c.red;
|
||||
frame_color = c.red;
|
||||
};
|
||||
hypr = {
|
||||
appname = "hypr";
|
||||
ctl = {
|
||||
appname = "ctl";
|
||||
icon_position = "off";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
46
scripts/ctl
46
scripts/ctl
|
|
@ -100,6 +100,50 @@ audio)
|
|||
;;
|
||||
esac
|
||||
;;
|
||||
brightness)
|
||||
require brightnessctl notify-send
|
||||
BRIGHT_STEP=5
|
||||
case "$2" in
|
||||
up) brightnessctl set "$BRIGHT_STEP"%+ ;;
|
||||
down) brightnessctl set "$BRIGHT_STEP"%- ;;
|
||||
*) echo "Usage: ctl brightness {up|down}" >&2; exit 1 ;;
|
||||
esac
|
||||
pct=$(awk -v cur="$(brightnessctl get)" -v max="$(brightnessctl max)" 'BEGIN { printf "%d", cur * 100 / max }')
|
||||
filled=$((pct / 5))
|
||||
empty=$((20 - filled))
|
||||
bar=""
|
||||
i=0; while [ "$i" -lt "$filled" ]; do bar="${bar}━"; i=$((i + 1)); done
|
||||
i=0; while [ "$i" -lt "$empty" ]; do bar="${bar}─"; i=$((i + 1)); done
|
||||
notify-send -a ctl -t 2500 -r 5555 "☼ $bar"
|
||||
;;
|
||||
volume)
|
||||
require wpctl notify-send
|
||||
SINK="@DEFAULT_AUDIO_SINK@"
|
||||
VOL_STEP=5
|
||||
get_vol() { wpctl get-volume "$SINK" | awk '{printf "%d", $2 * 100}'; }
|
||||
case "$2" in
|
||||
up) wpctl set-volume "$SINK" "${VOL_STEP}%+" --limit 1.0 ;;
|
||||
down) wpctl set-volume "$SINK" "${VOL_STEP}%-" ;;
|
||||
toggle) wpctl set-mute "$SINK" toggle ;;
|
||||
*) echo "Usage: ctl volume {up|down|toggle}" >&2; exit 1 ;;
|
||||
esac
|
||||
vol=$(get_vol)
|
||||
filled=$((vol / 5))
|
||||
empty=$((20 - filled))
|
||||
bar=""
|
||||
i=0; while [ "$i" -lt "$filled" ]; do bar="${bar}━"; i=$((i + 1)); done
|
||||
i=0; while [ "$i" -lt "$empty" ]; do bar="${bar}─"; i=$((i + 1)); done
|
||||
if wpctl get-volume "$SINK" | grep -q MUTED; then
|
||||
icon=""
|
||||
elif [ "$vol" -le 33 ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -le 66 ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
notify-send -a ctl -t 2500 -r 5556 "$icon $bar"
|
||||
;;
|
||||
power)
|
||||
require fuzzel
|
||||
lock=" Lock"
|
||||
|
|
@ -117,7 +161,7 @@ power)
|
|||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ctl {screenshot|ocr|keyboard|audio|power}" >&2
|
||||
echo "Usage: ctl {screenshot|ocr|keyboard|audio|brightness|volume|power}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
57
scripts/hypr
57
scripts/hypr
|
|
@ -14,8 +14,6 @@ usage() {
|
|||
Usage: hypr <subcommand> [app] [args...]
|
||||
|
||||
Commands:
|
||||
volume {up,down,toggle} Adjust volume accordingly and notify
|
||||
brightness {up,down} Adjust brightness accordingly and notify
|
||||
spawnfocus <app> [args...] Focus existing window or spawn app with args
|
||||
pull [app] Pull window to current workspace (picker if no app)
|
||||
windowrules Apply dynamic window rules
|
||||
|
|
@ -46,61 +44,6 @@ exit)
|
|||
hyprctl dispatch exit
|
||||
exit 0
|
||||
;;
|
||||
brightness)
|
||||
require brightnessctl notify-send
|
||||
BRIGHT_STEP=5
|
||||
case "$1" in
|
||||
up) brightnessctl set "$BRIGHT_STEP"%+ ;;
|
||||
down) brightnessctl set "$BRIGHT_STEP"%- ;;
|
||||
*) echo "Invalid subcommand: $1" >&2; exit 1 ;;
|
||||
esac
|
||||
pct=$(awk -v cur="$(brightnessctl get)" -v max="$(brightnessctl max)" 'BEGIN { printf "%d", cur * 100 / max }')
|
||||
filled=$((pct / 5))
|
||||
empty=$((20 - filled))
|
||||
bar=""
|
||||
i=0; while [ "$i" -lt "$filled" ]; do bar="${bar}━"; i=$((i + 1)); done
|
||||
i=0; while [ "$i" -lt "$empty" ]; do bar="${bar}─"; i=$((i + 1)); done
|
||||
notify-send -a hypr -t 2500 -r 5555 "☼ $bar"
|
||||
;;
|
||||
volume)
|
||||
require wpctl notify-send
|
||||
SINK="@DEFAULT_AUDIO_SINK@"
|
||||
VOL_STEP=5
|
||||
get_vol() { wpctl get-volume "$SINK" | awk '{printf "%d", $2 * 100}'; }
|
||||
|
||||
case "$1" in
|
||||
up)
|
||||
wpctl set-volume "$SINK" "${VOL_STEP}%+" --limit 1.0
|
||||
;;
|
||||
down)
|
||||
wpctl set-volume "$SINK" "${VOL_STEP}%-"
|
||||
;;
|
||||
toggle)
|
||||
wpctl set-mute "$SINK" toggle
|
||||
;;
|
||||
*)
|
||||
echo "Invalid subcommand: $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
vol=$(get_vol)
|
||||
filled=$((vol / 5))
|
||||
empty=$((20 - filled))
|
||||
bar=""
|
||||
i=0; while [ "$i" -lt "$filled" ]; do bar="${bar}━"; i=$((i + 1)); done
|
||||
i=0; while [ "$i" -lt "$empty" ]; do bar="${bar}─"; i=$((i + 1)); done
|
||||
if wpctl get-volume "$SINK" | grep -q MUTED; then
|
||||
icon=""
|
||||
elif [ "$vol" -le 33 ]; then
|
||||
icon=""
|
||||
elif [ "$vol" -le 66 ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
notify-send -a hypr -t 2500 -r 5556 "$icon $bar"
|
||||
;;
|
||||
pull)
|
||||
require hyprctl jq fuzzel
|
||||
APP="$1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue