summaryrefslogtreecommitdiff
path: root/ar/.local
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.local')
-rwxr-xr-xar/.local/bin/dmenuconnections9
-rwxr-xr-xar/.local/bin/extract41
2 files changed, 45 insertions, 5 deletions
diff --git a/ar/.local/bin/dmenuconnections b/ar/.local/bin/dmenuconnections
index 024e7da..cc39771 100755
--- a/ar/.local/bin/dmenuconnections
+++ b/ar/.local/bin/dmenuconnections
@@ -3,8 +3,6 @@
# initial configuration
# sudo pacman --noconfirm -S bluez-utils pulseaudio-bluetooth pulseaudio-alsa blueman
# sudo ln -vsf ${PWD}/etc/bluetooth/main.conf /etc/bluetooth/main.conf
-# sudo systemctl start bluetooth.service
-# sudo systemctl enable bluetooth.service
# Requires:
# blueman
@@ -13,14 +11,14 @@
# btmenu (https://github.com/cdown/btmenu)
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
-[ -z "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
+[ -z "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "🛜", int($3 * 100 / 70) "%" }')
wifi=$(printf "%s %s" "${wifiicon}" "$(cat /sys/class/net/w*/operstate | sed "s/down/❎/;s/up/🌐/")")
if [ -n "${wifi}" ]; then
- choice=$(printf 'bluetooth\nnetwork' | dmenu -i -p "${wifi}")
+ choice=$(printf 'bluetooth\nnetwork\nwifi' | dmenu -i -p "${wifi}")
else
- choice=$(printf 'bluetooth\nnetwork' | dmenu -i -p 'Connect:')
+ choice=$(printf 'bluetooth\nnetwork\nwifi' | dmenu -i -p 'Connect:')
fi
case "${choice}" in
@@ -33,4 +31,5 @@ bluetooth)
esac
;;
network) networkmanager_dmenu ;;
+wifi) nmcli -c no d wifi list | tail -n +2 | sed 's/ \+/ /;s/Infra [0-9]*/ /g;s/WPA. .*$//;s/Mbit\/s[[:space:]]*[0-9]*/Mbit\/s/g;s/Ad-Hoc [0-9]*//g' | dmenu -l 20 -p Networks ;;
esac
diff --git a/ar/.local/bin/extract b/ar/.local/bin/extract
new file mode 100755
index 0000000..b352a70
--- /dev/null
+++ b/ar/.local/bin/extract
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# Default behavior: Extract archive into new directory
+# Behavior with `-c` option: Extract contents into current directory
+
+while getopts "hc" o; do case "${o}" in
+ c) extracthere="True" ;;
+ *) printf 'Options:\n -c: Extract archive into current directory rather than a new one.\n' && exit ;;
+ esac done
+
+if [ -z "$extracthere" ]; then
+ archive="$(readlink -f "$*")" &&
+ directory=${archive%.*} &&
+ mkdir -p "$directory" &&
+ cd "$directory" || exit
+else
+ archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")"
+fi
+
+[ "$archive" = "" ] && printf 'Give archive to extract as argument.\n' && exit
+
+if [ -f "$archive" ]; then
+ case "$archive" in
+ *.tar.bz2 | *.tar.xz | *.tbz2) tar xvjf "$archive" ;;
+ *.tar.gz | *.tgz) tar xvzf "$archive" ;;
+ *.lzma) unlzma "$archive" ;;
+ *.bz2) bunzip2 "$archive" ;;
+ *.rar) unrar x -ad "$archive" ;;
+ *.gz) gunzip "$archive" ;;
+ *.tar) tar xvf "$archive" ;;
+ *.zip | *.jar | *.war) unzip "$archive" ;;
+ *.Z) uncompress "$archive" ;;
+ *.7z) 7z x "$archive" ;;
+ *.xz) unxz "$archive" ;;
+ *.exe) cabextract "$archive" ;;
+ *.ace) unace x "$archive" ;;
+ *) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
+ esac
+else
+ printf 'File "%s" not found.\n' "$archive"
+fi