From fe6cd3b56519ea07ea92af48278132b946e77bac Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 26 Dec 2022 11:41:48 +0100 Subject: up --- .local/bin/status/sb-tools | 3 +++ 1 file changed, 3 insertions(+) (limited to '.local') diff --git a/.local/bin/status/sb-tools b/.local/bin/status/sb-tools index 5d042a6..78508e6 100755 --- a/.local/bin/status/sb-tools +++ b/.local/bin/status/sb-tools @@ -1,5 +1,8 @@ #!/bin/sh +if pidof emacs-28.2 >/dev/null 2>&1; then + echo -n " " +fi if pgrep gpg-agent >/dev/null 2>&1; then echo -n " " else -- cgit v1.2.3 From 2eb4c34b582becd8b7339e7e7a6b35534558988f Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 30 Dec 2022 14:43:30 +0100 Subject: update --- .local/bin/status/sb-mailbox | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to '.local') diff --git a/.local/bin/status/sb-mailbox b/.local/bin/status/sb-mailbox index 0dfcbd6..f7a3786 100755 --- a/.local/bin/status/sb-mailbox +++ b/.local/bin/status/sb-mailbox @@ -13,10 +13,9 @@ case $BLOCK_BUTTON in 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac -mb_a="$(ls "${MAIL:-/var/mail/jozan}"/main/INBOX/new/ | wc -l 2>/dev/null)" -mb_b="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new/ | wc -l 2>/dev/null)" -mb_c="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new/ | wc -l 2>/dev/null)" -mb_d="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new/ | wc -l 2>/dev/null)" +mb_a="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new/ | wc -l 2>/dev/null)" +mb_b="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new/ | wc -l 2>/dev/null)" +mb_c="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new/ | wc -l 2>/dev/null)" sync=0 if pidof mbsync >/dev/null 2>&1; then @@ -30,7 +29,7 @@ case "$sync" in esac if [ "$mb_a" -gt 0 ]; then - echo -n "main:" $mb_a + echo -n "br:" $mb_a fi if [ "$mb_a" -gt 0 ] && [ "$mb_b" -gt 0 ]; then @@ -38,7 +37,7 @@ if [ "$mb_a" -gt 0 ] && [ "$mb_b" -gt 0 ]; then fi if [ "$mb_b" -gt 0 ]; then - echo -n "br:" $mb_b + echo -n "oon:" $mb_b fi if [ "$mb_b" -gt 0 ] && [ "$mb_c" -gt 0 ]; then @@ -48,17 +47,5 @@ elif [ "$mb_a" -gt 0 ] && [ "$mb_c" -gt 0 ]; then fi if [ "$mb_c" -gt 0 ]; then - echo -n "oon:" $mb_c -fi - -if [ "$mb_c" -gt 0 ] && [ "$mb_d" -gt 0 ]; then - echo -n " - " -elif [ "$mb_b" -gt 0 ] && [ "$mb_d" -gt 0 ]; then - echo -n " - " -elif [ "$mb_a" -gt 0 ] && [ "$mb_d" -gt 0 ]; then - echo -n " - " -fi - -if [ "$mb_d" -gt 0 ]; then - echo -n "tos:" $mb_d + echo -n "tos:" $mb_c fi -- cgit v1.2.3 From 524a6e927cc3691367dcb9469492b7f3f92ac99b Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 12 Jan 2023 11:37:14 +0100 Subject: up --- .local/bin/fetch_mail.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to '.local') diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh index 0375f41..f9eee36 100755 --- a/.local/bin/fetch_mail.sh +++ b/.local/bin/fetch_mail.sh @@ -11,11 +11,10 @@ mc_file="/tmp/newmailcount" if [ -f $mc_file ]; then pre_count=$(cat $mc_file) else - pre_count="$(ls "${MAIL:-/var/mail/jozan}"/main/INBOX/new | wc -l 2>/dev/null)" - mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)" - mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)" - mb3="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" - pre_count="$((pre_count + mb1 + mb2 + mb3))" + pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)" + mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)" + mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" + pre_count="$((pre_count + mb1 + mb2))" fi killall mbsync >/dev/null 2>&1 # notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1 @@ -26,11 +25,10 @@ killall mbsync >/dev/null 2>&1 gsleep 0.2 kill -74 $(pidof dwmblocks) >/dev/null 2>&1 fg -post_count="$(ls "${MAIL:-/var/mail/jozan}"/main/INBOX/new | wc -l 2>/dev/null)" -mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)" -mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)" -mb3="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" -post_count="$((post_count + mb1 + mb2 + mb3))" +pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)" +mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)" +mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" +post_count="$((post_count + mb1 + mb2))" if [ $post_count -gt $pre_count ]; then notify-send -u normal 'NeoMutt' ' '$post_count' new mail(s)' fi -- cgit v1.2.3 From fc59e659114f29ddb3cc63a4cc6fd543fb946c31 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 12 Jan 2023 14:45:51 +0100 Subject: up --- .local/bin/fetch_mail.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to '.local') diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh index f9eee36..4faabb2 100755 --- a/.local/bin/fetch_mail.sh +++ b/.local/bin/fetch_mail.sh @@ -17,14 +17,14 @@ else pre_count="$((pre_count + mb1 + mb2))" fi killall mbsync >/dev/null 2>&1 -# notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1 -{ +notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1 +# { mbsync -a -c /usr/home/jozan/.config/mbsync/mbsyncrc || notify-send -u low -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1 -}& -gsleep 0.2 -kill -74 $(pidof dwmblocks) >/dev/null 2>&1 -fg +# }& +# gsleep 0.2 +# kill -74 $(pidof dwmblocks) >/dev/null 2>&1 +# fg pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)" mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)" mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" @@ -34,4 +34,4 @@ if [ $post_count -gt $pre_count ]; then fi echo $post_count >$mc_file sleep 1 -kill -74 $(pidof dwmblocks) >/dev/null 2>&1 +# kill -74 $(pidof dwmblocks) >/dev/null 2>&1 -- cgit v1.2.3 From f73a167d9bb5b0b37c1c41e3f2e19ed2bd3ab3e8 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 12 Jan 2023 18:44:21 +0100 Subject: up --- .local/bin/fetch_mail.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to '.local') diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh index 4faabb2..407fbdb 100755 --- a/.local/bin/fetch_mail.sh +++ b/.local/bin/fetch_mail.sh @@ -16,11 +16,18 @@ else mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)" pre_count="$((pre_count + mb1 + mb2))" fi + +if [ $TERM == "dump" ]; then + if ! echo test | gpg2 --sign --batch --no-tty --pinentry-mode error -o /dev/null >/dev/null 2>&1; then + notify-send -u low -t 6000 'mbsync' ' GPG locked' + exit 1 + fi +fi killall mbsync >/dev/null 2>&1 notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1 # { - mbsync -a -c /usr/home/jozan/.config/mbsync/mbsyncrc || - notify-send -u low -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1 +mbsync -a -c /usr/home/jozan/.config/mbsync/mbsyncrc || + notify-send -u low -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1 # }& # gsleep 0.2 # kill -74 $(pidof dwmblocks) >/dev/null 2>&1 @@ -33,5 +40,5 @@ if [ $post_count -gt $pre_count ]; then notify-send -u normal 'NeoMutt' ' '$post_count' new mail(s)' fi echo $post_count >$mc_file -sleep 1 +# sleep 1 # kill -74 $(pidof dwmblocks) >/dev/null 2>&1 -- cgit v1.2.3 From d849e61a7cf22b567dd1c77ca733099a4ddb1013 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 12 Jan 2023 18:49:29 +0100 Subject: up --- .local/bin/fetch_mail.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to '.local') diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh index 407fbdb..c342215 100755 --- a/.local/bin/fetch_mail.sh +++ b/.local/bin/fetch_mail.sh @@ -17,11 +17,9 @@ else pre_count="$((pre_count + mb1 + mb2))" fi -if [ $TERM == "dump" ]; then - if ! echo test | gpg2 --sign --batch --no-tty --pinentry-mode error -o /dev/null >/dev/null 2>&1; then - notify-send -u low -t 6000 'mbsync' ' GPG locked' - exit 1 - fi +if ! echo test | gpg2 --sign --batch --no-tty --pinentry-mode error -o /dev/null >/dev/null 2>&1; then + notify-send -u low -t 6000 'mbsync' ' GPG locked' + exit 1 fi killall mbsync >/dev/null 2>&1 notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1 -- cgit v1.2.3 From 3e5d88ea7ff249f343ef4b16e01954e2cb778bae Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 12 Jan 2023 20:54:42 +0100 Subject: up --- .local/bin/conky_cover.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 .local/bin/conky_cover.sh (limited to '.local') diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh new file mode 100755 index 0000000..43bc65c --- /dev/null +++ b/.local/bin/conky_cover.sh @@ -0,0 +1,64 @@ +#!/usr/local/bin/bash +# +# cover.sh - Download cover from Last.fm and overlay with image +# +# Florian +# +# bug: it detects the artist change twice + +## CONFIGURATION ## +# Folder for cached album art +# Don't use ~, as conky will treat it as a regular directory name +CACHE="$HOME/.cache/covers" +# API Key for Last.fm +APIKEY="b25b959554ed76058ac220b7b2e0a026" +# Log file, only for debugging purposes +LOG=/tmp/conky-mpd.log + +# Check for vital commands +# CMD="mpc curl convert" +# for CHECK in $CMD; do +# [ ! "$CHECK" ] && echo "Command $CHECK not found. Exiting." && exit 1 +# done +# [ ! -d "$CACHE" ] && mkdir -p "$CACHE" + +ARTIST="$(mpc --format %artist% | head -1)" +ALBUM="$(mpc --format %album% | head -1)" + +TMP=/tmp/conkympd.tmp +[ ! -f $TMP ] && touch $TMP +[ "$(cat $TMP)" == "$ARTIST+$ALBUM" ] && echo "Same artist." >> $LOG && exit 0 +echo "Artist changed: $ALBUM by $ARTIST" >> $LOG + +#[ -f "/tmp/conkyCover.png" ] && rm "/tmp/conkyCover.png" +cp $HOME/.config/conky-mpd/nocover.png /tmp/conkyCover.png +echo "NoCover" >> $LOG + +COVER="$CACHE/$ARTIST - $ALBUM.jpg" +# Is cover cached? +if [ ! -f "$COVER" ]; then +# Nope. Download. + echo "Downloading cover for $ARTIST - $ALBUM" >> $LOG + # Download XML info + curl --data-urlencode artist="$ARTIST" --data-urlencode album="$ALBUM" "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=$APIKEY" -o /tmp/lastfm.xml &> /dev/null + echo "Exit: $?. Downloaded $(wc -l /tmp/lastfm.xml | cut -d' ' -f1) bytes." >> $LOG + # Strip XML and download mega large cover to cache + curl $(sed -n 's|\(.*\)<\/image>|\1|p' /tmp/lastfm.xml) -o "$COVER" &> /dev/null + echo "Exit: $?" >> $LOG + echo "Downloaded to $COVER." >> $LOG +fi +# Copy cache for processing +echo "Copying $COVER." >> $LOG +cp "$COVER" /tmp/cover.jpg +# Downscale to fit overlay +convert /tmp/cover.jpg -resize 366 /tmp/cover.png >> $LOG +# Enlarge canvas to fit overlay +convert /tmp/cover.png -background none -extent 500x455-84-44 /tmp/cover.png >> $LOG +# Overlay overlay over cover +convert /tmp/cover.png $HOME/.config/conky-mpd/case.png -composite /tmp/cover.png >> $LOG +# Resize for immediate use +convert /tmp/cover.png -resize 120 /tmp/conkyCover.png >> $LOG +# Set current artist +echo "$ARTIST+$ALBUM" > $TMP +#rm /tmp/cover.jpg /tmp/cover.png + -- cgit v1.2.3 From 8d7e3d384a0a720f85853e42cf90fcbccb5298fd Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 13 Jan 2023 16:43:10 +0100 Subject: up --- .local/bin/conky_cover.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to '.local') diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh index 43bc65c..a0f3517 100755 --- a/.local/bin/conky_cover.sh +++ b/.local/bin/conky_cover.sh @@ -1,4 +1,4 @@ -#!/usr/local/bin/bash +#!/bin/sh # # cover.sh - Download cover from Last.fm and overlay with image # @@ -49,16 +49,17 @@ if [ ! -f "$COVER" ]; then fi # Copy cache for processing echo "Copying $COVER." >> $LOG -cp "$COVER" /tmp/cover.jpg +# cp "$COVER" /tmp/cover.jpg # Downscale to fit overlay -convert /tmp/cover.jpg -resize 366 /tmp/cover.png >> $LOG -# Enlarge canvas to fit overlay -convert /tmp/cover.png -background none -extent 500x455-84-44 /tmp/cover.png >> $LOG -# Overlay overlay over cover -convert /tmp/cover.png $HOME/.config/conky-mpd/case.png -composite /tmp/cover.png >> $LOG -# Resize for immediate use -convert /tmp/cover.png -resize 120 /tmp/conkyCover.png >> $LOG -# Set current artist +# convert /tmp/cover.jpg -resize 366 /tmp/cover.png >> $LOG +## Enlarge canvas to fit overlay +#convert /tmp/cover.png -background none -extent 500x455-84-44 /tmp/cover.png >> $LOG +## Overlay overlay over cover +#convert /tmp/cover.png $HOME/.config/conky-mpd/case.png -composite /tmp/cover.png >> $LOG +## Resize for immediate use +# convert /tmp/cover.png -resize 120 /tmp/conkyCover.png >> $LOG +convert "$COVER" -resize 100 /tmp/conkyCover.png >> $LOG +## Set current artist echo "$ARTIST+$ALBUM" > $TMP #rm /tmp/cover.jpg /tmp/cover.png -- cgit v1.2.3 From 409b5869cc29c55a3cd0823e04320355dd680689 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 17 Jan 2023 12:42:47 +0100 Subject: up --- .local/bin/conky_cover.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '.local') diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh index a0f3517..5514913 100755 --- a/.local/bin/conky_cover.sh +++ b/.local/bin/conky_cover.sh @@ -24,11 +24,12 @@ LOG=/tmp/conky-mpd.log ARTIST="$(mpc --format %artist% | head -1)" ALBUM="$(mpc --format %album% | head -1)" +FILEDIR="$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)" TMP=/tmp/conkympd.tmp [ ! -f $TMP ] && touch $TMP -[ "$(cat $TMP)" == "$ARTIST+$ALBUM" ] && echo "Same artist." >> $LOG && exit 0 -echo "Artist changed: $ALBUM by $ARTIST" >> $LOG +[ "$(cat $TMP)" == "$ARTIST+$ALBUM" ] && echo "Same artist/album." >> $LOG && exit 0 +echo "Artist/album changed: $ALBUM by $ARTIST" >> $LOG #[ -f "/tmp/conkyCover.png" ] && rm "/tmp/conkyCover.png" cp $HOME/.config/conky-mpd/nocover.png /tmp/conkyCover.png -- cgit v1.2.3 From 1ae97e766635b4409f51909e56ee83cb69b84dd3 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 17 Jan 2023 15:50:21 +0100 Subject: up --- .local/bin/conky_cover.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to '.local') diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh index 5514913..571a240 100755 --- a/.local/bin/conky_cover.sh +++ b/.local/bin/conky_cover.sh @@ -24,7 +24,7 @@ LOG=/tmp/conky-mpd.log ARTIST="$(mpc --format %artist% | head -1)" ALBUM="$(mpc --format %album% | head -1)" -FILEDIR="$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)" +FILEDIR="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" TMP=/tmp/conkympd.tmp [ ! -f $TMP ] && touch $TMP @@ -35,21 +35,22 @@ echo "Artist/album changed: $ALBUM by $ARTIST" >> $LOG cp $HOME/.config/conky-mpd/nocover.png /tmp/conkyCover.png echo "NoCover" >> $LOG -COVER="$CACHE/$ARTIST - $ALBUM.jpg" -# Is cover cached? -if [ ! -f "$COVER" ]; then -# Nope. Download. - echo "Downloading cover for $ARTIST - $ALBUM" >> $LOG - # Download XML info - curl --data-urlencode artist="$ARTIST" --data-urlencode album="$ALBUM" "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=$APIKEY" -o /tmp/lastfm.xml &> /dev/null - echo "Exit: $?. Downloaded $(wc -l /tmp/lastfm.xml | cut -d' ' -f1) bytes." >> $LOG - # Strip XML and download mega large cover to cache - curl $(sed -n 's|\(.*\)<\/image>|\1|p' /tmp/lastfm.xml) -o "$COVER" &> /dev/null - echo "Exit: $?" >> $LOG - echo "Downloaded to $COVER." >> $LOG -fi +coverfile="$(find "$FILEDIR" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname 'cover.png' -o -iname 'folder.jpg' -o -iname 'folder.png' -o -iname '*.jpg' -o -iname '*.png' \) -print -quit)" +#COVER="$CACHE/$ARTIST - $ALBUM.jpg" +## Is cover cached? +#if [ ! -f "$COVER" ]; then +## Nope. Download. +# echo "Downloading cover for $ARTIST - $ALBUM" >> $LOG +# # Download XML info +# curl --data-urlencode artist="$ARTIST" --data-urlencode album="$ALBUM" "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=$APIKEY" -o /tmp/lastfm.xml &> /dev/null +# echo "Exit: $?. Downloaded $(wc -l /tmp/lastfm.xml | cut -d' ' -f1) bytes." >> $LOG +# # Strip XML and download mega large cover to cache +# curl $(sed -n 's|\(.*\)<\/image>|\1|p' /tmp/lastfm.xml) -o "$COVER" &> /dev/null +# echo "Exit: $?" >> $LOG +# echo "Downloaded to $COVER." >> $LOG +#fi # Copy cache for processing -echo "Copying $COVER." >> $LOG +echo "Copying $coverfile." >> $LOG # cp "$COVER" /tmp/cover.jpg # Downscale to fit overlay # convert /tmp/cover.jpg -resize 366 /tmp/cover.png >> $LOG @@ -59,7 +60,7 @@ echo "Copying $COVER." >> $LOG #convert /tmp/cover.png $HOME/.config/conky-mpd/case.png -composite /tmp/cover.png >> $LOG ## Resize for immediate use # convert /tmp/cover.png -resize 120 /tmp/conkyCover.png >> $LOG -convert "$COVER" -resize 100 /tmp/conkyCover.png >> $LOG +convert "$coverfile" -resize 100 /tmp/conkyCover.png >> $LOG ## Set current artist echo "$ARTIST+$ALBUM" > $TMP #rm /tmp/cover.jpg /tmp/cover.png -- cgit v1.2.3 From 2c728b96362eab06e07a61a305a5a0155f78258a Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 17 Jan 2023 16:01:37 +0100 Subject: up --- .local/bin/conky_cover.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to '.local') diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh index 571a240..ffdd403 100755 --- a/.local/bin/conky_cover.sh +++ b/.local/bin/conky_cover.sh @@ -9,11 +9,12 @@ ## CONFIGURATION ## # Folder for cached album art # Don't use ~, as conky will treat it as a regular directory name -CACHE="$HOME/.cache/covers" +# CACHE="$HOME/.cache/covers" # API Key for Last.fm -APIKEY="b25b959554ed76058ac220b7b2e0a026" +# APIKEY="b25b959554ed76058ac220b7b2e0a026" # Log file, only for debugging purposes LOG=/tmp/conky-mpd.log +TMP=/tmp/conkympd.tmp # Check for vital commands # CMD="mpc curl convert" @@ -22,20 +23,19 @@ LOG=/tmp/conky-mpd.log # done # [ ! -d "$CACHE" ] && mkdir -p "$CACHE" -ARTIST="$(mpc --format %artist% | head -1)" -ALBUM="$(mpc --format %album% | head -1)" -FILEDIR="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" +playing="$(mpc --format '%artist% - %album%' | head -1)" +filedir="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" -TMP=/tmp/conkympd.tmp [ ! -f $TMP ] && touch $TMP -[ "$(cat $TMP)" == "$ARTIST+$ALBUM" ] && echo "Same artist/album." >> $LOG && exit 0 -echo "Artist/album changed: $ALBUM by $ARTIST" >> $LOG +[ "$(cat $TMP)" == "$playing" ] && exit 0 +# [ "$(cat $TMP)" == "$playing" ] && echo "Same artist/album" >> $LOG && exit 0 +# echo "Artist/album changed: $playing" >> $LOG #[ -f "/tmp/conkyCover.png" ] && rm "/tmp/conkyCover.png" cp $HOME/.config/conky-mpd/nocover.png /tmp/conkyCover.png -echo "NoCover" >> $LOG +# echo "NoCover" >> $LOG -coverfile="$(find "$FILEDIR" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname 'cover.png' -o -iname 'folder.jpg' -o -iname 'folder.png' -o -iname '*.jpg' -o -iname '*.png' \) -print -quit)" +coverfile="$(find "$filedir" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname 'cover.png' -o -iname 'folder.jpg' -o -iname 'folder.png' -o -iname '*.jpg' -o -iname '*.png' \) -print -quit)" #COVER="$CACHE/$ARTIST - $ALBUM.jpg" ## Is cover cached? #if [ ! -f "$COVER" ]; then @@ -50,7 +50,7 @@ coverfile="$(find "$FILEDIR" -maxdepth 1 -type f \( -iname 'cover.jpg' -o -iname # echo "Downloaded to $COVER." >> $LOG #fi # Copy cache for processing -echo "Copying $coverfile." >> $LOG +# echo "Copying $coverfile." >> $LOG # cp "$COVER" /tmp/cover.jpg # Downscale to fit overlay # convert /tmp/cover.jpg -resize 366 /tmp/cover.png >> $LOG @@ -60,8 +60,8 @@ echo "Copying $coverfile." >> $LOG #convert /tmp/cover.png $HOME/.config/conky-mpd/case.png -composite /tmp/cover.png >> $LOG ## Resize for immediate use # convert /tmp/cover.png -resize 120 /tmp/conkyCover.png >> $LOG -convert "$coverfile" -resize 100 /tmp/conkyCover.png >> $LOG +convert "$coverfile" -resize 100 /tmp/conkyCover.png # >> $LOG ## Set current artist -echo "$ARTIST+$ALBUM" > $TMP +echo "$playing" > $TMP #rm /tmp/cover.jpg /tmp/cover.png -- cgit v1.2.3 From 7eabc900314cd93042f78123fe12ad2771050333 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 31 Jan 2023 11:46:19 +0100 Subject: Pop update --- .local/bin/dmlog | 17 ++++++++++++----- .local/bin/dmpass | 6 ++++-- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to '.local') diff --git a/.local/bin/dmlog b/.local/bin/dmlog index 3d6ccc1..a4c0182 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -62,11 +62,11 @@ sub action '-u', 'normal', 'shutdown', - ' G\'night, partner!' + ' G\'night, partner!' ); sleep 2; if (OS eq 'Linux') { - exec(LOGINCTL_PATH, 'suspend'); + exec('systemctl', 'suspend'); } exec(ACPI_PATH, '-s', '3'); } @@ -84,8 +84,15 @@ sub action if (confirm($var) == 1) { system(EMACS_PATH, '-e', '"(save-buffers-kill-terminal)"'); if (OS eq 'Linux') { - exec(LOGINCTL_PATH, 'reboot'); + exec('systemctl', 'reboot'); } + system( + NOTIF_PATH, + '-u', + 'normal', + 'shutdown', + ' Rebootin\', partner!' + ); exec(SHUTDOWN_PATH, '-r', 'now'); } } @@ -97,11 +104,11 @@ sub action '-u', 'normal', 'shutdown', - ' Farewell, partner!' + ' Farewell, partner!' ); sleep 2; if (OS eq 'Linux') { - exec(LOGINCTL_PATH, 'poweroff'); + exec('systemctl', 'poweroff'); } exec(SHUTDOWN_PATH, '-p', 'now'); } diff --git a/.local/bin/dmpass b/.local/bin/dmpass index 11725c7..6836d41 100755 --- a/.local/bin/dmpass +++ b/.local/bin/dmpass @@ -23,13 +23,15 @@ password=$(printf "%s\n" "${password_files}" | "$dmenu" -i -l 15 -m 0) [ -n "$password" ] || exit +p="$(pass show "$password")" + if [ $full -eq 1 ]; then id=$(printf "%s" "$password" | sed 's/.*___//') printf "%s\n" $id | { IFS= read -r pass; printf %s "$id"; } | $xdotool xdotool key Tab - pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool + printf "%s\n" "$p" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool xdotool key Return exit fi -pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool +printf "%s\n" "$p" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool -- cgit v1.2.3 From 67ac36bdeeff2ba808710c830d598969e1e3acb7 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 31 Jan 2023 14:18:58 +0100 Subject: up --- .local/bin/powercmd | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .local/bin/powercmd (limited to '.local') diff --git a/.local/bin/powercmd b/.local/bin/powercmd new file mode 100755 index 0000000..fadf6a0 --- /dev/null +++ b/.local/bin/powercmd @@ -0,0 +1,23 @@ +#!/bin/sh + +# [ -z "$1" ] && echo "no arg" && exit 1 + +os="$(uname)" + +if [ $os -eq "Linux" ]; then + grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 +elif [ $os -eq "FreeBSD" ]; then +else + echo "unknown OS" + exit 1 +fi + +# 1: Artix +# 2: Pop OS +# 3: FreeBSD + +case $os in + 1) icon="" ;; + 2) icon="" ;; + 3) icon="" ;; +esac -- cgit v1.2.3 From 22ba7c46f959d7ceba975e002af71378227c8b9b Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 31 Jan 2023 15:26:57 +0100 Subject: up --- .local/bin/powercmd | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) (limited to '.local') diff --git a/.local/bin/powercmd b/.local/bin/powercmd index fadf6a0..7cb2ead 100755 --- a/.local/bin/powercmd +++ b/.local/bin/powercmd @@ -1,12 +1,13 @@ #!/bin/sh -# [ -z "$1" ] && echo "no arg" && exit 1 +[ -z "$1" ] && echo "no arg" && exit 1 os="$(uname)" -if [ $os -eq "Linux" ]; then +if [ "$os" = "Linux" ]; then grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 -elif [ $os -eq "FreeBSD" ]; then +elif [ "$os" = "FreeBSD" ]; then + os=3 else echo "unknown OS" exit 1 @@ -17,7 +18,46 @@ fi # 3: FreeBSD case $os in - 1) icon="" ;; - 2) icon="" ;; - 3) icon="" ;; + 1) icon=" " ;; + 2) icon=" " ;; + 3) icon=" " ;; +esac + +case $1 in + "lock") xscreensaver-command -lock ;; + "sleep") + notify-send -u normal "sleep" "$icon G'night, partner!" + sleep 1 + xscreensaver-command -lock + sleep 5 + case $os in + 1) loginctl hibernate ;; + 2) systemctl hibernate ;; + 3) acpiconf -s 4 ;; + esac + ;; + "reboot") + emacsclient -e '"(save-buffers-kill-emacs)"' >/dev/null 2>&1 + notify-send -u normal reboot "$icon Rebootin' now!" + sleep 2 + case $os in + 1) loginctl reboot ;; + 2) systemctl reboot ;; + 3) shutdown -r now ;; + esac + ;; + "poweroff") + emacsclient -e '"(save-buffers-kill-emacs)"' >/dev/null 2>&1 + notify-send -u normal poweroff "$icon Farewell, partner!" + sleep 2 + case $os in + 1) loginctl poweroff ;; + 2) systemctl poweroff ;; + 3) shutdown -p now ;; + esac + ;; + *) + echo "wrong arg" + exit 1 + ;; esac -- cgit v1.2.3 From 045b41463dc7054eaf7f40527b5f6d7ae054b7d1 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 31 Jan 2023 16:29:33 +0100 Subject: up --- .local/bin/powercmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.local') diff --git a/.local/bin/powercmd b/.local/bin/powercmd index 7cb2ead..9f85e39 100755 --- a/.local/bin/powercmd +++ b/.local/bin/powercmd @@ -32,8 +32,8 @@ case $1 in sleep 5 case $os in 1) loginctl hibernate ;; - 2) systemctl hibernate ;; - 3) acpiconf -s 4 ;; + 2) systemctl suspend ;; + 3) acpiconf -s 3 ;; esac ;; "reboot") -- cgit v1.2.3