diff --git a/.config/polybar/battery-combined-ramp-udev.sh b/.config/polybar/battery-combined-ramp-udev.sh new file mode 100644 index 0000000..09cd685 --- /dev/null +++ b/.config/polybar/battery-combined-ramp-udev.sh @@ -0,0 +1,129 @@ +#!/bin/sh + +battery_print() { + PATH_AC="/sys/class/power_supply/AC" + PATH_BATTERY_0="/sys/class/power_supply/BATA" + PATH_BATTERY_1="/sys/class/power_supply/BATB" + + ac=0 + battery_level_0=0 + battery_level_1=0 + battery_max_0=0 + battery_max_1=0 + + charging= + + if [ -f "$PATH_AC/online" ]; then + ac=$(cat "$PATH_AC/online") + fi + + if [ -f "$PATH_BATTERY_0/energy_now" ]; then + battery_level_0=$(cat "$PATH_BATTERY_0/energy_now") + fi + + if [ -f "$PATH_BATTERY_0/energy_full" ]; then + battery_max_0=$(cat "$PATH_BATTERY_0/energy_full") + fi + + if [ -f "$PATH_BATTERY_1/energy_now" ]; then + battery_level_1=$(cat "$PATH_BATTERY_1/energy_now") + fi + + if [ -f "$PATH_BATTERY_1/energy_full" ]; then + battery_max_1=$(cat "$PATH_BATTERY_1/energy_full") + fi + +# battery_level_0=$(("$battery_level_0")) +# battery_level_1=$(("$battery_level_1")) +# battery_max_0=$(("$battery_max_0")) +# battery_max_1=$(("$battery_max_1")) +# + battery_percent_0=$(("$battery_level_0 * 100")) + +if [ "$battery_percent_0" -gt 0 ]; then + battery_percent_0=$(("$battery_percent_0 / $battery_max_0")) +else + battery_percent_0="0" +fi + + battery_percent_1=$(("$battery_level_1 * 100")) + +if [ "$battery_percent_1" -gt 0 ]; then + battery_percent_1=$(("$battery_percent_1 / $battery_max_1")) +else + battery_percent_1="0" +fi + +if [ "$ac" -eq 1 ]; then + icon="" + if [ "$battery_percent_0" -gt 95 ] && [ "$battery_percent_1" -gt 95 ]; then + echo "$icon" + + else + for (( i=0; i<${#charging}; i++ )); do + echo -n "${charging:$i:1}$battery_percent_0%" + echo -n "|" + echo "${charging:$i:1}$battery_percent_1%" + sleep 1 + done + fi +else + #elif [ "$ac" -lt 1 ]; then + if [ "$battery_percent_0" -gt 94 ]; then + icon0="" + elif [ "$battery_percent_0" -gt 85 ]; then + icon0="" + elif [ "$battery_percent_0" -gt 60 ]; then + icon0="" + elif [ "$battery_percent_0" -gt 35 ]; then + icon0="" + elif [ "$battery_percent_0" -gt 10 ]; then + icon0="" + elif [ "$battery_percent_1" -lt 10 ]; then + icon0="" + else + icon0="" + fi + + if [ "$battery_percent_1" -gt 94 ]; then + icon1="" + elif [ "$battery_percent_1" -gt 85 ]; then + icon1="" + elif [ "$battery_percent_1" -gt 60 ]; then + icon1="" + elif [ "$battery_percent_1" -gt 35 ]; then + icon1="" + elif [ "$battery_percent_1" -gt 10 ]; then + icon1="" + elif [ "$battery_percent_1" -lt 10 ]; then + icon1="" + else + icon1="" + fi + echo "$icon0""$battery_percent_0%""|""$icon1""$battery_percent_1%" +fi + +} +path_pid="/tmp/polybar-battery-combined-udev.pid" + +case "$1" in + --update) + pid=$(cat $path_pid) + + if [ "$pid" != "" ]; then + kill -10 "$pid" + fi + ;; + *) + echo $$ > $path_pid + + trap exit INT + trap "echo" USR1 + + while true; do + battery_print + sleep 1 & + wait + done + ;; +esac diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini new file mode 100644 index 0000000..c8d77f2 --- /dev/null +++ b/.config/polybar/config.ini @@ -0,0 +1,366 @@ +;============================================================= +; ██▓███ ▒█████ ██▓ ▓██ ██▓ ▄▄▄▄ ▄▄▄ ██▀███ +;▓██░ ██▒▒██▒ ██▒▓██▒ ▒██ ██▒▓█████▄ ▒████▄ ▓██ ▒ ██▒ +;▓██░ ██▓▒▒██░ ██▒▒██░ ▒██ ██░▒██▒ ▄██▒██ ▀█▄ ▓██ ░▄█ ▒ +;▒██▄█▓▒ ▒▒██ ██░▒██░ ░ ▐██▓░▒██░█▀ ░██▄▄▄▄██ ▒██▀▀█▄ +;▒██▒ ░ ░░ ████▓▒░░██████▒ ░ ██▒▓░░▓█ ▀█▓ ▓█ ▓██▒░██▓ ▒██▒ +;▒▓▒░ ░ ░░ ▒░▒░▒░ ░ ▒░▓ ░ ██▒▒▒ ░▒▓███▀▒ ▒▒ ▓▒█░░ ▒▓ ░▒▓░ +;░▒ ░ ░ ▒ ▒░ ░ ░ ▒ ░▓██ ░▒░ ▒░▒ ░ ▒ ▒▒ ░ ░▒ ░ ▒░ +;░░ ░ ░ ░ ▒ ░ ░ ▒ ▒ ░░ ░ ░ ░ ▒ ░░ ░ +; ░ ░ ░ ░░ ░ ░ ░ ░ ░ +; ░ ░ ░ +; https://github.com/polybar/polybar +;============================================================= +[colors] +background = #000000 +background-alt = #1c2f2f +foreground = #587864 +primary = #228b22 +secondary = #2e8b57 +alert = #3cb371 +disabled = #556b2f + +[bar/main] +#monitor = ${env:MONITOR:VGA1} +width = 100% +height = 12pt +radius = 0 +background = ${colors.background} +foreground = ${colors.foreground} +line-size = 3pt +border-size = 0pt +border-color = ${colors.background-alt} +padding-left = 1 +padding-right = 1 +module-margin = 1 +font-0 = ProggyCleanTTSZ Nerd Font:size= 12 +font-1 = Gohu Font Nerd Font:size= 7 +;font-2 = ProggySmallTT:size= 9 +modules-left= xworkspaces menu-apps nowplaying +modules-center=date +modules-right=pulseaudio memory cpu wireless-network temperature battery-combined-ramp-udev backlight info-redshift-temp 8ball +cursor-click = pointer +cursor-scroll = ns-resize +enable-ipc = true +; wm-restack = bspwm +; override-redirect = true + +[bar/1] +monitor = ${env:MONITOR:VGA1} +width = 100% +height = 12pt +radius = 0 +background = ${colors.background} +foreground = ${colors.foreground} +line-size = 3pt +border-size = 0pt +border-color = ${colors.background-alt} +padding-left = 0 +padding-right = 0 +module-margin = 1 +font-0 = ProggyCleanTTSZ Nerd Font:size= 12 +font-1 = Gohu Font Nerd Font:size= 7 +;font-2 = ProggySmallTT:size= 9 +modules-left= xworkspaces menu-apps nowplaying +modules-center=date +modules-right=pulseaudio memory cpu wireless-network temperature battery-combined-ramp-udev backlight info-redshift-temp 8ball +cursor-click = pointer +cursor-scroll = ns-resize +enable-ipc = true +; wm-restack = bspwm +; override-redirect = true + +[bar/2] +monitor = ${env:MONITOR:LVDS1} +width = 100% +height = 12pt +radius = 0 +background = ${colors.background} +foreground = ${colors.foreground} +line-size = 3pt +border-size = 0pt +border-color = ${colors.background-alt} +padding-left = 0 +padding-right = 0 +module-margin = 1 +font-0 = ProggyCleanTTSZ Nerd Font:size= 12 +font-1 = Gohu Font Nerd Font:size= 7 +;font-2 = ProggySmallTT:size= 9 +modules-left= xworkspaces nowplaying +modules-center=date +modules-right=pulseaudio backlight +cursor-click = pointer +cursor-scroll = ns-resize +enable-ipc = true + +[module/xworkspaces] +type = internal/xworkspaces +label-active = %{O3}%name%%{O3} +label-active-background = ${colors.primary} +label-active-foreground = #000000 + +label-occupied = %{O3}%name%%{O2} +label-occupied-background = ${colors.background-alt} +label-occupied-foreground = #008000 + +label-urgent = %{O3}%name%%{O2} +label-urgent-background = ${colors.alert} + +label-empty = %{O3}%name%%{O2} +label-empty-foreground = ${colors.disabled} + +[module/hcbar] +type = custom/script +exec-if = ps -C herbstluftwm >/dev/null 2>&1 +exec = /home/ktn/.config/polybar/hcbar +tail = true + +[module/menu-apps] +type = custom/menu +expand-right = true + +menu-0-0 =  +menu-0-0-exec = firefox +menu-0-1 =  +menu-0-1-exec = signal-desktop +menu-0-2 =  +menu-0-2-exec = kcalc +menu-0-3 =  +menu-0-3-exec = retroarch +menu-0-4 =  +menu-0-4-exec = roxterm +menu-0-5 =  +menu-0-5-exec = #menu-apps.open.1 +menu-1-0 = Writer +menu-1-0-exec = libreoffice --writer +menu-1-1 = Impress +menu-1-1-exec = libreoffice --impress +menu-1-2 = Calc +menu-1-2-exec = libreoffice --calc + +menu-0-6 =  +menu-0-6-exec = #menu-apps.open.2 +menu-2-0 = GIMP +menu-2-0-exec = gimp +menu-2-1 =feh +menu-2-1-exec = feh +menu-2-2 =XAOS +menu-2-2-exec = xaos +menu-0-7 =  +menu-0-7-exec = #menu-apps.open.3 +menu-3-0 = Clementine +menu-3-0-exec = clementine +menu-3-1 = EasyTAG +menu-3-1-exec = easytag +menu-3-2 = mpv +menu-3-2-exec = mpv --player-operation-mode=pseudo-gui -- %U +menu-3-3 = cmus +menu-3-3-exec = roxterm -p cmus + +menu-0-8=  +menu-0-8-exec = #menu-apps.open.4 +menu-4-0 =  +menu-4-0-exec = caja +menu-4-1 = Documents +menu-4-1-exec = caja ~/Documents +menu-4-2 = Music +menu-4-2-exec = caja ~/Music +menu-4-3 = Pictures +menu-4-3-exec = caja ~/Pictures +menu-4-4 = LocalBin +menu-4-4-exec = caja ~/.local/bin +menu-4-5 =  +menu-4-5-exec = timeshift-launcher + +menu-0-9 =  +menu-0-9-exec = #menu-apps.open.5 +menu-5-0 = ROFI +menu-5-0-exec = xed ~/.config/rofi/config.rasi +menu-5-1 = SXHKDRC +menu-5-1-exec = xed ~/.config/dk/sxhkrc +menu-5-2 = POLYBAR +menu-5-2-exec = xed ~/.config/polybar/config.ini +menu-5-3 = HLWM +menu-5-3-exec = xed ~/.config/herbstluftwm/autostart +menu-5-4 = CONF +menu-6-4-exec = caja ~/.config/ +menu-5-5 =  +menu-5-5-exec = #menu-apps.open.6 +menu-6-0 = Grubedit +menu-6-0-exec = grub-customizer +menu-6-1 = dconf +menu-6-1-exec = dconf-editor +menu-6-2 =  +menu-6-2-exec = #menu-apps.open.7 +menu-7-0 = Xscreensaving +menu-7-0-exec = xscreensaver-settings +menu-7-1 = Lightdm +menu-7-1-exec = lightdm-gtk-greeter-settings-pkexec +menu-6-3 =  +menu-6-3-exec = #menu-apps.open.8 +menu-8-0 =Gdisks +menu-8-0-exec = gnome-disks +menu-8-1 =Gparted +menu-8-1-exec = gparted + +menu-0-10 = ⏼ +menu-0-10-exec = #menu-apps.open.9 +menu-9-0 =  +menu-9-0-exec = sudo /sbin/shutdown -h now +menu-9-1 = ﰇ +menu-9-1-exec = sudo /sbin/reboot +menu-9-2 =  +menu-9-2-exec = herbstclient quit + +menu-0-11 =  +menu-0-11-exec = kdeconnect-settings + +label-open = %{O-10} +label-close = %{O-10} +label-separator =  +label-seperator-foreground = ${colors.primary} +label-foreground = ${colors.foreground} +label-menu-font = 2 + +[module/nowplaying] +type = custom/script +exec = nowplaying | head -c 71 +click-left = wmctrl -a CMUS || $(echo "$(nowplaying)") +label = %{O-7}%output% +format = %{T2}