Added np thing and airpod bluetooth fixy

This commit is contained in:
Jurn Wubben 2025-12-04 00:33:06 +01:00
parent f314910d8b
commit 7d61371ec0
4 changed files with 59 additions and 0 deletions

View file

@ -12,6 +12,8 @@ bind = CTRL, Print, exec, $screenshot
bind = $mod CTRL, p, exec, $screenshot
bind = , Print, exec, $rec
bind = $mod, p, exec, $rec
bind = $mod, m, exec, $np 1
bind = $mod SHIFT, m, exec, $np
bind = $mod, Q, killactive
bind = $mod, F, fullscreen

View file

@ -16,5 +16,6 @@ $menu = /usr/bin/rofi -show drun -theme ~/.config/rofi/themes/launcher-theme.ras
# Screenshotting
$screenshot = ~/.config/hypr/scripts/recording.sh
$rec = mkdir -p ~/Pictures/Screenshots && grim -t ppm -o "$(hyprctl activeworkspace -j | jq -r '.monitor')" - | satty --early-exit --copy-command "wl-copy" -f - -o ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png
$np = ~/.config/hypr/scripts/np.sh
# Other applications
$browser = /usr/bin/firefox

View file

@ -0,0 +1,51 @@
#!/usr/bin/env bash
NOTI_ST=string:np:error
NOTI_TIME=5000
for i in "playerctl" "wl-copy" "hyprctl" "notify-send"; do
if builtin type -P "$i" &> /dev/null; then continue; fi
notify-send -h $NOTI_ST -t $NOTI_TIME "Missing dependencies, can't record.";
echo "Missing dependencies."
exit 1
done
players="$(playerctl -l 2>&1)"
if echo "$players" | grep 'No players found'; then
notify-send -h $NOTI_ST -t $NOTI_TIME "No active player"
exit 1
fi
player="$(echo "$players" | grep spot | head -n 1)"
if [ -z "$player" ]; then
player="$(echo "$players" | head -n 1)"
fi
data=$(playerctl metadata -p "$player" --format $'{{title}}\x1F{{xesam:url}}\x1F{{artist}}\x1F{{album}}')
IFS=$'\x1F' read -r title url artist album <<< "$data"
output=$'## Now Playing\n>'
if [ -z "$title" ]; then
notify-send -h $NOTI_ST -t $NOTI_TIME "This song doesn't have a title. Not much to do here.";
exit 1;
fi
if [ -z "$url" ]; then
output="$output $title"
else
output="$output [$title](<$url>)"$'\n'
fi
if [ -n "$artist" ]; then
output="$output\- **$artist**"
fi
if [ -n "$artist" ] && [ -n "$album" ]; then
output="$output on *$album*"
fi
echo "$output" | wl-copy
hyprctl dispatch sendshortcut "CTRL,V,"
if [[ "$@" == "1" ]]; then
hyprctl dispatch sendshortcut ",Return,"
fi