summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/fetch_mail.sh34
-rwxr-xr-x.local/bin/linkview12
2 files changed, 25 insertions, 21 deletions
diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh
index ed3da4a..061232d 100755
--- a/.local/bin/fetch_mail.sh
+++ b/.local/bin/fetch_mail.sh
@@ -1,9 +1,5 @@
#!/bin/sh
-set -f
-set +f
-set -m
-
export GNUPGHOME=$HOME/.local/share/gnupg
export PASSWORD_STORE_DIR=$HOME/.local/share/pass
@@ -11,31 +7,35 @@ mc_file="/tmp/newmailcount"
if [ -f $mc_file ]; then
pre_count=$(cat $mc_file)
else
- pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)"
- mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)"
- mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)"
- pre_count="$((pre_count + mb1 + mb2))"
+ pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmx_rbo/INBOX/new | wc -l 2>/dev/null)"
+ mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmx_shop/INBOX/new | wc -l 2>/dev/null)"
+ #pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)"
+ #mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)"
+ #mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)"
+ pre_count="$((pre_count + mb1))"
fi
if ! echo test | gpg2 --sign --batch --no-tty --pinentry-mode error -o /dev/null >/dev/null 2>&1; then
- notify-send -u low -t 6000 'mbsync' ' GPG locked'
+ notify-send -u critical -t 6000 'mbsync' ' GPG locked'
exit 1
fi
killall mbsync >/dev/null 2>&1
-notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1
+notify-send -u critical -t 3000 'mbsync' ' fetching mail' >/dev/null 2>&1
# {
-mbsync -a -c /usr/home/jozan/.config/mbsync/mbsyncrc ||
- notify-send -u low -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1
+mbsync -a ||
+ notify-send -u critical -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1
# }&
# gsleep 0.2
# kill -74 $(pidof dwmblocks) >/dev/null 2>&1
# fg
-pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)"
-mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)"
-mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)"
-post_count="$((post_count + mb1 + mb2))"
+post_count="$(ls "${MAIL:-/var/mail/jozan}"/gmx_rbo/INBOX/new | wc -l 2>/dev/null)"
+mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmx_shop/INBOX/new | wc -l 2>/dev/null)"
+# pre_count="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new | wc -l 2>/dev/null)"
+# mb1="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new | wc -l 2>/dev/null)"
+# mb2="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new | wc -l 2>/dev/null)"
+post_count="$((post_count + mb1))"
if [ $post_count -gt $pre_count ]; then
- notify-send -u normal 'NeoMutt' ' '$post_count' new mail(s)'
+ notify-send -u normal 'neomutt' ' '$post_count' new mail(s)'
fi
echo $post_count >$mc_file
# sleep 1
diff --git a/.local/bin/linkview b/.local/bin/linkview
index dea342f..605e0b7 100755
--- a/.local/bin/linkview
+++ b/.local/bin/linkview
@@ -12,8 +12,6 @@ use Capture::Tiny qw(capture);
use POSIX qw(setsid);
use Data::UUID;
-my $menu = "fzf";
-
use constant {
TERMINAL_PATH => $TERMINAL,
MPV_PATH => 'mpv',
@@ -34,6 +32,11 @@ my @func_refs = ( \&vid, \&img_pdf, \&dl, \&audio, \&img_pdf, \&w3m, \&web, \&cl
my %func_list;
@func_list{@keys} = @func_refs;
+my $menu = "fzf --prompt ";
+for (@ARGV) {
+ $menu = "dmenu -i -l " . scalar @keys . " -p " if $_ eq "--dmenu";
+}
+
use constant QUAL_LIST => "" .
"uncap" . "\n" .
"1440" . "\n" .
@@ -174,7 +177,7 @@ sub dl
if (is_yt($url) != 0) {
$list = QUAL_LIST;
- $quality = `printf "$list" | $menu --prompt 'quality > '`;
+ $quality = `printf "$list" | $menu 'quality > '`;
if (not $quality) {
return;
}
@@ -489,7 +492,7 @@ sub fzf_prompt
my $list;
$list = join("\n", @keys);
- $answer = `printf "$list\n" | $menu --prompt '$url > '`;
+ $answer = `printf "$list\n" | $menu '$url >'`;
chomp $answer;
return $answer;
}
@@ -504,6 +507,7 @@ sub linkview
}
$answer = fzf_prompt($ARGV[0]);
+ $ARGV[1] = undef if (exists $ARGV[1] and $ARGV[1] eq '--dmenu');
return unless exists $func_list{$answer};
$func_list{$answer}->($ARGV[0], $ARGV[1], $answer);
return;