-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrofi-wfr.sh
40 lines (34 loc) · 1.1 KB
/
rofi-wfr.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Use wf-recorder (Wayland screen recorder) in a Rofi prompt
while true; do
file_name=$(echo -n "" | rofi -dmenu -p "Enter video name:")
if [[ -z "$file_name" ]]; then
notify-send "No file name entered. Aborting."
exit 1
fi
if [[ -f $HOME/videos/$file_name.mp4 ]]; then
choice=$(echo -e "rename\nreplace\nkeep & ignore" | rofi -dmenu -p "File with the same name exists!")
case "$choice" in
"rename")
continue
;;
"replace")
rm "$HOME/videos/$file_name.mp4"
notify-send "Recording replaced the old one."
break
;;
"keep & ignore")
notify-send "Screenshot discarded. Existing picture kept."
exit 0
;;
*)
notify-send "Invalid choice or no action taken. Aborting."
exit 1
;;
esac
else
break
fi
done
wf-recorder -c libx264rgb -f $HOME/videos/$file_name.mp4
notify-send "Video saved as $file_name.mp4"