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

View File

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

View File

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

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details ; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2" 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-2 = "Hack:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2" font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2" font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;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 are added to one of the available blocks
; modules-left = cpu ram ; modules-left = cpu ram

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details ; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2" 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-2 = "Hack:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2" font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2" font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;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 are added to one of the available blocks
; modules-left = cpu ram ; modules-left = cpu ram

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details ; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2" 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-2 = "Hack:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2" font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2" font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;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 are added to one of the available blocks
; modules-left = cpu ram ; modules-left = cpu ram

View File

@ -137,11 +137,12 @@ module-margin-right = 0
; See the Fonts wiki page for more details ; See the Fonts wiki page for more details
font-0 = "Source Code Pro:antialias=true:size=10;2" 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-2 = "Hack:weight=bold:antialias=true:size=12;2"
font-3 = "MaterialIcons:antialias=true:size=10;2" font-3 = "MaterialIcons:antialias=true:size=10;2"
font-4 = "xos4 Terminus:antialias=true:size=12;2" font-4 = "xos4 Terminus:antialias=true:size=12;2"
font-5 = "Noto Sans CJK JP:antialias=true:size=10;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 are added to one of the available blocks
; modules-left = cpu ram ; modules-left = cpu ram

View File

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