aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.local/bin')
-rwxr-xr-xdotfiles/.local/bin/mailsync12
-rwxr-xr-xdotfiles/.local/bin/menumako2
-rwxr-xr-xdotfiles/.local/bin/menupass18
-rwxr-xr-xdotfiles/.local/bin/pacsync14
-rwxr-xr-xdotfiles/.local/bin/sshwiz18
5 files changed, 42 insertions, 22 deletions
diff --git a/dotfiles/.local/bin/mailsync b/dotfiles/.local/bin/mailsync
index d67db06..ad69337 100755
--- a/dotfiles/.local/bin/mailsync
+++ b/dotfiles/.local/bin/mailsync
@@ -9,14 +9,14 @@ notmuchrc="$HOME/.config/notmuchrc"
mbsyncrc="$HOME/.config/mbsyncrc"
# Run only if user logged in (prevent cron errors)
-w | grep "^$USER\W" >/dev/null || exit
+# w | grep "^$USER\W" >/dev/null || exit
# Don't run if screen is locked (gpg key is locked too)
-pidof swaylock && exit
+# pidof swaylock && exit
# Check several times before giving up, useful when just waking up from sleep
# since internet is usually not available right away
-wget -q --tries=3 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
+wget -q --tries=3 --timeout=20 --spider http://1.1.1.1 > /dev/null || exit
thereis=0
@@ -33,18 +33,16 @@ do
account="$(echo "$mailbox" | sed "s/.*\///")"
newcount=$(find "$HOME/.local/share/mail/$account/INBOX/new/" "$HOME/.local/share/mail/$account/Inbox/new/" "$HOME/.local/share/mail/$account/inbox/new/" -type f -newer "$HOME/.cache/lastmailsync" 2> /dev/null | wc -l)
if [ "$newcount" -gt "0" ]; then
- notify-send "📬 Email" "$newcount new mail(s) in \`$account\` mailbox."
+ notify-send -a "E-mail" -i mail-client "$newcount new mail(s) in \`$account\` mailbox."
thereis=1
fi
done
if [ $thereis = 1 ]; then
- mpv --really-quiet "$HOME/.local/share/soundalerts/mail.ogg"
- killall -43 waybar
+ mpv --keep-open=no --really-quiet "$HOME/.local/share/soundalerts/mail.ogg"
fi
notmuch -c "$notmuchrc" new 2>/dev/null
# Create a touch file that indicates the time of the last run of mailsync
touch "$HOME/.cache/lastmailsync"
-
diff --git a/dotfiles/.local/bin/menumako b/dotfiles/.local/bin/menumako
index 628a93a..96c564b 100755
--- a/dotfiles/.local/bin/menumako
+++ b/dotfiles/.local/bin/menumako
@@ -1,3 +1,3 @@
#!/bin/sh
-makoctl menu rofi -dmenu -p "What to do?"
+makoctl menu -- rofi -dmenu -p "What to do?"
diff --git a/dotfiles/.local/bin/menupass b/dotfiles/.local/bin/menupass
index 844ef33..76d1f18 100755
--- a/dotfiles/.local/bin/menupass
+++ b/dotfiles/.local/bin/menupass
@@ -5,7 +5,6 @@
shopt -s nullglob globstar
-notititle="🔑 Password store"
cleartime=30
lastpass_cache="$HOME/.cache/lastpass"
@@ -14,23 +13,24 @@ password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
+_notify() {
+ notify-send -a "Password store" -i dialog-password -e "$1"
+}
notify_pass() {
- notify-send \
- "$notititle" \
- "The password for $1 has been copied to the clipboard and will be cleared in 30 seconds"
+ _notify "The password for $1 has been copied to the clipboard and will be cleared in 30 seconds"
}
notify_spass() {
- notify-send "$notititle" "Password for $1: $2"
+ _notify "Password for $1: $2"
}
notify_nocache() {
- notify-send "$notititle" "No cache about previously selected login"
+ _notify "No cache about previously selected login"
}
show_menu() {
- password=$(printf '%s\n' "${password_files[@]}" | rofi -dmenu -p "$1")
+ password=$(printf '%s\n' "${password_files[@]}" | dms dmenu -p "$1")
[ -n "$password" ] || exit
}
@@ -42,14 +42,14 @@ copy_password() {
copy_login() {
thelogin=$(pass show "$1"| sed -n 2p)
wl-copy "$thelogin"
- notify-send "$notititle" "The login $thelogin has been copied to the clipboard"
+ _notify "The login $thelogin has been copied to the clipboard"
printf "%s" "$1" > $lastpass_cache
}
wait_and_clear() {
sleep $cleartime
wl-copy ""
- notify-send "🔑 Password store" "Clipboard has been cleared"
+ _notify "Clipboard has been cleared"
}
diff --git a/dotfiles/.local/bin/pacsync b/dotfiles/.local/bin/pacsync
index 2e5d60f..15f2c97 100755
--- a/dotfiles/.local/bin/pacsync
+++ b/dotfiles/.local/bin/pacsync
@@ -8,6 +8,9 @@ if pidof pacman; then
exit
fi
+napp="System upgrade"
+ni="preferences-system-linux"
+
# Check several times before giving up, useful when just waking up from sleep
# since internet is usually not available right away
wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
@@ -15,19 +18,20 @@ wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
# Source the needed env variables so that it can function properly from cron
. ~/.cache/sessionenv
-notify-send " System upgrade" "Syncing repositories and downloading packages..."
+notify-send -a "$napp" -i "$ni" -e "Syncing repositories and downloading packages..."
touch ~/.cache/pacsynclive
killall -41 waybar
-sudo pacman -Syuw --noconfirm || notify-send " System upgrade" \
- "Error downloading updates. Check your internet connection or that you have the required permissions"
+if ! sudo pacman -Syuw --noconfirm; then
+ notify-send -a "$napp" -i "$ni" -u critical -t 3000 "Error downloading updates.
+fi
rm -f ~/.cache/pacsynclive
killall -41 waybar
upno=$(pacman -Qu | wc -l)
-if [ $upno -lt 0 ]; then
- notify-send " System upgrade" "Repository sync finished. $upno updates are available"
+if [ $upno -gt 0 ]; then
+ notify-send -a "$napp" -i "$ni" "Repository sync finished. $upno updates are available"
fi
diff --git a/dotfiles/.local/bin/sshwiz b/dotfiles/.local/bin/sshwiz
new file mode 100755
index 0000000..ba71b08
--- /dev/null
+++ b/dotfiles/.local/bin/sshwiz
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# SSH "wizard" script. Copies the public key and installs terminfo for first
+# time use of a host.
+
+if [ -z "$1" ]; then
+ echo "usage: sshwiz <destination>"
+ exit 1
+fi
+
+target=$1
+
+ssh-copy-id $target
+echo "installing terminfo..."
+infocmp $TERM > /tmp/$TERM.terminfo
+rsync /tmp/$TERM.terminfo ${target}:
+ssh $target "tic -x $TERM.terminfo"
+echo "done"