diff --git a/.config/i3/config b/.config/i3/config index 4c143e2..4c808ed 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -206,7 +206,7 @@ bar { focus_follows_mouse no bindsym $mod+m floating enable; resize set 1400 850; move absolute position center; move scratchpad bindsym $mod+n scratchpad show -bindsym $mod+Shift+x exec i3lock -c 222222 +bindsym $mod+Shift+x exec ~/.scripts/lock.sh bindsym $mod+z [class="Zathura"] scratchpad show bindsym $mod+u [class="URxvt"] scratchpad show bindsym $mod+c [title="Android Emulator*"] scratchpad show diff --git a/.config/i3/i3blocks.conf b/.config/i3/i3blocks.conf index ba03ce7..89e5dcb 100644 --- a/.config/i3/i3blocks.conf +++ b/.config/i3/i3blocks.conf @@ -9,6 +9,11 @@ #interval=3600 #color=#A4C2F4 +[notifications] +command=~/.scripts/togglenotify.sh +interval=3600 +color=#91E78B + # exchange rate(s) [xrateEURZAR] command=~/.config/i3/scripts/xrate.py EURZAR=X diff --git a/.scripts/decode_header.py b/.scripts/decode_header.py new file mode 100755 index 0000000..99cb476 --- /dev/null +++ b/.scripts/decode_header.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3.8 +import sys +from email.header import decode_header, make_header + +h = make_header(decode_header(sys.argv[1])) +print(str(h)) diff --git a/.scripts/lock.sh b/.scripts/lock.sh new file mode 100755 index 0000000..3c652aa --- /dev/null +++ b/.scripts/lock.sh @@ -0,0 +1,9 @@ +if `dunstctl is-paused`; then + #i3lock -n -c 222222 + i3lock -n -i ~/.config/i3/locked.png +else + dunstctl set-paused true + i3lock -n -i ~/.config/i3/locked.png + dunstctl set-paused false +fi + diff --git a/.scripts/mailnotify2.sh b/.scripts/mailnotify2.sh index 9e6aef5..b92876d 100755 --- a/.scripts/mailnotify2.sh +++ b/.scripts/mailnotify2.sh @@ -5,7 +5,7 @@ function extract_sender { grep -o '^From: \(.*\)$' $1 | sed "s/^From: //g" } function extract_subject { - grep -o '^Subject: \(.*\)$' $1 | sed "s/^Subject: //g" + ~/.scripts/decode_header.py `grep -o '^Subject: \(.*\)$' $1 | sed "s/^Subject: //g"` } prevmsgs=/tmp/oimapprevmsg diff --git a/.scripts/togglenotify.sh b/.scripts/togglenotify.sh new file mode 100755 index 0000000..77a04d5 --- /dev/null +++ b/.scripts/togglenotify.sh @@ -0,0 +1,13 @@ +#!/bin/bash +if test -e /tmp/dunstpause; then + dunstctl set-paused toggle; +else + dunstctl set-paused false + touch /tmp/dunstpause; +fi + +if `dunstctl is-paused`; then + echo do not disturb +else + echo available +fi