aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-04 20:37:26 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-04 20:37:26 +0100
commit26a9e750dc6f1313413524cd97e60a94e25a56ec (patch)
treece651746328b2a2137d367d2affb82865cf0760f /scripts
parent89512313b263c9b5250b8d51e5e6eb04d0ac43e7 (diff)
Add option to save replay/recording to a folder with the name of the game
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/save-video-in-game-folder.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/save-video-in-game-folder.sh b/scripts/save-video-in-game-folder.sh
new file mode 100755
index 0000000..4dafa03
--- /dev/null
+++ b/scripts/save-video-in-game-folder.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+filepath="$1"
+type="$2"
+
+file_name="$(basename "$filepath")"
+file_dir="$(dirname "$filepath")"
+
+game_name=$(gsr-window-name focused || echo "Game")
+target_dir="$file_dir/$game_name"
+new_filepath="$target_dir/$file_name"
+
+mkdir -p "$target_dir"
+mv "$filepath" "$new_filepath"
+
+[ "$GSR_SHOW_SAVED_NOTIFICATION" != "1" ] && exit 0
+
+case "$type" in
+ "regular")
+ gsr-notify --text "Saved recording to a folder called '$game_name'" --timeout 3.0 --icon record --bg-color "$GSR_NOTIFY_BG_COLOR"
+ ;;
+ "replay")
+ gsr-notify --text "Saved replay to a folder called '$game_name'" --timeout 3.0 --icon replay --bg-color "$GSR_NOTIFY_BG_COLOR"
+ ;;
+esac \ No newline at end of file