added modules to waybar

This commit is contained in:
2025-08-09 15:32:12 +02:00
parent 134a0ff79a
commit 283a649486
15 changed files with 223 additions and 264 deletions

70
hypr/scripts/replay-ctrl.sh Executable file
View File

@@ -0,0 +1,70 @@
#!/bin/sh
PROGRAM_NAME="gpu-screen-recorder"
PID_FILE="/tmp/gpu-screen-recorder.pid"
start() {
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ps -p "$PID" > /dev/null; then
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME is already active."
exit 0
fi
fi
video_path="$HOME/Videos/replay/"
mkdir -p "$video_path"
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME is starting ..."
gpu-screen-recorder -w screen -f 60 -a default_output -c mkv -bm qp -cr full -tune quality -k av1_10bit -q high -r 120 -replay-storage ram -ab 320 -o "$video_path" &
echo $! > "$PID_FILE"
}
stop() {
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ps -p "$PID" > /dev/null; then
kill "$PID"
rm "$PID_FILE"
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME has been stopped."
else
rm "$PID_FILE" # Stale PID file
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME is not running."
fi
else
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME is not running."
fi
}
save() {
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ps -p "$PID" > /dev/null; then
pkill -SIGUSR1 -f gpu-screen-recorder && sleep 0.5 && notify-send -u low "$PROGRAM_NAME" "Saving replay..."
else
# The process is not running, but the PID file exists.
# This can happen if the process crashed.
# We'll remove the stale PID file.
rm "$PID_FILE"
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME is not running."
fi
else
notify-send -u low "$PROGRAM_NAME" "$PROGRAM_NAME is not running."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
save)
save
;;
*)
echo "Usage: $0 {start|stop|save}"
exit 1
esac
exit 0

View File

@@ -0,0 +1,7 @@
#!/bin/sh
sleep 1
killall -e xdg-desktop-portal-hyprland
killall xdg-desktop-portal
/usr/lib/xdg-desktop-portal-hyprland &
sleep 2
/usr/lib/xdg-desktop-portal &