This commit is contained in:
edwark43
2023-11-19 23:55:40 -05:00
committed by GitHub
parent f5fd9fb9f4
commit 4dc48552c7
82 changed files with 5097 additions and 2 deletions

4
misc/asciiart/blocks1 Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
pcs() { for i in {0..7}; do echo -en "\e[${1}$((30+$i))m \u2588\u2588 \e[0m"; done; }
pcsbright() { for i in {0..7}; do echo -en "\e[${1}$((90+$i))m \u2588\u2588 \e[0m"; done; }
printf "\n%s\n%s\n\n" "$(pcs)" "$(pcsbright '1;')"

145
misc/asciiart/fetch Normal file
View File

@@ -0,0 +1,145 @@
#!/usr/bin/env bash
#colors
#bold="(tput bold)"
magenta="\033[1;35m"
green="\033[1;32m"
white="\033[1;37m"
blue="\033[1;34m"
red="\033[1;31m"
black="\033[1;40;30m"
yellow="\033[1;33m"
cyan="\033[1;36m"
reset="\033[0m"
bgyellow="\033[1;43;33m"
bgwhite="\033[1;47;37m"
c0=${reset}
c1=${magenta}
c2=${green}
c3=${white}
c4=${blue}
c5=${red}
c6=${yellow}
c7=${cyan}
c8=${black}
c9=${bgyellow}
c10=${bgwhite}
# Get the kernel
# This will decide the further actionsvand command usages as bsd and gnu tools even with same name are DIFFERENT.
kernel=$(uname -o)
# Get the init
get_init() {
if pidof -q systemd; then
echo 'systemd'
elif [ -f '/sbin/openrc' ]; then
echo 'openrc'
elif [ -f '/sbin/dinit' ]; then
echo 'dinit'
else
cut -d ' ' -f 1 /proc/1/comm
fi
}
# Get count of packages installed
get_pkg_count() {
package_managers=('xbps-install' 'apk' 'port' 'apt' 'pacman' 'nix' 'dnf' 'rpm' 'emerge' 'eopkg')
for package_manager in "${package_managers[@]}"; do
if command -v "$package_manager" 2>/dev/null >&2; then
case "$package_manager" in
xbps-install) xbps-query -l | wc -l ;;
apk) apk search | wc -l ;;
apt) if [ "$kernel" != "Darwin" ]; then
echo $(($(apt list --installed 2>/dev/null | wc -l) - 1))
else
echo 0
fi
;;
pacman) pacman -Q | wc -l ;;
nix) nix-env -qa --installed '*' | wc -l ;;
dnf) dnf list installed | wc -l ;;
rpm) rpm -qa | wc -l ;;
emerge) qlist -I | wc -l ;;
port) port installed 2>/dev/null | wc -l | awk 'NR==1{print $1}' ;;
eopkg) eopkg li | wc -l ;;
esac
# if a package manager is found return from the function
return
fi
done
echo 0
}
# Get package information formatted
get_package_info() {
pkg_count=$(get_pkg_count)
if [ "$pkg_count" -ne 0 ]; then
echo -n "$pkg_count"
else
echo "Unknown"
fi
}
# Get distro name
distro() {
awk -F '"' '/PRETTY_NAME/ { print $2 }' /etc/os-release
}
# Get root partition space used
storage() {
df -h --output=used,size / | awk 'NR == 2 { print $1" / "$2 }'
}
# Get Memory usage
mem() {
free --mega | awk 'NR == 2 { print $3" / "$2" MB" }'
}
# Get uptime
get_uptime() {
uptime -p | sed 's/up//'
}
# Get DE/WM
# Reference: https://github.com/unixporn/robbb/blob/master/fetcher.sh
get_de_wm() {
wm="${XDG_CURRENT_DESKTOP#*:}"
[ "$wm" ] || wm="$DESKTOP_SESSION"
# for most WMs
[ ! "$wm" ] && [ "$DISPLAY" ] && command -v xprop >/dev/null && {
id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null)
id=${id##* }
wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t 2>/dev/null | grep '^_NET_WM_NAME' | cut -d\" -f 2)
}
# for non-EWMH WMs
[ ! "$wm" ] || [ "$wm" = "LG3D" ] && {
wms=('sway' 'kiwmi' 'wayfire' 'sowm' 'catwm' 'fvwm' 'dwm' '2bwm' 'monsterwm' 'tinywm' 'xmonad')
for current_wm in "${wms[@]}"; do
if pgrep -x "$current_wm" 2>/dev/null >&2; then
wm="${current_wm}";
break
fi
done
}
echo "${wm:-unknown}"
}
echo -e " ┏━━━━━━━━━━━━━━━━━━━━━━┓"
echo -e " ┃ ${c7}f${c4}e${c5}t${c6}${c7}c${c1}h${c0} ${c6}${c0} ${c7}${c0} ${c5}${c0} ┃"
echo -e " ┣━━━━━━━━━━━━━━━━━━━━━━┫ ${c1}━━━${c2}━━━${c3}━━━${c4}━━━${c5}━━━${c6}━━━${c7}━━━"
echo -e " ${c0} ┃ ┃ ${c1}os${c3} $(distro)"
echo -e " ┃ ${c3}•${c8}_${c3}•${c0} ┃ ${c2}ker${c3} $(uname -r)"
echo -e " ┃ ${c8}${c0}${c9}oo${c0}${c8}|${c0} ┃ ${c7}pkgs${c3} $(get_package_info)"
echo -e " ┃ ${c8}/${c0}${c10}${c0}${c8}'\'${c0} ┃ ${c5}sh${c3} ${SHELL##*/} ${c6}󰮯 ${c6}${c2}󰊠 ${c2}${c4}󰊠 ${c4}${c5}󰊠 ${c5}${c7}󰊠 ${c7}"
echo -e " ${c0} ┃ ${c9}(${c0}${c8}\_;/${c0}${c9})${c0} ┃ ${c1}ram${c3} $(mem)"
echo -e " ┃ ${c0}┃ ${c2}init${c3} $(get_init)"
echo -e " ┃ I ${c1}${c0} Arch ┃ ${c7}de/wm${c3} $(get_de_wm)"
echo -e " ┃ ┃ ${c5}up${c3} $(get_uptime)"
echo -e " ┃ ┃ ${c1}disk${c3} $(storage)"
echo -e " ┗━━━━━━━━━━━━━━━━━━━━━━┛ ${c1}━━━${c2}━━━${c3}━━━${c4}━━━${c5}━━━${c6}━━━${c7}━━━"
echo -e " "

21
misc/asciiart/zwaves Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Source: http://crunchbang.org/forums/viewtopic.php?pid=141044#p141044
f=3 b=4
for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\e[${!j}${i}m"
done
done
for i in {0..7}; do
printf -v fbright$i %b "\e[9${i}m"
done
bld=$'\e[1m'
rst=$'\e[0m'
inv=$'\e[7m'
cat << EOF
$f1▀■▄ $f2▀■▄ $f3▀■▄ $f4▀■▄ $f5▀■▄ $f6▀■▄
$bld$fbright1▀■▄ $fbright2▀■▄ $fbright3▀■▄ $fbright4▀■▄ $fbright5▀■▄ $fbright6▀■▄$rst
EOF

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" width="800" height="800" version="1.1" viewBox="0 0 512 512" xml:space="preserve"><g><path style="fill:#f2d23d" d="M256.007,423.724c-0.004,0-0.004,0-0.007,0c-14.626,0-26.483,11.857-26.483,26.483v35.31 C229.517,500.143,241.374,512,256,512c0.004,0,0.004,0,0.007,0c14.622-0.004,26.476-11.859,26.476-26.483v-35.31 C282.483,435.583,270.629,423.728,256.007,423.724z"/><path style="fill:#f2d23d" d="M256.007,0c-0.004,0-0.004,0-0.007,0c-14.626,0-26.483,11.857-26.483,26.483v35.31 c0,14.626,11.857,26.483,26.483,26.483c0.004,0,0.004,0,0.007,0c14.622-0.004,26.476-11.859,26.476-26.483v-35.31 C282.483,11.859,270.629,0.004,256.007,0z"/><path style="fill:#f2d23d" d="M256.007,141.241h-0.004c-63.276,0-114.755,51.481-114.755,114.759s51.479,114.759,114.755,114.759 h0.004c63.278-0.002,114.759-51.481,114.759-114.759C370.766,192.724,319.285,141.243,256.007,141.241z"/></g><g><path style="fill:#eebf00" d="M256.004,141.241c-63.276,0-114.755,51.481-114.755,114.76c0,63.278,51.479,114.757,114.755,114.757 h0.004V141.241H256.004z"/><path style="fill:#eebf00" d="M256.007,88.276V0c-0.004,0-0.004,0-0.007,0c-14.626,0-26.483,11.857-26.483,26.483v35.31 c0,14.626,11.857,26.483,26.483,26.483C256.004,88.276,256.004,88.276,256.007,88.276z"/><path style="fill:#eebf00" d="M256,423.724c-14.626,0-26.483,11.857-26.483,26.483v35.31C229.517,500.143,241.374,512,256,512 c0.004,0,0.004,0,0.007,0v-88.276C256.004,423.724,256.004,423.724,256,423.724z"/></g><path style="fill:#f2d23d" d="M423.724,256c0,14.626,11.857,26.483,26.483,26.483h35.31C500.143,282.483,512,270.626,512,256 c0-14.626-11.857-26.483-26.483-26.483h-35.31C435.581,229.517,423.724,241.374,423.724,256z"/><path style="fill:#eebf00" d="M26.483,282.483h35.31c14.626,0,26.483-11.857,26.483-26.483c0-14.626-11.857-26.483-26.483-26.483 h-35.31C11.857,229.517,0,241.374,0,256C0,270.626,11.857,282.483,26.483,282.483z"/><path style="fill:#f2d23d" d="M399.567,74.98l-24.97,24.968c-10.342,10.342-10.342,27.11,0,37.452 c5.171,5.171,11.949,7.758,18.725,7.758s13.556-2.586,18.725-7.756l24.97-24.968c10.342-10.342,10.342-27.11,0-37.452 C426.68,64.637,409.911,64.637,399.567,74.98z"/><path style="fill:#eebf00" d="M99.949,374.597l-24.968,24.968c-10.342,10.342-10.342,27.109,0,37.452 c5.171,5.171,11.949,7.756,18.725,7.756s13.556-2.586,18.725-7.756l24.97-24.968c10.342-10.342,10.342-27.11,0-37.452 C127.061,364.256,110.292,364.254,99.949,374.597z"/><path style="fill:#f2d23d" d="M399.567,437.018c5.171,5.171,11.949,7.756,18.725,7.756c6.778,0,13.556-2.585,18.727-7.756 c10.342-10.342,10.342-27.11,0-37.452l-24.97-24.968c-10.341-10.341-27.11-10.341-37.452,0.002 c-10.342,10.342-10.342,27.109,0,37.452L399.567,437.018z"/><path style="fill:#eebf00" d="M99.949,137.401c5.171,5.171,11.949,7.756,18.727,7.756c6.778,0,13.556-2.586,18.725-7.758 c10.342-10.342,10.342-27.11,0-37.452L112.433,74.98c-10.341-10.341-27.11-10.341-37.452,0c-10.342,10.342-10.342,27.11,0,37.452 L99.949,137.401z"/></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
misc/assets/fallback.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
misc/assets/mute.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

1
misc/assets/reload.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" width="800" height="800" version="1.1" viewBox="0 0 512 512" xml:space="preserve"><circle style="fill:#a5eb78" cx="256.005" cy="256.005" r="247.556"/><path style="opacity:.1;enable-background:new" d="M53.508,289.795c0-136.719,110.832-247.551,247.551-247.551 c45.567,0,88.25,12.325,124.92,33.802C381.637,34.146,321.823,8.449,256,8.449C119.281,8.449,8.449,119.281,8.449,256 c0,91.152,49.273,170.784,122.631,213.748C83.318,424.618,53.508,360.691,53.508,289.795z"/><g><path style="fill:#fff" d="M391.375,234.761L366.4,94.714l-35.529,35.529c-22.076-13.136-47.765-20.559-74.872-20.559 c-36.924,0-72.186,13.795-99.289,38.842c-26.941,24.899-43.46,58.683-46.514,95.13l67.354,5.644 c1.64-19.572,10.53-37.733,25.035-51.137c14.577-13.473,33.547-20.892,53.414-20.892c8.352,0,16.447,1.322,24.075,3.767 l-28.749,28.749L391.375,234.761z"/><path style="fill:#fff" d="M110.197,277.238l24.975,140.049l35.529-35.529c22.076,13.136,47.765,20.559,74.872,20.559 c36.924,0,72.186-13.795,99.289-38.842c26.941-24.899,43.46-58.683,46.514-95.13l-67.354-5.644 c-1.64,19.572-10.53,37.733-25.035,51.137c-14.577,13.473-33.547,20.892-53.414,20.892c-8.352,0-16.447-1.323-24.075-3.767 l28.749-28.749L110.197,277.238z"/></g><path d="M256,512c-68.38,0-132.667-26.629-181.019-74.981C26.629,388.667,0,324.38,0,256c0-75.008,32.755-145.994,89.866-194.758 c3.548-3.029,8.881-2.61,11.911,0.938c3.03,3.548,2.609,8.881-0.938,11.911C47.493,119.642,16.897,185.943,16.897,256 c0,131.841,107.261,239.103,239.103,239.103c55.438,0,109.469-19.406,152.142-54.641c3.597-2.972,8.923-2.463,11.895,1.135 c2.971,3.598,2.462,8.923-1.135,11.895C373.208,491.221,315.356,512,256,512z"/><path d="M438.06,432.164c-2.047,0-4.099-0.739-5.724-2.236c-3.431-3.163-3.649-8.507-0.487-11.938 c40.789-44.256,63.252-101.784,63.252-161.989C495.103,124.159,387.841,16.897,256,16.897c-45.761,0-90.232,12.968-128.607,37.501 c-3.929,2.513-9.155,1.364-11.668-2.567s-1.364-9.155,2.567-11.668C159.389,13.887,207.008,0,256,0 c68.38,0,132.667,26.629,181.019,74.981S512,187.62,512,256c0,64.461-24.053,126.056-67.725,173.441 C442.61,431.248,440.338,432.164,438.06,432.164z"/><path d="M177.56,257.748c-0.237,0-0.474-0.01-0.714-0.03l-67.354-5.644c-4.65-0.39-8.104-4.474-7.714-9.125 c3.231-38.557,20.703-74.295,49.198-100.63c28.669-26.496,65.968-41.087,105.023-41.087c25.686,0,50.937,6.375,73.441,18.491 l30.985-30.985c2.226-2.225,5.502-3.028,8.507-2.086c3.003,0.944,5.232,3.479,5.784,6.576l24.975,140.049 c0.486,2.719-0.39,5.504-2.343,7.457c-1.952,1.953-4.737,2.831-7.457,2.343l-140.049-24.975c-3.098-0.552-5.632-2.781-6.576-5.784 c-0.943-3.003-0.14-6.281,2.086-8.507l17.735-17.735c-2.351-0.238-4.717-0.357-7.088-0.357c-17.736,0-34.67,6.623-47.681,18.648 c-12.949,11.967-20.886,28.174-22.349,45.637C185.599,254.415,181.906,257.748,177.56,257.748z M119.58,235.963l50.667,4.246 c3.373-18.447,12.638-35.343,26.605-48.251c16.143-14.919,37.149-23.136,59.149-23.136c9.049,0,18.016,1.402,26.653,4.169 c2.805,0.899,4.94,3.194,5.634,6.056s-0.154,5.88-2.237,7.963l-17.299,17.299l112.181,20.005l-20.006-112.18l-24.08,24.08 c-2.732,2.734-6.971,3.263-10.295,1.286c-21.296-12.673-45.692-19.371-70.55-19.371c-34.791,0-68.017,12.997-93.554,36.598 C139.142,176.268,124.114,204.857,119.58,235.963z"/><path d="M135.171,425.735c-0.846,0-1.7-0.127-2.532-0.389c-3.003-0.944-5.233-3.479-5.785-6.576L101.88,278.721 c-0.486-2.719,0.39-5.504,2.343-7.457c1.952-1.953,4.736-2.832,7.457-2.343l140.049,24.975c3.098,0.552,5.632,2.781,6.576,5.784 c0.943,3.003,0.14,6.281-2.086,8.507l-17.735,17.735c2.351,0.238,4.717,0.357,7.088,0.357c17.736,0,34.67-6.623,47.681-18.648 c12.949-11.967,20.886-28.174,22.349-45.637c0.39-4.649,4.477-8.101,9.125-7.713l67.354,5.644c4.65,0.39,8.104,4.474,7.714,9.125 c-3.231,38.557-20.702,74.295-49.198,100.63c-28.669,26.496-65.968,41.087-105.023,41.087c-25.686,0-50.937-6.375-73.441-18.491 l-30.985,30.985C139.537,424.87,137.379,425.735,135.171,425.735z M120.642,287.682l20.005,112.181l24.08-24.08 c2.733-2.734,6.972-3.261,10.295-1.286c21.296,12.673,45.692,19.371,70.551,19.371c34.791,0,68.017-12.997,93.554-36.598 c23.305-21.537,38.332-50.127,42.866-81.234l-50.667-4.246c-3.373,18.447-12.638,35.343-26.605,48.251 c-16.142,14.919-37.149,23.136-59.149,23.136c-9.049,0-18.016-1.402-26.653-4.169c-2.805-0.899-4.94-3.194-5.634-6.056 c-0.694-2.862,0.154-5.88,2.237-7.963l17.299-17.299L120.642,287.682z"/></svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" fill="none" viewBox="-4.8 -4.8 57.6 57.6"><g id="SVGRepo_iconCarrier"><path stroke="#f6f5f4" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M16 6H8C6.89543 6 6 6.89543 6 8V16"/><path stroke="#f6f5f4" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M16 42H8C6.89543 42 6 41.1046 6 40V32"/><path stroke="#f6f5f4" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M32 42H40C41.1046 42 42 41.1046 42 40V32"/><path stroke="#f6f5f4" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M32 6H40C41.1046 6 42 6.89543 42 8V16"/><rect width="20" height="20" x="14" y="14" fill="#e01b24" stroke="#f6f5f4" stroke-width="4" rx="2"/></g></svg>

After

Width:  |  Height:  |  Size: 765 B

BIN
misc/assets/vol.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

27
misc/bin/brightness Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Originally created by - https://github.com/rxyhn
DIR="$HOME/.local/share/assets"
BRIGHTNESS_STEPS=5
function get_brightness {
brightnessctl i | grep -oP '\(\K[^%\)]+'
}
function send_notification {
icon="$DIR/brightness.svg"
brightness=$(get_brightness)
bar=$(seq -s "─" 0 $((brightness / 5)) | sed 's/[0-9]//g')
dunstify "Brightness $brightness%" -i $icon -r 5555 -u normal -h int:value:$(($brightness))
}
case $1 in
up)
brightnessctl set "${BRIGHTNESS_STEPS:-5}%+" -q
send_notification
;;
down)
brightnessctl set "${BRIGHTNESS_STEPS:-5}%-" -q
send_notification
;;
esac

9
misc/bin/bsphidenode Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
NHidden=$(bspc query -N -n .hidden -d focused)
if [ -z "$NHidden" ]; then
bspc node focused -g hidden=on
else
bspc node "$NHidden" -g hidden=off
fi

160
misc/bin/colorscript Normal file
View File

@@ -0,0 +1,160 @@
#!/usr/bin/env bash
# Simple CLI for shell-color-scripts
if [[ "$DEV" -gt 0 ]]; then
DIR_COLORSCRIPTS="./colorscripts"
else
DIR_COLORSCRIPTS="$HOME/.local/share/asciiart"
fi
if command -v find &>/dev/null; then
LS_CMD="$(command -v find) ${DIR_COLORSCRIPTS} -maxdepth 1 -type f"
LS_CMD_B="$(command -v find) ${DIR_COLORSCRIPTS}/blacklisted -maxdepth 1 -type f"
else
LS_CMD="$(command -v ls) ${DIR_COLORSCRIPTS}"
LS_CMD_B="$(command -v ls) ${DIR_COLORSCRIPTS}/blacklisted"
fi
list_colorscripts="$($LS_CMD | xargs -I $ basename $ | cut -d ' ' -f 1 | nl)"
length_colorscripts="$($LS_CMD | wc -l)"
list_blacklist="$($LS_CMD_B 2>/dev/null | xargs -I $ basename $ | cut -d ' ' -f 1 | nl || "")"
length_blacklist="$($LS_CMD_B 2>/dev/null | wc -l || 0)"
fmt_help=" %-20s\t%-54s\n"
function _help() {
echo "Description: A collection of terminal color scripts."
echo ""
echo "Usage: colorscript [OPTION] [SCRIPT NAME/INDEX]"
printf "${fmt_help}" \
"-h, --help, help" "Print this help." \
"-l, --list, list" "List all installed color scripts." \
"-r, --random, random" "Run a random color script." \
"-e, --exec, exec" "Run a specified color script by SCRIPT NAME or INDEX."\
"-b, --blacklist, blacklist" "Blacklist a color script by SCRIPT NAME or INDEX." \
"-u, --unblacklist, unblacklist" "Unblacklist a color script by SCRIPT NAME or INDEX." \
"-a, --all, all" "List the outputs of all colorscripts with their SCRIPT NAME"
}
function _list() {
echo "There are "$($LS_CMD | wc -l)" installed color scripts:"
echo "${list_colorscripts}"
}
function _list_blacklist() {
echo "There are $length_blacklist blacklisted color scripts:"
echo "${list_blacklist}"
}
function _random() {
declare -i random_index=$RANDOM%$length_colorscripts
[[ $random_index -eq 0 ]] && random_index=1
random_colorscript="$(echo "${list_colorscripts}" | sed -n ${random_index}p \
| tr -d ' ' | tr '\t' ' ' | cut -d ' ' -f 2)"
# echo "${random_colorscript}"
exec "${DIR_COLORSCRIPTS}/${random_colorscript}"
}
function ifhascolorscipt() {
[[ -e "${DIR_COLORSCRIPTS}/$1" ]] && echo "Has this color script."
}
function _run_by_name() {
if [[ "$1" == "random" ]]; then
_random
elif [[ -n "$(ifhascolorscipt "$1")" ]]; then
exec "${DIR_COLORSCRIPTS}/$1"
else
echo "Input error, Don't have color script named $1."
exit 1
fi
}
function _run_by_index() {
if [[ "$1" -gt 0 && "$1" -le "${length_colorscripts}" ]]; then
colorscript="$(echo "${list_colorscripts}" | sed -n ${1}p \
| tr -d ' ' | tr '\t' ' ' | cut -d ' ' -f 2)"
exec "${DIR_COLORSCRIPTS}/${colorscript}"
else
echo "Input error, Don't have color script indexed $1."
exit 1
fi
}
function _run_colorscript() {
if [[ "$1" =~ ^[0-9]+$ ]]; then
_run_by_index "$1"
else
_run_by_name "$1"
fi
}
function _run_all() {
for s in $DIR_COLORSCRIPTS/*
do
echo "$(echo $s | awk -F '/' '{print $NF}'):"
echo "$($s)"
echo
done
}
function _blacklist_colorscript() { # by name only
if [ ! -d "${DIR_COLORSCRIPTS}/blacklisted" ]; then
sudo mkdir "${DIR_COLORSCRIPTS}/blacklisted"
fi
sudo mv "${DIR_COLORSCRIPTS}/$1" "${DIR_COLORSCRIPTS}/blacklisted"
}
function _unblacklist_colorscript() { # by name only
if [ -f "${DIR_COLORSCRIPTS}/blacklisted/$1" ]; then
sudo mv "${DIR_COLORSCRIPTS}/blacklisted/$1" "${DIR_COLORSCRIPTS}"
else
echo "Input error. Script $1 is not blacklisted!"
fi
}
case "$#" in
0)
_help
;;
1)
case "$1" in
-h | --help | help)
_help
;;
-l | --list | list)
_list
;;
-b | --blacklist | blacklist)
_list_blacklist
;;
-r | --random | random)
_random
;;
-a | --all | all)
_run_all
;;
*)
echo "Input error."
exit 1
;;
esac
;;
2)
if [[ "$1" == "-e" || "$1" == "--exec" || "$1" == "exec" ]]; then
_run_colorscript "$2"
elif [[ "$1" == "-b" || "$1" == "--blacklist" || "$1" == "blacklist" ]]; then
_blacklist_colorscript "$2"
elif [[ "$1" == "-u" || "$1" == "--unblacklist" || "$1" == "unblacklist" ]]; then
_unblacklist_colorscript "$2"
else
echo "Input error."
exit 1
fi
;;
*)
echo "Input error, too many arguments."
exit 1
;;
esac

32
misc/bin/externalrules Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
wid=$1
class=$2
instance=$3
consequences=$4
case "$class" in
floaterm)
eval "$consequences"
[ "$state" ] || echo "state=floating center=on"
;;
updating)
eval "$consequences"
[ "$state" ] || echo "state=floating sticky=on center=on"
;;
mpv)
eval "$consequences"
[ "$state" ] || echo "state=pseudo_tiled focus=on rectangle=849x477+0+0 center=on"
;;
virt-manager)
eval "$consequences"
[ "$state" ] || echo "state=floating desktop=^5 follow=on center=on"
;;
esac
case "$instance" in
Toolkit)
eval "$consequences"
[ "$state" ] || echo "state=floating sticky=on rectangle=500x290+1054+593"
;;
esac

21
misc/bin/hidebar Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
function hide() {
polybar-msg cmd hide | bspc config top_padding 2 | bspc config bottom_padding 2
}
function unhide() {
polybar-msg cmd show | bspc config top_padding 48 | bspc config bottom_padding 48
}
case $1 in
-h | --hide | hide)
hide
exit;;
-u | --unhide | unhide)
unhide
exit;;
*)
echo "Error: Invalid option"
exit;;
esac

4
misc/bin/keybindingshelp Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
awk '/^[a-z]/ && last {print $0,"\t",last} {last=""} /^#/{last=$0}' ~/.config/sxhkd/sxhkdrc | \
column -t -s $'\t' | rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15 -yoffset 40

132
misc/bin/mediacontrol Normal file
View File

@@ -0,0 +1,132 @@
#!/usr/bin/env bash
# Set the player
[ -n "$(pgrep spotify)" ] && Control="spotify" || Control="MPD"
Cover=/tmp/cover.png
bkpCover=~/.local/share/assets/fallback.webp
mpddir=~/music
case $Control in
MPD)
case $1 in
--next)
mpc -q next
;;
--previous)
mpc -q prev
;;
--toggle)
mpc -q toggle
;;
--stop)
mpc -q stop
;;
--title)
title=$(mpc -f %title% current)
echo "${title:-Play Something}"
;;
--artist)
artist=$(mpc -f %artist% current)
echo "${artist:-No Artist}"
;;
--status)
status=$(mpc status | head -2 | tail -1 | cut -c2-8 | sed 's/]//g' | sed 's/./\U&/')
echo "${status:-Stopped}"
;;
--player)
echo "$Control"
;;
--cover)
ffmpeg -i "$mpddir"/"$(mpc current -f %file%)" "${Cover}" -y &> /dev/null || cp $bkpCover $Cover
echo "$Cover"
;;
nccover)
ffmpeg -i "$mpddir"/"$(mpc current -f %file%)" "${Cover}" -y &> /dev/null || cp $bkpCover $Cover
;;
--position)
position=$(mpc status %currenttime%)
echo "${position:-0:00}"
;;
--positions)
positions=$(mpc status %currenttime% | awk -F: '{print ($1 * 60) + $2}')
echo "${positions:-0}"
;;
--length)
length=$(mpc status %totaltime%)
echo "${length:-0:00}"
;;
--lengths)
lengths=$(mpc status %totaltime% | awk -F: '{print ($1 * 60) + $2}')
echo "${lengths:-0}"
;;
--shuffle)
shuffle=$(mpc status | sed -n '3s/.*random: \([^ ]*\).*/\1/p' | sed 's/.*/\u&/')
echo "${shuffle:-Off}"
;;
--loop)
loop=$(mpc status | sed -n '3s/.*repeat: \([^ ]*\).*/\1/p' | sed 's/.*/\u&/')
echo "${loop:-Off}"
;;
esac
;;
*)
case $1 in
--next)
playerctl --player=$Control next
;;
--previous)
playerctl --player=$Control previous
;;
--toggle)
playerctl --player=$Control play-pause
;;
--stop)
playerctl --player=$Control stop
;;
--title)
title=$(playerctl --player=$Control metadata --format {{title}})
echo "${title:-Play Something}"
;;
--artist)
artist=$(playerctl --player=$Control metadata --format {{artist}})
echo "${artist:-No Artist}"
;;
--status)
status=$(playerctl --player=$Control status)
echo "${status:-Stopped}"
;;
--player)
echo "$Control"
;;
--cover)
albumart="$(playerctl --player=$Control metadata mpris:artUrl | sed -e 's/open.spotify.com/i.scdn.co/g')"
[ $(playerctl --player=$Control metadata mpris:artUrl) ] && curl -s "$albumart" --output $Cover || cp $bkpCover $Cover
echo "$Cover"
;;
--position)
position=$(playerctl --player=$Control position --format "{{ duration(position) }}")
echo "${position:-0:00}"
;;
--positions)
positions=$(playerctl --player=$Control position | sed 's/..\{6\}$//')
echo "${positions:-0}"
;;
--length)
length=$(playerctl --player=$Control metadata --format "{{ duration(mpris:length) }}")
echo "${length:-0:00}"
;;
--lengths)
lengths=$(playerctl --player=$Control metadata mpris:length | sed 's/.\{6\}$//')
echo "${lengths:-0}"
;;
--shuffle)
shuffle=$(playerctl --player=$Control shuffle)
echo "${shuffle:-Off}"
;;
--loop)
loop=$(playerctl --player=$Control loop)
echo "${loop:-None}"
;;
esac
esac 2>/dev/null

37
misc/bin/openapp Normal file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
case "$1" in
--menu)
rofi -show drun -theme $HOME/.config/rofi/launcher.rasi
;;
--terminal)
alacritty
;;
--floating)
alacritty --class floaterm,alacritty -o window.dimensions.lines=22 window.dimensions.columns=90
;;
--update)
alacritty --hold --class floaterm,alacritty -o window.dimensions.lines=22 window.dimensions.columns=90 -e updates --update-system
;;
--checkupdates)
alacritty --hold --class updating,alacritty -o window.dimensions.lines=22 window.dimensions.columns=47 -e updates --print-updates
;;
--ranger)
alacritty --class alacritty -e ranger
;;
--nvim)
alacritty -e nvim
;;
--music)
alacritty --class floaterm,alacritty -o window.dimensions.lines=18 window.dimensions.columns=67 -e ncmpcpp
;;
--fetch)
alacritty --hold --class floaterm,alacritty -o window.dimensions.lines=21 window.dimensions.columns=90 -e neofetch
;;
--browser)
brave
;;
*)
echo "Not a Valid Option"
;;
esac

42
misc/bin/screenshoter Normal file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
timestamp=$(date +%d_%m_%Y-%I-%M-%S)
dir="$(xdg-user-dir PICTURES)/screenshots"
filename="$dir/screenshot-${timestamp}.png"
[ -d "$dir" ] || mkdir -p "$dir"
show_notification() {
dunstify --replace=699 -i "$1" "Screenshot" "$2"
}
countdown() {
for sec in $(seq "$1" -1 1); do
dunstify -t 1000 --replace=699 -i ~/.local/misc/share/assets/screenshot.svg "Taking shot in : $sec"
sleep 1
done
}
take_screenshot() {
maim -u "$filename"
xclip -selection clipboard -t image/png -i "$filename"
show_notification "$filename" "$1"
}
case $1 in
--now)
take_screenshot "Screensot saved and copied to clipboard";;
--in10)
countdown 10
take_screenshot "Scheduled capture taken after 10 seconds and copied to clipboard";;
--sel)
maim -u -s "$filename"
xclip -selection clipboard -t image/png -i "$filename"
show_notification "$filename" "Screenshot of selected area saved and copied to clipboard";;
--active)
maim -u -i "$(xdotool getactivewindow)" "$filename"
xclip -selection clipboard -t image/png -i "$filename"
show_notification "$filename" "Screenshot of active window saved and copied to clipboard";;
*)
take_screenshot "Screensot saved and copied to clipboard";;
esac

48
misc/bin/setsysvars Normal file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
SFILE="$HOME/.local/bin/.sys"
function get_values() {
DEFNETWORK=$(ip route | grep '^default' | awk '{print $5}' | head -n1)
CARD=$(ls -1 /sys/class/backlight/)
power_supply_files=$(ls /sys/class/power_supply/)
for file in $power_supply_files
do
if [ -e "/sys/class/power_supply/$file/capacity" ]; then
battery_file=$file
fi
if [ -e "/sys/class/power_supply/$file/online" ]; then
adapter_file=$file
fi
done
BATTERY="$battery_file"
ADAPTER="$adapter_file"
}
function set_values() {
if [[ "$DEFNETWORK" ]]; then
sed -i -e "s/sys_network_interface = .*/sys_network_interface = $DEFNETWORK/g" $HOME/.config/polybar/system.ini
fi
if [[ "$ADAPTER" ]]; then
sed -i -e "s/sys_adapter = .*/sys_adapter = $ADAPTER/g" $HOME/.config/polybar/system.ini
fi
if [[ "$BATTERY" ]]; then
sed -i -e "s/sys_battery = .*/sys_battery = $BATTERY/g" $HOME/.config/polybar/system.ini
fi
if [[ "$CARD" ]]; then
sed -i -e "s/sys_graphics_card = .*/sys_graphics_card = $CARD/g" $HOME/.config/polybar/system.ini
fi
}
if [[ ! -f "$SFILE" ]]; then
get_values
set_values
touch "$SFILE"
fi

45
misc/bin/updates Normal file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
get_total_updates() {
local total_updates=$(($(checkupdates 2> /dev/null | wc -l || echo 0) + $(yay -Qua 2> /dev/null | wc -l || echo 0)))
echo "${total_updates:-0}"
}
get_list_updates() {
echo -e "\033[1m\033[34mRegular updates:\033[0m"
checkupdates | sed 's/->/\x1b[32;1m\x1b[0m/g'
}
get_list_aur_updates() {
echo -e "\n\033[1m\033[34mAur updates available:\033[0m"
yay -Qua | sed 's/->/\x1b[32;1m\x1b[0m/g'
}
print_updates() {
local print_updates=$(get_total_updates)
if [[ "$print_updates" -gt 0 ]]; then
echo -e "\033[1m\033[33mThere are $print_updates updates available:\033[0m\n"
get_list_updates
get_list_aur_updates
else
echo -e "\033[1m\033[32mYour system is already updated!\033[0m"
fi
}
update_system() {
yay -Syu --nocombinedupgrade --noconfirm
echo -e "\033[1m\033[32mFinished!\033[0m"
}
case "$1" in
--get-updates)get_total_updates;;
--print-updates)print_updates;;
--update-system)update_system;;
--help|*)echo -e "Updates [options]
Options:
--get-updates Get the numer of updates available.
--print-updates Print the available package to updates.
--update-system Update your system including AUR.\n"
esac

58
misc/bin/volume Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Icons
vol_dir="$HOME/.local/share/assets"
notify_cmd='dunstify -u low -h string:x-dunst-stack-tag:cvolum'
# Get Volume
get_volume() {
pamixer --get-volume-human | sed 's/%//'
}
# Get icons
get_icon() {
current="$(get_volume)"
if [[ "$current" -eq "0" || "$current" == "muted" ]]; then
icon="$vol_dir/mute.png"
else
icon="$vol_dir/vol.png"
fi
}
# Notify
notify_user() {
${notify_cmd} -i "$icon" "Volume : $(get_volume)%"
}
# Adjust Volume
adjust_volume() {
[[ $(pamixer --get-mute) == true ]] && pamixer -u
pamixer --allow-boost --set-limit 150 "$1" "$2" && get_icon && notify_user
}
# Toggle Mute
toggle_mute() {
if [[ $(pamixer --get-mute) == false ]]; then
pamixer --toggle-mute
get_icon
message="Mute"
else
pamixer --toggle-mute
get_icon
message="Unmute"
fi
${notify_cmd} -i "$icon" "$message"
}
# Execute accordingly
if command -v pamixer &>/dev/null; then
case "$1" in
--get) get_volume ;;
--inc) adjust_volume -i 5 ;;
--dec) adjust_volume -d 5 ;;
--toggle) toggle_mute ;;
*) echo "$(get_volume)%" ;;
esac
else
${notify_cmd} "'pamixer' is not installed."
fi

132
misc/bin/weather Normal file
View File

@@ -0,0 +1,132 @@
#!/usr/bin/env bash
encode_to_url_format() {
echo "$1" | sed 's/ /%20/g'
}
check_if_empty() {
[[ -z "$1" ]] && echo "0" || echo "$1"
}
KEY="699a48531cdd445784916ed7a7ca80e6"
CITY="Virginia Beach"
CITYN=$(encode_to_url_format "$CITY")
UNITS="imperial" # Available "metric" "imperial"
WEATHER=$(curl -sf "api.openweathermap.org/data/2.5/weather?q=$CITYN&appid=$KEY&units=$UNITS")
WEATHER_DESC=$(echo "$WEATHER" | jq -r ".weather[0].main")
WEATHER_TEMP=$(echo "$WEATHER" | jq ".main.temp" | cut -d "." -f 1)
WEATHER_ICON_CODE=$(echo "$WEATHER" | jq -r ".weather[].icon" | head -1)
WEATHER_FEELS_LIKE=$(echo "$WEATHER" | jq ".main.feels_like" | cut -d "." -f 1)
WEATHER_ICON=""
WEATHER_HEX=""
case $WEATHER_ICON_CODE in
"01d")
WEATHER_ICON=""
WEATHER_HEX="#ffd86b"
;;
"01n")
WEATHER_ICON=""
WEATHER_HEX="#fcdcf6"
;;
"02d")
WEATHER_ICON=""
WEATHER_HEX="#adadff"
;;
"02n")
WEATHER_ICON=""
WEATHER_HEX="#adadff"
;;
"03d")
WEATHER_ICON=""
WEATHER_HEX="#adadff"
;;
"03n")
WEATHER_ICON=""
WEATHER_HEX="#adadff"
;;
"04d")
WEATHER_ICON=""
WEATHER_HEX="#adadff"
;;
"04n")
WEATHER_ICON=""
WEATHER_HEX="#acb0d0"
;;
"09d")
WEATHER_ICON=""
WEATHER_HEX="#6b95ff"
;;
"09n")
WEATHER_ICON=""
WEATHER_HEX="#6b95ff"
;;
"10d")
WEATHER_ICON=""
WEATHER_HEX="#6b95ff"
;;
"10n")
WEATHER_ICON=""
WEATHER_HEX="#6b95ff"
;;
"11d")
WEATHER_ICON=""
WEATHER_HEX="#ffeb57"
;;
"11n")
WEATHER_ICON=""
WEATHER_HEX="#ffeb57"
;;
"13d")
WEATHER_ICON=""
WEATHER_HEX="#e3e6fc"
;;
"13n")
WEATHER_ICON=""
WEATHER_HEX="#e3e6fc"
;;
"40d")
WEATHER_ICON=""
WEATHER_HEX="#84afdb"
;;
"40n")
WEATHER_ICON=""
WEATHER_HEX="#84afdb"
;;
*)
WEATHER_ICON=""
WEATHER_HEX="#adadff"
;;
esac
case $1 in
"current_temp")
check_if_empty "$WEATHER_TEMP"
;;
"current_temp_fahrenheit")
WEATHER_TEMP=$("$WEATHER_TEMP" 9 / 5 + 32)
check_if_empty "$WEATHER_TEMP"
;;
"feels_like")
check_if_empty "$WEATHER_FEELS_LIKE"
;;
"weather_desc")
[[ -z $WEATHER_DESC ]] && echo "Not Available." || echo "$WEATHER_DESC"
;;
"icon")
echo $WEATHER_ICON
;;
"hex")
echo $WEATHER_HEX
;;
"full")
echo "$WEATHER"
;;
"city")
echo "$CITY"
;;
"wmodule")
echo $WEATHER_ICON "$WEATHER_TEMP"°
;;
esac

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.