This commit is contained in:
The-Repo-Club 2022-10-28 17:28:27 +01:00
parent f22906f652
commit 4e9e4b5fe6
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F
8 changed files with 112 additions and 103 deletions

View File

@ -12,7 +12,7 @@
#Created:
# Wed 10 March 2021, 12:34:47 PM [GMT+1]
#Modified:
# Thu 20 October 2022, 05:33:49 AM [GMT+1]
# Fri 28 October 2022, 05:00:50 PM [GMT+1]
#
#Description:
# <Todo>
@ -23,73 +23,77 @@
# shellcheck disable=all
getuptime() {
uptime -p >/dev/null 2>&1
uptime -p >/dev/null 2>&1
if [ "$?" -eq 0 ]; then
# Supports most Linux distro
# when the machine is up for less than '0' minutes then
# 'uptime -p' returns ONLY 'up', so we need to set a default value
UP_SET_OR_EMPTY=$(uptime -p | awk -F 'up ' '{print $2}')
UP=${UP_SET_OR_EMPTY:-'less than a minute'}
else
# Supports Mac OS X, Debian 7, etc
UP=$(uptime | sed -E 's/^[^,]*up *//; s/mins/minutes/; s/hrs?/hours/;
if [ "$?" -eq 0 ]; then
# Supports most Linux distro
# when the machine is up for less than '0' minutes then
# 'uptime -p' returns ONLY 'up', so we need to set a default value
UP_SET_OR_EMPTY=$(uptime -p | awk -F 'up ' '{print $2}')
UP=${UP_SET_OR_EMPTY:-'less than a minute'}
else
# Supports Mac OS X, Debian 7, etc
UP=$(uptime | sed -E 's/^[^,]*up *//; s/mins/minutes/; s/hrs?/hours/;
s/([[:digit:]]+):0?([[:digit:]]+)/\1 hours, \2 minutes/;
s/^1 hours/1 hour/; s/ 1 hours/ 1 hour/;
s/min,/minutes,/; s/ 0 minutes,/ less than a minute,/; s/ 1 minutes/ 1 minute/;
s/ / /; s/, *[[:digit:]]* users?.*//')
fi
fi
echo "$UP"
echo "$UP"
}
asksetting() {
options=" Lock
options=" Lock
望 Sleep
 Logout
 Restart
襤 Shutdown"
echo -e "Uptime: $(getuptime)
echo -e "Uptime: $(getuptime)
$options" | fzf --prompt="Power Settings: " --border=rounded --margin=1% --color=dark --height 100% --reverse --header=" POWER MENU " --info=hidden --header-first
}
triggerFunction() {
init_system="$(cat /proc/1/comm)"
if [[ $init_system = "systemd" ]]; then
systemctl "$1"
elif [[ $init_system = "init" ]]; then
loginctl "$1"
elif [[ $init_system = "runit" ]]; then
loginctl "$1"
else
systemctl "$1"
fi
init_system="$(cat /proc/1/comm)"
if [[ $init_system = "systemd" ]]; then
systemctl "$1"
elif [[ $init_system = "init" ]]; then
loginctl "$1"
elif [[ $init_system = "runit" ]]; then
loginctl "$1"
else
systemctl "$1"
fi
}
LOOPSETTING="true"
while [ -n "$LOOPSETTING" ]; do
CHOICE="$(asksetting "$@")"
[ -n "$CHOICE" ] || exit
unset LOOPSETTING
case "$CHOICE" in
*Logout)
pkill -KILL -u "$USER"
;;
*Lock)
multimonitorlock -l -- --time-str="%I:%M:%S %p"
;;
*Shutdown)
triggerFunction poweroff
;;
*Restart)
triggerFunction reboot
;;
*Sleep)
triggerFunction suspend
;;
*)
echo "Program terminated." && exit 1
;;
esac
CHOICE="$(asksetting "$@")"
[ -n "$CHOICE" ] || exit
unset LOOPSETTING
case "$CHOICE" in
*Logout)
if [[ "$DESKTOP_SESSION" == "i3" ]]; then
i3-msg exit
else
pkill -KILL -u "$USER"
fi
;;
*Lock)
multimonitorlock -l -- --time-str="%I:%M:%S %p"
;;
*Shutdown)
triggerFunction poweroff
;;
*Restart)
triggerFunction reboot
;;
*Sleep)
triggerFunction suspend
;;
*)
echo "Program terminated." && exit 1
;;
esac
done

View File

@ -38,6 +38,7 @@ i3-session
i3-swallow
i3lock-color
imagewriter
jetbrains-toolbox
lib32-libxft-bgra
libart-lgpl
libxft-bgra

View File

@ -139,23 +139,23 @@ format-discharging-padding = 1
label-charging = %percentage%%
label-discharging = %percentage%%
label-full =
label-full =
label-full-background = ${color.orange}
label-full-foreground = ${color.fg}
label-full-padding = 1
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-3 =
animation-charging-4 =
animation-charging-5 =
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-3 =
animation-charging-4 =
animation-charging-5 =
animation-charging-framerate = 750
@ -178,7 +178,7 @@ type = internal/cpu
interval = 0.5
format =
format =
format-background = ${color.red}
format-foreground = ${color.fg}
format-padding = 1
@ -208,8 +208,8 @@ type = internal/date
interval = 1.0
time =
time-alt =
time =
time-alt =
format = <label>
format-background = ${color.orange}
@ -248,12 +248,12 @@ mount-0 = /
interval = 10
fixed-values = true
format-mounted =
format-mounted =
format-mounted-background = ${color.red}
format-mounted-foreground = ${color.fg}
format-mounted-padding = 1
format-unmounted =
format-unmounted =
format-unmounted-background = ${color.red}
format-unmounted-foreground = ${color.fg}
format-unmounted-padding = 1
@ -288,12 +288,12 @@ mount-0 = /home
interval = 10
fixed-values = true
format-mounted =
format-mounted =
format-mounted-background = ${color.red}
format-mounted-foreground = ${color.fg}
format-mounted-padding = 1
format-unmounted =
format-unmounted =
format-unmounted-background = ${color.red}
format-unmounted-foreground = ${color.fg}
format-unmounted-padding = 1
@ -434,7 +434,7 @@ type = internal/memory
interval = 3
format =
format =
format-background = ${color.red}
format-foreground = ${color.fg}
format-padding = 1
@ -515,13 +515,13 @@ format-disconnected-background = ${color.orange}
format-disconnected-foreground = ${color.fg}
format-disconnected-padding = 1
label-disconnected =
label-disconnected =
ramp-signal-0 =
ramp-signal-1 =
ramp-signal-2 =
ramp-signal-3 =
ramp-signal-4 =
ramp-signal-0 =
ramp-signal-1 =
ramp-signal-2 =
ramp-signal-3 =
ramp-signal-4 =
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
@ -563,13 +563,13 @@ format-muted-padding = 1
label-muted = ""
label-muted-foreground = ${color.fg}
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
ramp-volume-3 =
ramp-volume-4 =
ramp-headphones-0 =
ramp-headphones-1 =
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
ramp-volume-3 =
ramp-volume-4 =
ramp-headphones-0 =
ramp-headphones-1 =
[module/pulseaudio_hdmi]
type = internal/pulseaudio
@ -606,16 +606,16 @@ format-muted-background = ${color.orange}
format-muted-foreground = ${color.fg}
format-muted-padding = 1
label-muted = ""
label-muted = ""
label-muted-foreground = ${color.fg}
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
ramp-volume-3 =
ramp-volume-4 =
ramp-headphones-0 =
ramp-headphones-1 =
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =
ramp-volume-3 =
ramp-volume-4 =
ramp-headphones-0 =
ramp-headphones-1 =
;; _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
@ -689,7 +689,7 @@ type = internal/xkeyboard
blacklist-0 = num lock
blacklist-1 = scroll lock
format = %{A1:i3-cheat &:}%{A}
format = %{A1:i3-cheat &:}%{A}
format-background = ${color.orange}
format-foreground = ${color.fg}
format-padding = 1
@ -700,8 +700,8 @@ format-padding = 1
type = internal/xwindow
format = <label>
format-background = ${color.mf}
format-foreground = ${color.fg}
format-background = ${color.bg}
format-foreground = ${color.fg-alt}
format-padding = 1
label = %title%

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2"
font-1 = "Wuncon Siji:pixelsize=8:size=10;2"
font-1 = "Wuncon Siji:antialias=true:size=12;2"
font-2 = "Hack:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;2"
font-6 = "FiraCode Nerd Font Mono:antialias=true:size=14;2"
; Modules are added to one of the available blocks
; modules-left = cpu ram

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2"
font-1 = "Wuncon Siji:pixelsize=8:size=10;2"
font-1 = "Wuncon Siji:antialias=true:size=12;2"
font-2 = "Hack:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;2"
font-6 = "FiraCode Nerd Font Mono:antialias=true:size=14;2"
; Modules are added to one of the available blocks
; modules-left = cpu ram

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2"
font-1 = "Wuncon Siji:pixelsize=8:size=10;2"
font-1 = "Wuncon Siji:antialias=true:size=12;2"
font-2 = "Hack:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;2"
font-6 = "FiraCode Nerd Font Mono:antialias=true:size=14;2"
; Modules are added to one of the available blocks
; modules-left = cpu ram

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2"
font-1 = "Wuncon Siji:pixelsize=8:size=10;2"
font-1 = "Wuncon Siji:antialias=true:size=12;2"
font-2 = "Hack:weight=bold:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;2"
font-6 = "FiraCode Nerd Font Mono:antialias=true:size=14;2"
; Modules are added to one of the available blocks
; modules-left = cpu ram

View File

@ -27,7 +27,7 @@ click-left = pkgbrowser &
[module/updates_i]
type = custom/text
format =
format =
format-background = ${color.orange}
format-foreground = ${color.fg}
format-padding = 1
@ -51,7 +51,7 @@ format-padding = 1
[module/distro_i]
type = custom/text
format =
format =
format-background = ${color.red}
format-foreground = ${color.fg}
format-padding = 1
@ -71,7 +71,7 @@ click-left = fzf_run -c fzf_menu_run -i PolybarMenu -t alacritty
[module/launcher_i]
type = custom/text
format =
format =
format-background = ${color.orange}
format-foreground = ${color.fg}
format-padding = 1
@ -93,7 +93,7 @@ click-left = fzf_run -c fzf_powermenu -i PowerMenu -t alacritty
[module/power_i]
type = custom/text
format =
format =
format-background = ${color.orange}
format-foreground = ${color.fg}
format-padding = 1
@ -126,7 +126,7 @@ format-padding = 1
[module/kernel_i]
type = custom/text
format =
format =
format-background = ${color.red}
format-foreground = ${color.fg}
format-padding = 1
@ -151,7 +151,7 @@ type = custom/text
click-left = ~/.config/polybar/scripts/picom-toggle.sh
format =
format =
format-background = ${color.orange}
format-foreground = ${color.fg}
format-padding = 1
@ -210,7 +210,7 @@ format-padding = 1
[module/github_i]
type = custom/text
format =
format =
format-background = ${color.red}
format-foreground = ${color.fg}
format-padding = 1