-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlup
More file actions
executable file
·50 lines (45 loc) · 1.78 KB
/
lup
File metadata and controls
executable file
·50 lines (45 loc) · 1.78 KB
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
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# LUP - LARBS Universal Player
# Takes link/destination and opens in application
pgrep -x dmenu && exit
source_type=$(printf "Link\\nDestination\\nHistory" | dmenu -i -p "LUP - Source Type: ")
[[ "$source_type" = "" ]] && exit 1
echo 'Source Type: ' $source_type
if [[ "$1" = "" ]]; then
if [[ "$source_type" = "Link" ]]; then
source=$(xclip -o)
elif [[ "$source_type" = "Destination" ]]; then
[[ "$source_type" = "" ]] && exit 1
dest_type=$(printf "File\\nFolder" | dmenu -i -p "Player type: ")
if [[ "$dest_type" = "File" ]]; then
dirlist=$(sudo find ~/Videos/ ~/Pictures/ ~/Sync/ ~/Downloads/ ~/Memes/ -type f -maxdepth 8 2>/dev/null)
source=$(echo "$dirlist" | dmenu -i -p "File Destination: " -l 10)
elif [[ "$dest_type" = "Folder" ]]; then
dirlist=$(sudo find ~/Videos/ ~/Pictures/ ~/Sync/ ~/Downloads/ ~/Memes/ -type d -maxdepth 8 2>/dev/null)
source=''$(echo "$dirlist" | dmenu -i -p "Folder Destination: " -l 10)''
fi
elif [[ "$source_type" = "History" ]]; then
history_list=$(tail -n 10 ~/.lup_history | tac | dmenu -i -p "Recent Files: " -l 5)
source=$(echo "$history_list" | cut -f1)
player=$(echo "$history_list" | cut -f2)
fi
else
source="$1"
fi
[[ $source = "" ]] && exit 1
echo 'Source: ' $source
# player (mpv (video), mpv (audio), sxiv, zathura)
if [[ $player = "" ]]; then
player=$(echo -e "mpv (video)\nmpv (audio)\nsxiv\nzathura\nfirefox" | dmenu -i -p "Player: ")
fi
echo "Player: $player"
case "$player" in
"mpv (video)") notify-send "Playing: '$source'" && mpv "$source" ;;
"mpv (audio)") notify-send "Playing: '$source'" && st -e mpv --no-video "$source" ;;
"sxiv") sxiv -rtf "$source" ;;
"zathura") zathura "$source" ;;
"firefox") firefox "$source" ;;
esac
# History
echo -e "$source"'\t'"$player"'\t''#'`date` >> ~/.lup_history
exit 1