aboutsummaryrefslogtreecommitdiffstats
path: root/.config/cmus/cc2.sh
diff options
context:
space:
mode:
authorCristian Cezar Moisés <[email protected]>2024-08-26 01:54:41 +0000
committerCristian Cezar Moisés <[email protected]>2024-08-26 01:54:41 +0000
commitbf23f3a1e3928949b6c033de724c7dd88df85a44 (patch)
tree1918e6f68ee0ad879a224c12bfafd73d8b5f3207 /.config/cmus/cc2.sh
parent45115528bad877f82cb46082a529c28626c2e14b (diff)
Upload files to ".config/cmus"
Diffstat (limited to '.config/cmus/cc2.sh')
-rw-r--r--.config/cmus/cc2.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/.config/cmus/cc2.sh b/.config/cmus/cc2.sh
new file mode 100644
index 0000000..cfb0ff6
--- /dev/null
+++ b/.config/cmus/cc2.sh
@@ -0,0 +1,26 @@
+FOLDER=$( cmus-remote -Q | grep "file" | sed "s/file //" | rev | cut -d"/" -f2- | rev )
+
+FLIST=$( find "$FOLDER" -type f )
+
+if echo "$FLIST" | grep -i ".jpeg\|.png\|.jpg" &>/dev/null; then
+ ART=$( echo "$FLIST" | grep -i "cover.jpg\|cover.png\|front.jpg\|front.png\|folder.jpg\|folder.png" | head -n1 )
+
+ if [[ -z "$ART" ]]; then
+ ART=$( echo "$FLIST" | grep -i ".png\|.jpg\|.jpeg" | head -n1 )
+ fi
+
+ PROC=$( ps -eF | grep "feh" | grep -v "cmus\|grep" | cut -d"/" -f2- )
+
+ if [[ "/$PROC" == "$ART" ]]; then
+ exit
+ fi
+
+ killall -q feh
+
+ # '200x200' is the window size for the artwork. '+1160+546' is the offset.
+ # For example, if you want a 250 by 250 window on the bottom right hand corner of a 1920 by 1080 screen: "250x250+1670+830"
+ setsid feh -g 200x200-200+546 -x --zoom fill --bg-max --auto-zoom --auto-rotate --bg-color black "$ART" &
+else
+ killall -q feh
+ exit
+fi