From 01ac7bd119be1bee4f325a4e3aab6a0ce203252c Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 3 Feb 2023 11:33:47 +0100 Subject: up --- .config/conkyrc | 18 ++----------- .config/openbox/autostart | 66 ++++++++++++++++++++++------------------------ .config/openbox/rc.xml | 4 +-- .local/bin/conky/cover.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++ .local/bin/conky/net.sh | 35 +++++++++++++++++++++++++ .local/bin/conky_cover.sh | 67 ----------------------------------------------- 6 files changed, 138 insertions(+), 119 deletions(-) create mode 100755 .local/bin/conky/cover.sh create mode 100755 .local/bin/conky/net.sh delete mode 100755 .local/bin/conky_cover.sh diff --git a/.config/conkyrc b/.config/conkyrc index 4b95633..10498cf 100644 --- a/.config/conkyrc +++ b/.config/conkyrc @@ -53,11 +53,10 @@ ${color grey}OS: ${font1}${color white}${sysname}${font} ${color grey}Kernel: ${font1}${color white}${kernel}${font} ${color grey}Uptime: ${font1}${color white}${uptime}${font} ${hr}${if_mpd_playing} -${color grey}${alignc}MPD ${font1}${color white}${goto 140}${mpd_artist} ${goto 140}${scroll wait 25 3 1 ${mpd_title}} ${goto 140}${mpd_elapsed}/${mpd_length} ${mpd_bar} -${execi 5 ~/.local/bin/conky_cover.sh >/dev/null 2>&1}${image /tmp/conkyCover.png -p 20,150 -n} +${execi 5 ~/.local/bin/conky/cover.sh >/dev/null 2>&1}${image /tmp/conkyCover.png -p 20,150 -n} ${hr}${endif}${if_up enx4ce1734c425a} ${font2}${color white}${alignc}${execi 1800 curl wttr.in/Lyon?T0 --silent --max-time 3}${font} ${hr}${endif} @@ -83,19 +82,6 @@ ${font1}${color white}${top_mem name 3} ${alignr}${top_mem pid 3} ${top_mem cpu ${font1}${color grey}${top_mem name 4} ${alignr}${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem_res 4}${font} ${color grey}--------- ${color grey}Processes: ${color white}${processes} -${hr}${if_up enx4ce1734c425a} -${color grey}LAN IP: ${font1}${color white}${addr enx4ce1734c425a}${font} -${color grey}--------- -${color grey}VPN IP: ${font1}${color white}${addr proton0}${font} -${color grey}--------- -${color grey}Public IP: ${color white}${font1}${execi 300 curl -s https://ifconfig.me || echo No Address}${font}${color grey} ${hr} -${color grey}Down: ${color white}${font1}${downspeed enx4ce1734c425a} ${font}${color grey}- Up: ${color white}${font1}${upspeed enx4ce1734c425a}${font} -${color grey}Down: ${color white}${downspeedgraph enx4ce1734c425a bfbfbf c0c0c0 125829120} -${color grey}Up: ${color white}${upspeedgraph enx4ce1734c425a bfbfbf c0c0c0 125829120} -${hr} -${color grey}${alignc}DNS -${font1}${color white}${nameserver 0}${font} -${font1}${color white}${nameserver 1}${font} -${hr}${endif} +${execp ~/.local/bin/conky/net.sh} ]] diff --git a/.config/openbox/autostart b/.config/openbox/autostart index acb0dfc..065acfa 100755 --- a/.config/openbox/autostart +++ b/.config/openbox/autostart @@ -17,55 +17,53 @@ #xfce-mcs-manager & # select OS -# 1: Artix -# 2: Pop OS -# 3: FreeBSD os="$(uname)" -if [ "$os" = "Linux" ]; then - grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 -elif [ "$os" = "FreeBSD" ]; then - os=3 -else - echo "unknown OS" - exit 1 -fi +case $os in + "Linux") grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 ;; + "FreeBSD") os=3 ;; +esac +case $os in + 1) + icon=" " + mpd="mpd" + xscr="xscreensaver --no-splash" + ;; + 2) + icon=" " + mpd="mpd" + xscr="xscreensaver" + ;; + 3) + icon=" " + mpd="musicpd" + xscr="xscreensaver --no-splash" + ;; +esac startif() { pgrep "$(basename "$1")" >/dev/null || "$@" >/dev/null 2>&1 & } -delay_desktop() { - sleep 5 - startif conky -d -c "$HOME"/.config/conkyrc - startif tint2 - startif plank -} - export LANG='en_US.UTF-8' -case $os in - 1) icon=" " ;; - 2) icon=" " ;; - 3) icon=" " ;; -esac - startif dunst startif picom startif mpd-notification -# startif xscreensaver +pgrep $mpd >/dev/null || $mpd >/dev/null 2>&1 +startif $xscr "$HOME"/.local/bin/setwp "$HOME"/pics/wp.jpg "$HOME"/.local/bin/kb xset s off xset -dpms -if xrandr | grep -F 'DisplayPort-0 connected' >/dev/null 2>&1; then - "$HOME"/.local/bin/scr -else - "$HOME"/.local/bin/dscr -fi -delay_desktop & +# if xrandr | grep -F 'DisplayPort-0 connected' >/dev/null 2>&1; then +# "$HOME"/.local/bin/scr +# else +# "$HOME"/.local/bin/dscr +# fi +startif conky -d -c "$HOME"/.config/conkyrc +startif tint2 +startif plank cd "$HOME" xrdb "$HOME"/.config/x11/xresources - -notify-send -u normal 'Welcome' " Welcome back, partner\!" -# dbus-launch openbox +notify-send -u normal 'Welcome' "$icon Welcome back, partner!" diff --git a/.config/openbox/rc.xml b/.config/openbox/rc.xml index fbfa04f..b54bca3 100755 --- a/.config/openbox/rc.xml +++ b/.config/openbox/rc.xml @@ -295,12 +295,12 @@ - next + prev - prev + next diff --git a/.local/bin/conky/cover.sh b/.local/bin/conky/cover.sh new file mode 100755 index 0000000..ffdd403 --- /dev/null +++ b/.local/bin/conky/cover.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# +# 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 +TMP=/tmp/conkympd.tmp + +# 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" + +playing="$(mpc --format '%artist% - %album%' | head -1)" +filedir="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" + +[ ! -f $TMP ] && touch $TMP +[ "$(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 + +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 $coverfile." >> $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 +convert "$coverfile" -resize 100 /tmp/conkyCover.png # >> $LOG +## Set current artist +echo "$playing" > $TMP +#rm /tmp/cover.jpg /tmp/cover.png + diff --git a/.local/bin/conky/net.sh b/.local/bin/conky/net.sh new file mode 100755 index 0000000..4316e1a --- /dev/null +++ b/.local/bin/conky/net.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +os="$(uname)" + +if [ "$os" = "Linux" ]; then + grep "Artix" /etc/issue >/dev/null 2>&1 && os=1 || os=2 +elif [ "$os" = "FreeBSD" ]; then + os=3 +else + echo "unknown OS" + exit 1 +fi + +case $os in + 1) icon=" " ;; + 2) icon=" " ;; + 3) icon=" " ;; +esac + +echo '${color grey}Net' +# ${hr}${if_up enx4ce1734c425a} +# ${color grey}LAN IP: ${font1}${color white}${addr enx4ce1734c425a}${font} +# ${color grey}--------- +# ${color grey}VPN IP: ${font1}${color white}${addr proton0}${font} +# ${color grey}--------- +# ${color grey}Public IP: ${color white}${font1}${execi 300 curl -s https://ifconfig.me || echo No Address}${font}${color grey} +# ${hr} +# ${color grey}Down: ${color white}${font1}${downspeed enx4ce1734c425a} ${font}${color grey}- Up: ${color white}${font1}${upspeed enx4ce1734c425a}${font} +# ${color grey}Down: ${color white}${downspeedgraph enx4ce1734c425a bfbfbf c0c0c0 125829120} +# ${color grey}Up: ${color white}${upspeedgraph enx4ce1734c425a bfbfbf c0c0c0 125829120} +# ${hr} +# ${color grey}DNS: +# ${font1}${color white}${nameserver 0}${font} +# ${font1}${color white}${nameserver 1}${font} +# ${hr}${endif} diff --git a/.local/bin/conky_cover.sh b/.local/bin/conky_cover.sh deleted file mode 100755 index ffdd403..0000000 --- a/.local/bin/conky_cover.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# -# 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 -TMP=/tmp/conkympd.tmp - -# 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" - -playing="$(mpc --format '%artist% - %album%' | head -1)" -filedir="$(dirname "$XDG_MUSIC_DIR/$(mpc --format %file% | head -n1)")" - -[ ! -f $TMP ] && touch $TMP -[ "$(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 - -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 $coverfile." >> $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 -convert "$coverfile" -resize 100 /tmp/conkyCover.png # >> $LOG -## Set current artist -echo "$playing" > $TMP -#rm /tmp/cover.jpg /tmp/cover.png - -- cgit v1.2.3