This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamicwallpaper
executable file
·81 lines (67 loc) · 1.83 KB
/
dynamicwallpaper
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/dash
# * select menu
# * youtube mpsyt playlist
# * local video playlist
# * local wallpaper
# * kill
MPSYOUTUBE_PATH=$HOME"/.config/mps-youtube/playlists/"
LOCALVIDEO_PATH=$HOME"/Videos/mpsyt/"
WALLPAPER_PATH=$HOME"/Pictures/Wallpaper/"
SESSION="dynwal"
usage() {
echo "Usage: $0 [mpv commands]"
}
COMMANDS=""
OPTION=""
rofimenu() {
echo " youtube mpsyt playlist
local video playlist
local wallpaper playlist
control terminal
kill current playing" | rofi -dmenu -p "playlist" || exit 1
}
getmpsyoutubeplaylist() {
ls $MPSYOUTUBE_PATH | rofi -dmenu -p "playlist" || exit 1
}
getlocalvideoplaylist() {
ls $LOCALVIDEO_PATH | rofi -dmenu -p "playlist" || exit 1
}
getwallpaperplaylist() {
sxiv -o $WALLPAPER_PATH
}
getimageduration() {
echo "10
60
120" | rofi -dmenu -p "image display duration (seconds)"
}
killprocess() {
pkill xwinwrap
}
spawncontroller() {
notify-send "Terminal Spawned" "$SESSION mpv controller, ctrl-\\ to detach"
st -e abduco -a $SESSION
}
getcommand() {
case $(rofimenu) in
*youtube*) echo "$MPSYOUTUBE_PATH/"$(getmpsyoutubeplaylist);;
*video*) echo "$LOCALVIDEO_PATH"/$(getlocalvideoplaylist);;
*wallpaper*) echo $(getwallpaperplaylist); OPTION="--image-display-duration=$(getimageduration)"; echo $OPTION ;;
*kill*) killprocess ;;
*terminal*) spawncontroller;;
esac
}
plaympv() {
if [ -z "$COMMANDS" ]; then
exit 1
fi
echo xwinwrap -fs -ni -nf -b -ov -- mpv -wid WID $COMMANDS
# abduco -e '^q' -c $SESSION xwinwrap -fs -ni -nf -b -ov -- mpv -wid WID --script==~/.config/mpv/lua/notify.lua $COMMANDS
abduco -e '^q' -c $SESSION xwinwrap -fs -ni -nf -b -ov -- mpv -wid WID $COMMANDS
}
# main
case "$1" in
-h|-help|h|help) usage;exit 0 ;;
"") COMMANDS=$(getcommand) && plaympv;;
*) COMMANDS="$@"; plaympv ;;
esac
# vim: filetype=sh