summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bookmarks7
-rwxr-xr-xscripts/change_wallpaper8
-rwxr-xr-xscripts/checkmail8
-rwxr-xr-xscripts/murder3
-rwxr-xr-xscripts/passmenu-otp32
-rwxr-xr-xscripts/rdp19
-rwxr-xr-xscripts/rdpmenu5
-rwxr-xr-xscripts/safeedit19
-rwxr-xr-xscripts/sshmenu7
-rwxr-xr-xscripts/syncmail17
-rwxr-xr-xscripts/weather3
11 files changed, 128 insertions, 0 deletions
diff --git a/scripts/bookmarks b/scripts/bookmarks
new file mode 100755
index 0000000..cb0c192
--- /dev/null
+++ b/scripts/bookmarks
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+readarray -t bookmarks < $MENULAUNCHER_DIR/bookmarks
+
+url=$(printf '%s\n' "${bookmarks[@]}" | dmenu -p "Bookmark: " -i -l 16 | sed 's/^.*: //g')
+
+[[ ! -z "$url" ]] && firefox --new-tab $url
diff --git a/scripts/change_wallpaper b/scripts/change_wallpaper
new file mode 100755
index 0000000..57895b3
--- /dev/null
+++ b/scripts/change_wallpaper
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+wallpaper=$(ls ~/pictures/wallpapers/ | dmenu -p "Wallpaper: " -i -l 16)
+
+cd ~/pictures
+rm -f wallpaper
+ln -s "wallpapers/$wallpaper" wallpaper
+xwallpaper --zoom ~/pictures/wallpaper &
diff --git a/scripts/checkmail b/scripts/checkmail
new file mode 100755
index 0000000..64abbe6
--- /dev/null
+++ b/scripts/checkmail
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+[ $# -lt 1 ] && echo "error: invalid usage: requires an email as an argument" && exit 1
+
+mail_address="$1"
+mail_dir="$XDG_DATA_HOME/mail/$mail_address/INBOX/new"
+
+echo "$(ls $mail_dir | wc -l) "
diff --git a/scripts/murder b/scripts/murder
new file mode 100755
index 0000000..765d565
--- /dev/null
+++ b/scripts/murder
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ps -e | fzf | awk 'OFS=" " {print $1}' | xargs kill $1
diff --git a/scripts/passmenu-otp b/scripts/passmenu-otp
new file mode 100755
index 0000000..379fd8f
--- /dev/null
+++ b/scripts/passmenu-otp
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+shopt -s nullglob globstar
+
+typeit=0
+if [[ $1 == "--type" ]]; then
+ typeit=1
+ shift
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.password-store}
+password_files=( "$prefix"/**/*.gpg )
+password_files=( "${password_files[@]#"$prefix"/}" )
+password_files=( "${password_files[@]%.gpg}" )
+
+# dmenu_cmd="wofi_style --show dmenu $@"
+dmenu_cmd="dmenu -l 12 -i $@"
+password=$(printf '%s\n' "${password_files[@]}" | $dmenu_cmd)
+
+[[ -n $password ]] || exit
+
+pass_cmd=show
+if pass show "$password" | grep -q '^otpauth://'; then
+ pass_cmd=otp
+fi
+
+if [[ $typeit -eq 0 ]]; then
+ pass $pass_cmd -c "$password" 2>/dev/null
+else
+ pass $pass_cmd "$password" | { IFS= read -r pass; printf %s "$pass"; } |
+ xdotool type --clearmodifiers --file -
+fi
diff --git a/scripts/rdp b/scripts/rdp
new file mode 100755
index 0000000..8f4ae80
--- /dev/null
+++ b/scripts/rdp
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# to be used with the rdpmenu script
+
+set -x
+
+if test -z "$1"; then
+ echo "Usage: ./rdp <server_name>"
+ exit
+fi
+
+RDP_FILE="$XDG_DATA_HOME/rdp/$1"
+CONN_SETTINGS="/size:1920x1080 /scale:140 /dynamic-resolution /from-stdin /cert:tofu /tls-seclevel:0 -grab-keyboard"
+CONN_SERVER=$(grep "server=" $RDP_FILE | sed "s/server=//")
+CONN_USER=$(grep "user=" $RDP_FILE | sed "s/user=//")
+CONN_PASS=$(grep "pass=" $RDP_FILE | sed "s/pass=//")
+CONN_DOMAIN=$(grep "domain=" $RDP_FILE | sed "s/domain=//")
+
+pass show "$CONN_PASS" | xfreerdp /v:"$CONN_SERVER" /u:"$CONN_USER" /d:"$CONN_DOMAIN" $CONN_SETTINGS
diff --git a/scripts/rdpmenu b/scripts/rdpmenu
new file mode 100755
index 0000000..0e5da33
--- /dev/null
+++ b/scripts/rdpmenu
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+server=$(ls "$XDG_DATA_HOME/rdp" | dmenu -p "Server: " -i -l 16)
+
+[ ! -z "$server" ] && rdp "$server"
diff --git a/scripts/safeedit b/scripts/safeedit
new file mode 100755
index 0000000..92841d8
--- /dev/null
+++ b/scripts/safeedit
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+[ "$#" -lt 1 ] && echo "error: invalid usage: requires an arugement" && exit 1
+
+set -e
+
+bak="$1.original"
+
+if [ -e "$bak" ]; then
+ echo -n "$bak exists! replace? (y/N): "
+ read input
+ [ ! "$input" = "y" ] && exit 0
+fi
+
+cp "$1" "$bak"
+echo "info: created backup file $bak"
+
+[ -z $EDITOR ] && echo "error: EDITOR is not set. attempting to use vi" && export EDITOR=vi
+$EDITOR "$1"
diff --git a/scripts/sshmenu b/scripts/sshmenu
new file mode 100755
index 0000000..5116a66
--- /dev/null
+++ b/scripts/sshmenu
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+readarray -t servers < $MENULAUNCHER_DIR/sshmenu
+
+server=$(printf '%s\n' "${servers[@]}" | dmenu -p "Server" -w -i -l 16 | sed 's/^.*: //g')
+
+[[ ! -z "$server" ]] && foot -e ssh -Y -X $server
diff --git a/scripts/syncmail b/scripts/syncmail
new file mode 100755
index 0000000..4660eae
--- /dev/null
+++ b/scripts/syncmail
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# notmuch search --output=files tag:archive | \
+# xargs -I {} sh -c 'mv {} ~/mail/archive/cur/$(basename $(echo {} | sed 's/,.*$//g'))'
+# notmuch tag -archive +archived -- tag:archive
+
+notmuch search --output=files --format=text0 tag:delete | xargs -r0 rm
+
+mbsync -a
+notmuch new
+
+notmuch tag +assyst -- from:assyst@hoist.tech and tag:new
+
+notmuch tag -new +inbox +unread +work -- path:work/** and tag:new
+notmuch tag -new +inbox +unread +personal -- path:personal/** and tag:new
+
+notmuch tag +inbox +unread +unknown -new -- tag:new
diff --git a/scripts/weather b/scripts/weather
new file mode 100755
index 0000000..a213aa5
--- /dev/null
+++ b/scripts/weather
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+curl -s "wttr.in/cambridge+canada?lang=fr&0" | sed 's/cambridge+canada/Cambridge/g'