~tardypad/dotfiles

666f1ef86f424a3fda971846324bec9e45ba086f — Damien Tardy-Panis 1 year, 4 months ago c5cdebb
Add i3blocks block for new mails
M files/configs/i3blocks/config => files/configs/i3blocks/config +2 -0
@@ 33,6 33,8 @@ separator_block_width=100
[music]
signal=4

[mail]

[chat]

[microphone]

M files/scripts/i3blocks/Makefile => files/scripts/i3blocks/Makefile +1 -0
@@ 5,6 5,7 @@ i3blocks-scripts:
	setup/setup-script i3blocks/i3blocks-chat
	setup/setup-script i3blocks/i3blocks-do-not-disturb
	setup/setup-script i3blocks/i3blocks-idle-inhibitor
	setup/setup-script i3blocks/i3blocks-mail
	setup/setup-script i3blocks/i3blocks-microphone
	setup/setup-script i3blocks/i3blocks-music
	setup/setup-script i3blocks/i3blocks-network

A files/scripts/i3blocks/i3blocks-mail => files/scripts/i3blocks/i3blocks-mail +23 -0
@@ 0,0 1,23 @@
#!/bin/sh
# commands used:
# - do-not-disturb
# - i3blocks-mode

MODE="$( i3blocks-mode )"

COUNT="$( find "${HOME}/Mail" -path '*/new/*' -type f | wc -l )"

if [ "${COUNT}" -gt 0 ]; then
  # do not set notice color if we are busy not to get tempted to check chat
  if [ "$( do-not-disturb status )" = 'disabled' ]; then
    COLOR='#{color/notice/hex}'
  fi
fi

if [ "${MODE}" = 'full' ]; then
  TEXT="  ${COUNT}"
else
  TEXT=''
fi

printf '%s\n\n%s\n' "${TEXT}" "${COLOR}"