diff options
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/dmlog | 15 | ||||
| -rwxr-xr-x | .local/bin/fetch_mail | 9 | ||||
| -rwxr-xr-x | .local/bin/fetch_sfeed | 2 | ||||
| -rwxr-xr-x | .local/bin/hddmnt | 16 | ||||
| -rwxr-xr-x | .local/bin/hddumnt | 12 | ||||
| -rwxr-xr-x | .local/bin/ndate | 2 |
6 files changed, 23 insertions, 33 deletions
diff --git a/.local/bin/dmlog b/.local/bin/dmlog index c31a270..a5f9b15 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -27,13 +27,6 @@ use constant CONFIRM => [ "yes" ]; -my $icon; - -$icon = ""; -$icon = " " if HOSTNAME eq 'mother'; -$icon = " " if HOSTNAME eq 'po-rbo'; -$icon = " " if HOSTNAME eq 'mars'; - sub notify { my ($str) = @_; @@ -82,7 +75,7 @@ sub action "-fail-color", "0xcc241d"); } else { - exec(SLOCK_PATH . " && exec herbe '$icon welcome back, partner!'"); + exec(SLOCK_PATH . " && exec herbe 'welcome back, partner!'"); } } elsif ($var eq ${+LIST}[1]) { @@ -99,7 +92,7 @@ sub action } } else { - notify("$icon g'night, partner!"); + notify("g'night, partner!"); sleep 2; if (HOSTNAME eq 'mother') { system('umount', '-f', '/var/dev/ceres'); @@ -128,13 +121,13 @@ sub action elsif (HOSTNAME eq 'po-rbo') { exec('doas', 'systemctl', 'reboot'); } - notify("$icon rebootin', partner!"); + notify("rebootin', partner!"); exec(SHUTDOWN_PATH, '-r', 'now'); } } elsif ($var eq ${+LIST}[4]) { if (confirm($var, $color) == 1) { - notify("$icon farewell, partner!"); + notify("farewell, partner!"); sleep 2; if (HOSTNAME eq 'mother') { exec(LOGINCTL_PATH, 'poweroff'); diff --git a/.local/bin/fetch_mail b/.local/bin/fetch_mail index eaee5fb..04df4b3 100755 --- a/.local/bin/fetch_mail +++ b/.local/bin/fetch_mail @@ -13,7 +13,7 @@ sub test_gpg $ret = system("echo test | gpg2 --sign --batch --no-tty --pinentry-mode error -o /dev/null >/dev/null 2>&1"); if ($ret != 0) { - notify(" gpg locked | can't fetch mails"); + notify("[!] gpg locked | can't fetch mails"); } return $ret; } @@ -37,7 +37,7 @@ sub get_new_mail $ret = system('mbsync', $acc); if ($ret != 0) { - notify(" $acc: failed to sync mails"); + notify("[!] $acc: failed to sync mails"); } return; } @@ -80,13 +80,10 @@ sub fetch_thread open($fh, '+>', $mc_file) or die $!; $pre_count = -1; } - # if ($pre_count == -1) { - # $pre_count = count_new_mails($_, $maildir); - # } get_new_mail($acc); my $post_count = count_new_mails($acc); if ($post_count > $pre_count && $post_count > 0) { - my $notify_str = ' ' . $acc . ': ' . $post_count . ' new mail'; + my $notify_str = '[mail] ' . $acc . ': ' . $post_count . ' new mail'; $notify_str .= ($post_count > 1 ? "s\n" : "\n"); notify($notify_str) } diff --git a/.local/bin/fetch_sfeed b/.local/bin/fetch_sfeed index 08e6e41..3588ea2 100755 --- a/.local/bin/fetch_sfeed +++ b/.local/bin/fetch_sfeed @@ -14,5 +14,5 @@ post=$(wc -l $XDG_DATA_HOME/sfeed/feeds/* | rev | tr -d ' ') if [ $post -gt $pre ]; then - exec herbe " $((post-pre)) new articles" & + exec herbe "[rss] $((post-pre)) new articles" & fi diff --git a/.local/bin/hddmnt b/.local/bin/hddmnt index c3b73d3..d7115f1 100755 --- a/.local/bin/hddmnt +++ b/.local/bin/hddmnt @@ -7,38 +7,38 @@ case "$(hostname -s)" in mother|po-rbo) dev=$(find /dev/sd* -type b -exec bash -c 'doas cryptsetup isLuks {} && echo {}' \; | head -n1) if [ -z "$dev" ]; then - herbe ' crypt dev not detected' & + herbe 'crypt dev not detected' & exit 1 fi if ! doas cryptsetup open "$dev" "$devname"; then - herbe " failed to uncrypt dev $dev" & + herbe "failed to uncrypt dev $dev" & exit 1 fi mkdir -p "$mountpoint" if ! doas mount /dev/mapper/"$devname" "$mountpoint"; then - herbe " failed to mount dev $dev" & + herbe "failed to mount dev $dev" & exit 1 fi - herbe " crypt dev mounted to $mountpoint" & + herbe "crypt dev mounted to $mountpoint" & ;; mars) if ! diskinfo da0 >/dev/null; then - herbe ' HDD not detected' & + herbe 'hdd not detected' & exit 1 fi if mount | grep -F /dev/da0p1; then herbe \ - " HDD already mounted to \ + "hdd already mounted to \ $(mount | grep -F '/dev/da0p1' | awk '{print $3}')" exit 1 fi if ! dmenu -m 0 -p 'Enter password: ' -P | geli attach -k /root/geli_keys/fathdd_ext.key -j - da0p1; then - herbe ' Failed to mount HDD' & + herbe 'failed to mount hdd' & exit 1 fi mkdir -p "$HOME"/hdd mount /dev/da0p1.eli "$HOME"/hdd - herbe ' HDD mounted to ~/hdd' & + herbe 'hdd mounted to ~/hdd' & ;; esac diff --git a/.local/bin/hddumnt b/.local/bin/hddumnt index 1b5da66..d4034ae 100755 --- a/.local/bin/hddumnt +++ b/.local/bin/hddumnt @@ -6,25 +6,25 @@ mountpoint="$HOME/$devname" case "$(hostname -s)" in mother|po-rbo) if ! doas umount "$mountpoint"; then - herbe " failed to dismount $mountpoint" & + herbe "failed to dismount $mountpoint" & fi if ! doas cryptsetup close "$devname"; then - herbe " failed to close crypt dev $devname" & + herbe "failed to close crypt dev $devname" & fi rmdir "$mountpoint" - herbe " crypt dev dismounted from $mountpoint" & + herbe "crypt dev dismounted from $mountpoint" & ;; mars) if ! mount | grep -F /dev/da0p1; then - herbe ' HDD not mounted' & + herbe 'hdd not mounted' & exit 1 fi if ! umount /dev/da0p1.eli; then - herbe ' failed to dismount hdd' & + herbe 'failed to dismount hdd' & exit 1 fi geli detach da0p1.eli rmdir "$HOME"/hdd - herbe ' hdd dismounted from ~/hdd' & + herbe 'hdd dismounted from ~/hdd' & ;; esac diff --git a/.local/bin/ndate b/.local/bin/ndate index 7a3f6ad..4ee1758 100755 --- a/.local/bin/ndate +++ b/.local/bin/ndate @@ -11,4 +11,4 @@ # == ================ # ===================== -exec herbe " $(date '+%H:%M | %a, %d %b %Y')" & +exec herbe "$(date '+%H:%M | %a, %d %b %Y')" & |
