dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 78c64dc087b157d358727ebdab66dcca53c50700
parent 3162f393a2eb9acfcb5e65927c5e9ecc14a92ebf
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sat, 15 Dec 2018 09:27:00 +0100

Fix mail in i3blocks

Diffstat:
Mlinks/.config/i3/i3blocks | 41++++++++++++++++++++---------------------
Mlinks/.config/i3/i3scripts/i3mail | 47++++++++++++++++++++++++++++++++++++++++++++++-
Mlinks/bin/wallpaper.sh | 14++++++++++++++
3 files changed, 80 insertions(+), 22 deletions(-)

diff --git a/links/.config/i3/i3blocks b/links/.config/i3/i3blocks @@ -23,29 +23,30 @@ # Global properties separator_block_width=14 markup=pango +command=~/.config/i3/i3scripts/$BLOCK_NAME -[MPD] +[i3mpd] label= -#command=mpc status | perl -ne "if (/\\[playing\\]/) {CORE::say '$(mpc current)'}" -#command=mpc current -command=~/.config/i3/i3scripts/i3mpd -color=#00FF00 interval=20 signal=14 # [mail] -# label=MPD +# label= # command=mailstatus.sh # interval=20 # signal=2 +[i3mail] +label= +interval=20 +signal=2 + [layout] command=cat $HOME/.kbd-layout interval=once signal=3 [volume] -#label=VOL label=♪ instance=Master #instance=PCM @@ -53,12 +54,10 @@ command=/usr/lib/i3blocks/volume interval=once signal=4 -# [memory] -# label=MEM -# command=/usr/lib/i3blocks/memory -# #separator=false -# interval=30 -# signal=5 +[i3mem] +label=MEM +interval=30 +signal=5 # [swap] # label=SWAP @@ -91,23 +90,23 @@ color=#00FF00 interval=10 signal=9 -#[cpu] -#label=CPU -#command=/usr/lib/i3blocks/cpu_usage -#interval=10 +[cpu] +label=CPU +command=~/.config/i3/i3scripts/i3cpu +interval=20 #min_width=CPU: 100.00% -##separator=false -#signal=10 +#separator=false +signal=10 #[load] #command=/usr/lib/i3blocks/load_average #interval=10 #signal=11 -[battery] +[i3battery BAT0] label=BAT #label=⚡ -command=/usr/lib/i3blocks/battery +#command=/usr/lib/i3blocks/battery interval=30 signal=12 diff --git a/links/.config/i3/i3scripts/i3mail b/links/.config/i3/i3scripts/i3mail @@ -14,5 +14,50 @@ case $BLOCK_BUTTON in - Middle click syncs mail" ;; esac -echo "$(du -a ~/.mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat ~/.config/mutt/.dl 2>/dev/null)" +maildir=~/mail +if [ ! -d $maildir ]; then + exit 0 +fi +newmails=$(find $maildir/*/{INBOX,geodatahub}/new -type f) +numbernewmails=$(echo $newmails | wc -w | sed 's/ *//') +mailboxes="$(echo $newmails | tr ' ' '\n' | sed 's/.*mail\///' | + sed 's/\/INBOX.*//' | sed 's/adamsgaard\/geodatahub.*/geodatahub/')" +mailcolor="#859900" +debug=false +#debug=true +offlineimap=offlineimap + +accounts="" +if [[ $mailboxes == *"adamsgaard"* ]]; then + accounts="${accounts}a" +fi +if [[ $mailboxes == *"geodatahub"* ]]; then + accounts="${accounts}G" +fi +if [[ $mailboxes == *"princeton"* ]]; then + accounts="${accounts}p" +fi +if [[ $mailboxes == *"noaa"* ]]; then + accounts="${accounts}n" +fi +if [[ $mailboxes == *"gmail"* ]]; then + accounts="${accounts}g" +fi +if [[ $mailboxes == *"geomail"* ]]; then + accounts="${accounts}e" +fi +if [[ $mailboxes == *"ucsd"* ]]; then + accounts="${accounts}u" +fi +if [[ $mailboxes == *"riseup"* ]]; then + accounts="${accounts}r" +fi + +if [ "$numbernewmails" -gt 0 ]; then + # echo "#[fg=red]M: ${numbernewmails} (${accounts})" + echo "<span color=\"red\">M: ${numbernewmails} (${accounts})</span>" +else + # echo "#[fg=green]M: ${numbernewmails}" + echo +fi diff --git a/links/bin/wallpaper.sh b/links/bin/wallpaper.sh @@ -3,3 +3,17 @@ #hsetroot -full ~/wallpapers/hackingtheloop_1920.jpg # single screen #hsetroot -fill ~/wallpapers/polygon-art-17498.jpg #hsetroot -fill ~/photos/wallpapers/current_wallpapers/overdeepenings-Edit-Edit.jpg + +function set_wallpaper { + feh --bg-scale "$1" + echo "$1" > ~/.wallpaper +} + +function get_next_wallpaper_in_dir { + wallpapers="ls '$1'/*.{jpg,JPG,jpeg,JPEG,png,PNG}" + return wallpapers[1] +} + +dir="~/photos/wallpapers/google_earth" +wallpaper=get_next_wallpaper_in_dir "$dir" +set_wallpaper=