summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorShubham Saini <shubham6405@gmail.com>2020-03-24 12:23:17 +0000
committerShubham Saini <shubham6405@gmail.com>2020-03-24 12:23:17 +0000
commit064fb93965974ed826a7e9cdf854e9c5ec935342 (patch)
tree75789e39783d7def078085b96d71d55e20555cbd /bin
parentafb012025a944617e912c20e98190f8538d78262 (diff)
gentooman
Diffstat (limited to 'bin')
-rwxr-xr-xbin/.local/bin/fetch91
-rwxr-xr-xbin/.local/bin/shut11
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
8host="$(hostname)" 8host="$(hostname)"
9os='Arch Linux' 9os='Gentoo Linux'
10kernel="$(uname -sr)" 10kernel="$(uname -sr)"
11uptime="$(uptime -p | sed 's/up //')" 11uptime="$(uptime -p | sed 's/up //')"
12packages="$(pacman -Q | wc -l)" 12packages="$(ls -d /var/db/pkg/*/* | wc -l)"
13shell="$(basename ${SHELL})" 13shell="$(basename "$SHELL")"
14 14
15if [ -z "${WM}" ]; then 15## UI DETECTION
16 if [ "${XDG_CURRENT_DESKTOP}" ]; then 16
17 envtype='DE' 17if [ -n "${DE}" ]; then
18 WM="${XDG_CURRENT_DESKTOP}" 18 ui="${DE}"
19 elif [ "${DESKTOP_SESSION}" ]; then 19 uitype='DE'
20 envtype='DE' 20elif [ -n "${WM}" ]; then
21 WM="${DESKTOP_SESSION}" 21 ui="${WM}"
22 else 22 uitype='WM'
23 envtype='WM' 23elif [ -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'
26elif [ -n "${DESKTOP_SESSION}" ]; then
27 ui="${DESKTOP_SESSION}"
28 uitype='DE'
29elif [ -f "${HOME}/.xinitrc" ]; then
30 ui="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
31 uitype='WM'
32elif [ -f "${HOME}/.xsession" ]; then
33 ui="$(tail -n 1 "${HOME}/.xsession" | cut -d ' ' -f 2)"
34 uitype='WM'
26else 35else
27 envtype='WM' 36 ui='unknown'
37 uitype='UI'
28fi 38fi
29 39
30## DEFINE COLORS 40## DEFINE COLORS
31 41
32# probably don't change these 42# probably don't change these
33bold="$(tput bold)" 43if [ -x "$(command -v tput)" ]; then
34black="$(tput setaf 0)" 44 bold="$(tput bold)"
35red="$(tput setaf 1)" 45 black="$(tput setaf 0)"
36green="$(tput setaf 2)" 46 red="$(tput setaf 1)"
37yellow="$(tput setaf 3)" 47 green="$(tput setaf 2)"
38blue="$(tput setaf 4)" 48 yellow="$(tput setaf 3)"
39magenta="$(tput setaf 5)" 49 blue="$(tput setaf 4)"
40cyan="$(tput setaf 6)" 50 magenta="$(tput setaf 5)"
41white="$(tput setaf 7)" 51 cyan="$(tput setaf 6)"
42reset="$(tput sgr0)" 52 white="$(tput setaf 7)"
53 reset="$(tput sgr0)"
54fi
43 55
44# you can change these 56# you can change these
45lc="${reset}${bold}${cyan}" # labels 57lc="${reset}${bold}${magenta}" # labels
46nc="${reset}${bold}${cyan}" # user and hostname 58nc="${reset}${bold}${magenta}" # user and hostname
47ic="${reset}${bold}${white}" # info 59ic="${reset}" # info
48c0="${reset}${bold}${cyan}" # first color 60c0="${reset}${bold}${magenta}" # first color
49c1="${reset}${cyan}" # second color 61c1="${reset}${magenta}" # second color
50 62
51## OUTPUT 63## OUTPUT
52 64
53cat <<EOF 65cat <<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
63EOF 75EOF
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
3RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Say goodbye")
4
5case $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 *) ;;
11esac