From 2c523ef1eb51ab9e0e9b1ba6bc30c117396bb331 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 8 Dec 2019 14:46:45 +0300 Subject: Work auto spliff --- .config/dunst/dunstrc | 4 ++++ .config/i3/config##c.desktop,h.Lowe | 3 +++ bin/watch_incoming.sh | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100755 bin/watch_incoming.sh diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index e1d2052..523d3ba 100755 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -57,3 +57,7 @@ timeout = 0 [Spotify] appname = Spotify format = "Now Playing\n%s\n%b" + +[spliff] +appname = "spliff" +format = "ready for printing\n%s\n%b" diff --git a/.config/i3/config##c.desktop,h.Lowe b/.config/i3/config##c.desktop,h.Lowe index 30692e1..86688be 100644 --- a/.config/i3/config##c.desktop,h.Lowe +++ b/.config/i3/config##c.desktop,h.Lowe @@ -8,6 +8,9 @@ set $alt Mod1 # launch polybar exec --no-startup-id $HOME/.config/polybar/launch.sh & +# launch spliffer + notification +exec --no-startup-id $HOME/bin/watch_incoming.sh & + # start the screensaver, '' at the end is not a typo exec --no-startup-id xidlehook --not-when-fullscreen --not-when-audio --timer normal 300 'betterlockscreen -l dimblur -t "Welcome Back"' '' diff --git a/bin/watch_incoming.sh b/bin/watch_incoming.sh new file mode 100755 index 0000000..b031461 --- /dev/null +++ b/bin/watch_incoming.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +TARGET=$HOME/Downloads/toPrint/toPrint_staging +PROCESSED=$HOME/Downloads/toPrint/toPrint_ready +SPLIFF=$HOME/bin/spliff + +inotifywait -m -e create -e moved_to --format "%f" "${TARGET}" \ + | while read FILENAME +do + THUMB=$(mktemp /tmp/pdf_thumbnail_XXXXXXXXX.png) + evince-thumbnailer -s 1024 -l "${TARGET}/${FILENAME}" "${THUMB}" + mv "${TARGET}/${FILENAME}" "${PROCESSED}/${FILENAME}" + $SPLIFF "${PROCESSED}/${FILENAME}" + rm -f "${PROCESSED}/${FILENAME}" + dunstify -a "spliff" -I "${THUMB}" "$FILENAME" +done -- cgit v1.2.3-70-g09d2