From 59716d53ef59f1667a80f10e9e1430709f69fe0e Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Tue, 1 Nov 2022 00:48:17 +0000 Subject: [PATCH 1/2] Added baterry level --- .config/xmobar/scripts/battery.sh | 64 +++++++++++++++++++++++++++++++ .config/xmobar/xmobarrc0 | 8 ++-- 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100755 .config/xmobar/scripts/battery.sh diff --git a/.config/xmobar/scripts/battery.sh b/.config/xmobar/scripts/battery.sh new file mode 100755 index 0000000..822a9c3 --- /dev/null +++ b/.config/xmobar/scripts/battery.sh @@ -0,0 +1,64 @@ +#!/bin/bash + + +batLevel=$(acpi --battery | grep -Po '(\d+)\%' | sed 's/%//') + +charging=$(acpi --ac-adapter | grep -Po '(off-line|on-line)') + +if [ $batLevel -le 20 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +elif [ $batLevel -le 30 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +elif [ $batLevel -le 40 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +elif [ $batLevel -le 60 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +elif [ $batLevel -le 80 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +elif [ $batLevel -le 95 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +elif [ $batLevel -g 95 ]; +then + if [ $charging == "on-line" ]; + then + echo " $batLevel" + else + echo " $batLevel" + fi +fi diff --git a/.config/xmobar/xmobarrc0 b/.config/xmobar/xmobarrc0 index 91d10c8..9dba83d 100644 --- a/.config/xmobar/xmobarrc0 +++ b/.config/xmobar/xmobarrc0 @@ -8,9 +8,8 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true" , additionalFonts = [ "xft:Font Awesome 6 Free Solid:pixelsize=14" , "xft:Font Awesome 6 Free Solid:pixelsize=12:bold" - , "xft:Font Awesome 6 Free Solid:pixelsize=16" - , "xft:Hack Nerd Font Mono:pixelsize=21" - , "xft:Hack Nerd Font Mono:pixelsize=25" + , "xft:FiraCode Nerd Font Mono:pixelsize=16" + , "xft:FiraCode Nerd Font Mono:pixelsize=12" ] , bgColor = "#2B2E37" , fgColor = "#929AAD" @@ -34,6 +33,7 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true" , Run Com "/home/afonso/.config/xmobar/scripts/volume.sh" [] "volume" 10 , Run Com "/home/afonso/.config/xmobar/scripts/bluetooth.sh" [] "bluetooth" 10 , Run Com "/home/afonso/.config/xmobar/scripts/network.sh" [] "network" 10 + , Run Com "/home/afonso/.config/xmobar/scripts/battery.sh" [] "battery" 20 , Run Com "/home/afonso/.config/xmobar/scripts/trayer-padding-icon.sh" [] "trayerpad" 20 ] , sepChar = "%" @@ -63,6 +63,8 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true" \ \ \%volume%\ \ \ + \%battery%\ + \ \ \|\ \%trayerpad%" } From f6b77a9118e2b2d8012fb650a16127f88b781b68 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Tue, 1 Nov 2022 01:13:27 +0000 Subject: [PATCH 2/2] Icon fixes --- .config/xmobar/scripts/battery.sh | 28 ++++++++++++++-------------- .config/xmobar/scripts/bluetooth.sh | 2 +- .config/xmobar/scripts/network.sh | 2 +- .config/xmobar/scripts/volume.sh | 8 ++++---- .config/xmobar/xmobarrc0 | 8 +++++--- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.config/xmobar/scripts/battery.sh b/.config/xmobar/scripts/battery.sh index 822a9c3..c49c1d8 100755 --- a/.config/xmobar/scripts/battery.sh +++ b/.config/xmobar/scripts/battery.sh @@ -9,56 +9,56 @@ if [ $batLevel -le 20 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi elif [ $batLevel -le 30 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi elif [ $batLevel -le 40 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi elif [ $batLevel -le 60 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi elif [ $batLevel -le 80 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi elif [ $batLevel -le 95 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi elif [ $batLevel -g 95 ]; then if [ $charging == "on-line" ]; then - echo " $batLevel" + echo " " else - echo " $batLevel" + echo " " fi fi diff --git a/.config/xmobar/scripts/bluetooth.sh b/.config/xmobar/scripts/bluetooth.sh index 4b4304d..bb88ddc 100755 --- a/.config/xmobar/scripts/bluetooth.sh +++ b/.config/xmobar/scripts/bluetooth.sh @@ -15,4 +15,4 @@ do fi done -echo "$ICON" +echo "$ICON" diff --git a/.config/xmobar/scripts/network.sh b/.config/xmobar/scripts/network.sh index de1e837..d423eaa 100755 --- a/.config/xmobar/scripts/network.sh +++ b/.config/xmobar/scripts/network.sh @@ -5,7 +5,7 @@ STATES=($(nmcli device show | grep "GENERAL.STATE" | awk '{print $3}')) for ((i = 0; i < "${#TYPES[@]}"; i++)); do if [[ ${STATES[$i]} = "(connected)" ]]; then if [[ ${TYPES[$i]} == *"wifi"* ]]; then - echo "直" + echo "直" else echo "ﯱ" fi diff --git a/.config/xmobar/scripts/volume.sh b/.config/xmobar/scripts/volume.sh index 6814b3e..81c985f 100755 --- a/.config/xmobar/scripts/volume.sh +++ b/.config/xmobar/scripts/volume.sh @@ -3,9 +3,9 @@ MUTE=$(pactl get-sink-mute @DEFAULT_SINK@ | sed -En 's/Mute: (.)/\1/p') VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]*%' | sed -En 's/(.)\%/\1/p' | head -n1) if [ "$MUTE" = "yes" ]; then - echo "" -elif [ "$VOLUME" -eq 0 ]; then - echo "" + echo "婢" +elif [ "$VOLUME" -le 20 ]; then + echo "奔 $VOLUME" else - echo " $VOLUME" + echo " $VOLUME" fi diff --git a/.config/xmobar/xmobarrc0 b/.config/xmobar/xmobarrc0 index 9dba83d..ca38025 100644 --- a/.config/xmobar/xmobarrc0 +++ b/.config/xmobar/xmobarrc0 @@ -7,9 +7,10 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true" , additionalFonts = [ "xft:Font Awesome 6 Free Solid:pixelsize=14" - , "xft:Font Awesome 6 Free Solid:pixelsize=12:bold" - , "xft:FiraCode Nerd Font Mono:pixelsize=16" - , "xft:FiraCode Nerd Font Mono:pixelsize=12" + , "xft:Font Awesome 6 Free Solid:pixelsize=13:bold" + , "xft:FiraCode Nerd Font Mono:pixelsize=21" + , "xft:FiraCode Nerd Font Mono:pixelsize=14" + , "xft:Font Awesome 6 Free Solid:pixelsize=21" ] , bgColor = "#2B2E37" , fgColor = "#929AAD" @@ -57,6 +58,7 @@ Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true" \ \ \|\ \ \ + \ \ \%network%\ \ \ \%bluetooth%\