diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/.local/bin/fetch | 91 | ||||
| -rwxr-xr-x | bin/.local/bin/shut | 11 |
2 files changed, 63 insertions, 39 deletions
diff --git a/bin/.local/bin/fetch b/bin/.local/bin/fetch index 609850c..93d7fc7 100755 --- a/bin/.local/bin/fetch +++ b/bin/.local/bin/fetch | |||
| @@ -1,63 +1,76 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # | 2 | # |
| 3 | # ufetch-arch - tiny system info for arch | 3 | # ufetch-gentoo - tiny system info for gentoo |
| 4 | 4 | ||
| 5 | ## INFO | 5 | ## INFO |
| 6 | 6 | ||
| 7 | # user is already defined | 7 | # user is already defined |
| 8 | host="$(hostname)" | 8 | host="$(hostname)" |
| 9 | os='Arch Linux' | 9 | os='Gentoo Linux' |
| 10 | kernel="$(uname -sr)" | 10 | kernel="$(uname -sr)" |
| 11 | uptime="$(uptime -p | sed 's/up //')" | 11 | uptime="$(uptime -p | sed 's/up //')" |
| 12 | packages="$(pacman -Q | wc -l)" | 12 | packages="$(ls -d /var/db/pkg/*/* | wc -l)" |
| 13 | shell="$(basename ${SHELL})" | 13 | shell="$(basename "$SHELL")" |
| 14 | 14 | ||
| 15 | if [ -z "${WM}" ]; then | 15 | ## UI DETECTION |
| 16 | if [ "${XDG_CURRENT_DESKTOP}" ]; then | 16 | |
| 17 | envtype='DE' | 17 | if [ -n "${DE}" ]; then |
| 18 | WM="${XDG_CURRENT_DESKTOP}" | 18 | ui="${DE}" |
| 19 | elif [ "${DESKTOP_SESSION}" ]; then | 19 | uitype='DE' |
| 20 | envtype='DE' | 20 | elif [ -n "${WM}" ]; then |
| 21 | WM="${DESKTOP_SESSION}" | 21 | ui="${WM}" |
| 22 | else | 22 | uitype='WM' |
| 23 | envtype='WM' | 23 | elif [ -n "${XDG_CURRENT_DESKTOP}" ]; then |
| 24 | WM="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)" | 24 | ui="${XDG_CURRENT_DESKTOP}" |
| 25 | fi | 25 | uitype='DE' |
| 26 | elif [ -n "${DESKTOP_SESSION}" ]; then | ||
| 27 | ui="${DESKTOP_SESSION}" | ||
| 28 | uitype='DE' | ||
| 29 | elif [ -f "${HOME}/.xinitrc" ]; then | ||
| 30 | ui="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)" | ||
| 31 | uitype='WM' | ||
| 32 | elif [ -f "${HOME}/.xsession" ]; then | ||
| 33 | ui="$(tail -n 1 "${HOME}/.xsession" | cut -d ' ' -f 2)" | ||
| 34 | uitype='WM' | ||
| 26 | else | 35 | else |
| 27 | envtype='WM' | 36 | ui='unknown' |
| 37 | uitype='UI' | ||
| 28 | fi | 38 | fi |
| 29 | 39 | ||
| 30 | ## DEFINE COLORS | 40 | ## DEFINE COLORS |
| 31 | 41 | ||
| 32 | # probably don't change these | 42 | # probably don't change these |
| 33 | bold="$(tput bold)" | 43 | if [ -x "$(command -v tput)" ]; then |
| 34 | black="$(tput setaf 0)" | 44 | bold="$(tput bold)" |
| 35 | red="$(tput setaf 1)" | 45 | black="$(tput setaf 0)" |
| 36 | green="$(tput setaf 2)" | 46 | red="$(tput setaf 1)" |
| 37 | yellow="$(tput setaf 3)" | 47 | green="$(tput setaf 2)" |
| 38 | blue="$(tput setaf 4)" | 48 | yellow="$(tput setaf 3)" |
| 39 | magenta="$(tput setaf 5)" | 49 | blue="$(tput setaf 4)" |
| 40 | cyan="$(tput setaf 6)" | 50 | magenta="$(tput setaf 5)" |
| 41 | white="$(tput setaf 7)" | 51 | cyan="$(tput setaf 6)" |
| 42 | reset="$(tput sgr0)" | 52 | white="$(tput setaf 7)" |
| 53 | reset="$(tput sgr0)" | ||
| 54 | fi | ||
| 43 | 55 | ||
| 44 | # you can change these | 56 | # you can change these |
| 45 | lc="${reset}${bold}${cyan}" # labels | 57 | lc="${reset}${bold}${magenta}" # labels |
| 46 | nc="${reset}${bold}${cyan}" # user and hostname | 58 | nc="${reset}${bold}${magenta}" # user and hostname |
| 47 | ic="${reset}${bold}${white}" # info | 59 | ic="${reset}" # info |
| 48 | c0="${reset}${bold}${cyan}" # first color | 60 | c0="${reset}${bold}${magenta}" # first color |
| 49 | c1="${reset}${cyan}" # second color | 61 | c1="${reset}${magenta}" # second color |
| 50 | 62 | ||
| 51 | ## OUTPUT | 63 | ## OUTPUT |
| 52 | 64 | ||
| 53 | cat <<EOF | 65 | cat <<EOF |
| 54 | 66 | ||
| 55 | ${c0} /\ ${nc}${USER}${ic}@${nc}${host}${reset} | 67 | ${c0} .-----. ${nc}${USER}${ic}@${nc}${host}${reset} |
| 56 | ${c0} /^^\ ${lc}OS: ${ic}${os}${reset} | 68 | ${c0} .\` _ \`. ${lc}OS: ${ic}${os}${reset} |
| 57 | ${c0} /\ \ ${lc}KERNEL: ${ic}${kernel}${reset} | 69 | ${c0} \`. (${c1}_) ${c0}\`. ${lc}KERNEL: ${ic}${kernel}${reset} |
| 58 | ${c0} / ${c1}__ \ ${lc}UPTIME: ${ic}${uptime}${reset} | 70 | ${c0} \`${c1}. / ${lc}UPTIME: ${ic}${uptime}${reset} |
| 59 | ${c1} / ( ) \ ${lc}PACKAGES: ${ic}${packages}${reset} | 71 | ${c1} .\` .\` ${lc}PACKAGES: ${ic}${packages}${reset} |
| 60 | ${c1} / __| |__\\\\ ${lc}SHELL: ${ic}${shell}${reset} | 72 | ${c1} / .\` ${lc}SHELL: ${ic}${shell}${reset} |
| 61 | ${c1} /// \\\\\ ${lc}${envtype}: ${ic}${WM}${reset} | 73 | ${c1} \____.-\` ${lc}${uitype}: ${ic}${ui}${reset} |
| 62 | 74 | ||
| 63 | EOF | 75 | EOF |
| 76 | |||
diff --git a/bin/.local/bin/shut b/bin/.local/bin/shut new file mode 100755 index 0000000..dc391e1 --- /dev/null +++ b/bin/.local/bin/shut | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Say goodbye") | ||
| 4 | |||
| 5 | case $RET in | ||
| 6 | shutdown) sudo poweroff ;; | ||
| 7 | reboot) sudo reboot ;; | ||
| 8 | sleep) lock & sudo sh -c "echo -n mem > /sys/power/state" ;; | ||
| 9 | lock) lock ;; | ||
| 10 | *) ;; | ||
| 11 | esac | ||
