diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-05-31 16:02:21 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-05-31 16:02:21 +0100 |
commit | 17348abe78e05702acaff25d6abefa96ff87b43d (patch) | |
tree | 041a980f534cbe7a10e352612f3e540417cc4280 /Scripts | |
parent | 046e0b9f0123a3c4bd8aa32431b72de486c60671 (diff) | |
parent | fdef946d6555b01b33fe496cdcd6fb293ae11eab (diff) | |
download | dotfiles-17348abe78e05702acaff25d6abefa96ff87b43d.tar.gz dotfiles-17348abe78e05702acaff25d6abefa96ff87b43d.tar.bz2 dotfiles-17348abe78e05702acaff25d6abefa96ff87b43d.zip |
Merge remote-tracking branch 'origin/master'
For desktop
Diffstat (limited to 'Scripts')
-rwxr-xr-x | Scripts/.local/scripts/cowfortune | 5 | ||||
-rwxr-xr-x | Scripts/.local/scripts/eselect | 6 | ||||
-rwxr-xr-x | Scripts/.local/scripts/folder_size | 3 | ||||
-rwxr-xr-x | Scripts/.local/scripts/labelled_terminals | 7 | ||||
-rwxr-xr-x | Scripts/.local/scripts/launch_music | 4 | ||||
-rwxr-xr-x | Scripts/.local/scripts/launch_polybar | 3 | ||||
-rwxr-xr-x | Scripts/.local/scripts/list_packages | 5 | ||||
-rwxr-xr-x | Scripts/.local/scripts/st-scripts/link-grab.sh | 23 | ||||
-rwxr-xr-x | Scripts/.local/scripts/st-scripts/output-copy.sh | 13 | ||||
-rwxr-xr-x | Scripts/.local/scripts/status/bluetooth-status | 8 | ||||
-rwxr-xr-x | Scripts/.local/scripts/status/datetime | 2 | ||||
-rwxr-xr-x | Scripts/.local/scripts/status/memory | 2 | ||||
-rwxr-xr-x | Scripts/.local/scripts/status/volume | 2 |
13 files changed, 64 insertions, 19 deletions
diff --git a/Scripts/.local/scripts/cowfortune b/Scripts/.local/scripts/cowfortune new file mode 100755 index 0000000..d78a950 --- /dev/null +++ b/Scripts/.local/scripts/cowfortune @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +cow=$(echo -e "default\ncower\nmoofasa\nmoose\nmutilated\nsatanic\nsheep\nsmall\ntux\nvader" | shuf | head -1) + +fortune | cowsay -f $cow diff --git a/Scripts/.local/scripts/eselect b/Scripts/.local/scripts/eselect index 0f2d682..7bd4016 100755 --- a/Scripts/.local/scripts/eselect +++ b/Scripts/.local/scripts/eselect @@ -9,11 +9,11 @@ case "$(printf "new\nstop\nrestart\neshell\nmail" | dmenu -p "eserver: ")" in notify-send "eselect: Halted Emacs server";; "new") notify-send "eselect: Launching Emacs"; - emacsclient -c;; + emacsclient -c -a emacs;; "eshell") notify-send "eselect: Launching Eshell"; - emacsclient -c --eval '(let ((b (or (get-buffer "*eshell*") (eshell)))) (switch-to-buffer b))';; + emacsclient -c -a emacs --eval '(let ((b (or (get-buffer "*eshell*") (eshell)))) (switch-to-buffer b))';; "mail") notify-send "eselect: Launching notmuch"; - emacsclient -c --eval '(let ((b (or (get-buffer "*notmuch-hello*") (progn (notmuch) (get-buffer "*notmuch-hello*"))))) (switch-to-buffer b))';; + emacsclient -c -a emacs --eval '(let ((b (or (get-buffer "*notmuch-hello*") (progn (notmuch) (get-buffer "*notmuch-hello*"))))) (switch-to-buffer b))';; esac diff --git a/Scripts/.local/scripts/folder_size b/Scripts/.local/scripts/folder_size deleted file mode 100755 index fe136c6..0000000 --- a/Scripts/.local/scripts/folder_size +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/sh - -du -BM -d $1 | sort -n diff --git a/Scripts/.local/scripts/labelled_terminals b/Scripts/.local/scripts/labelled_terminals new file mode 100755 index 0000000..2f72a95 --- /dev/null +++ b/Scripts/.local/scripts/labelled_terminals @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +for v in $(seq 1 $1) +do + $TERMINAL -e sh -c "figlet ${v} && echo \"Press any key to exit...\" && read" & + sleep 0.5 +done diff --git a/Scripts/.local/scripts/launch_music b/Scripts/.local/scripts/launch_music deleted file mode 100755 index 44cdad8..0000000 --- a/Scripts/.local/scripts/launch_music +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -$($TERMINAL -c 'media-term' -t 'NCM' -e ncmpcpp) & -$($TERMINAL -c 'media-term' -t 'VIS' -e vis) diff --git a/Scripts/.local/scripts/launch_polybar b/Scripts/.local/scripts/launch_polybar deleted file mode 100755 index 536873a..0000000 --- a/Scripts/.local/scripts/launch_polybar +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -killall polybar; -polybar custom-bar; diff --git a/Scripts/.local/scripts/list_packages b/Scripts/.local/scripts/list_packages index 48d655d..886292a 100755 --- a/Scripts/.local/scripts/list_packages +++ b/Scripts/.local/scripts/list_packages @@ -1,2 +1,3 @@ -#/usr/bin/env bash -pacman -Qs | fzf +#!/usr/bin/env bash + +pacman -Qs | less diff --git a/Scripts/.local/scripts/st-scripts/link-grab.sh b/Scripts/.local/scripts/st-scripts/link-grab.sh new file mode 100755 index 0000000..e8eee52 --- /dev/null +++ b/Scripts/.local/scripts/st-scripts/link-grab.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# From https://github.com/LukeSmithxyz/st + +urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)" + +urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars: + grep -aEo "$urlregex" | # grep only urls as defined above. + uniq | # Ignore neighboring duplicates. + sed "s/\(\.\|,\|;\|\!\\|\?\)$//; + s/^www./http:\/\/www\./")" # xdg-open will not detect url without http + +[ -z "$urls" ] && exit 1 + +while getopts "hoc" o +do + case "${o}" in + h) printf "Optional arguments for custom use:\\n -c: copy\\n -o: xdg-open\\n -h: Show this message\\n" && exit 1 ;; + o) chosen="$(echo "$urls" | dmenu -i -p 'Follow which url?' -l 10)" + setsid xdg-open "$chosen" >/dev/null 2>&1 & ;; + c) echo "$urls" | dmenu -i -p 'Copy which url?' -l 10 | tr -d '\n' | xclip -selection clipboard ;; + *) printf "Invalid option: -%s\\n" "$OPTARG" && exit 1 ;; + esac +done diff --git a/Scripts/.local/scripts/st-scripts/output-copy.sh b/Scripts/.local/scripts/st-scripts/output-copy.sh new file mode 100755 index 0000000..6ce52ee --- /dev/null +++ b/Scripts/.local/scripts/st-scripts/output-copy.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# From https://github.com/LukeSmithxyz/st + +# By Jaywalker and Luke + +tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX) +trap 'rm "$tmpfile"' 0 1 15 +sed -n "w $tmpfile" +sed -i 's/\x0//g' "$tmpfile" +ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)" +chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -p "Copy which command's output?" -i -l 10 | sed 's/[^^]/[&]/g; s/\^/\\^/g')" +eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')" +awk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard diff --git a/Scripts/.local/scripts/status/bluetooth-status b/Scripts/.local/scripts/status/bluetooth-status index c34694c..6de5422 100755 --- a/Scripts/.local/scripts/status/bluetooth-status +++ b/Scripts/.local/scripts/status/bluetooth-status @@ -1,9 +1,15 @@ #!/usr/bin/env sh name=$(bluetoothctl info | grep "Name" | sed 's/.*Name: //') +battery=$(bluetoothctl info | grep "Battery" | sed 's/.*(//;s/)//') if [ ! "$name" ] then echo "" else - echo "" $name; + echo -n "" $name; + if [ "$battery" ] + then + echo -n " ($battery%)" + fi + echo "" fi diff --git a/Scripts/.local/scripts/status/datetime b/Scripts/.local/scripts/status/datetime index c688bb5..65ebe14 100755 --- a/Scripts/.local/scripts/status/datetime +++ b/Scripts/.local/scripts/status/datetime @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo " $(date +'%A %d %b %R')" +echo " $(date +'%A %d %b %R')" diff --git a/Scripts/.local/scripts/status/memory b/Scripts/.local/scripts/status/memory index fae4dea..2d1c328 100755 --- a/Scripts/.local/scripts/status/memory +++ b/Scripts/.local/scripts/status/memory @@ -11,4 +11,4 @@ then emacs="N/A" fi -echo "⾎ $(printf "%dMB" $used) $value% -> $emacs" +echo "⾝ $(printf "%dMB" $used) $value% -> $emacs" diff --git a/Scripts/.local/scripts/status/volume b/Scripts/.local/scripts/status/volume index eedd657..4355094 100755 --- a/Scripts/.local/scripts/status/volume +++ b/Scripts/.local/scripts/status/volume @@ -1,2 +1,2 @@ #!/usr/bin/env bash -echo "" $(pamixer --get-volume-human) +echo " $(pamixer --get-volume-human)" |