gh0stzk / dotfiles

BSPWM environment with 18 themes. With a theme selector to change on the fly.
GNU General Public License v3.0
2.69k stars 201 forks source link

How to get battery icon in zombie theme, it's my favourite of all rices #197

Closed NavatejR closed 5 months ago

gh0stzk commented 5 months ago

In the folder ../.config/bspwm/rices/z0mbi3/bar/scripts there is a script for the battery. I left it for the future since I don't use hardware that uses a battery. And I don't like to add anything that I haven't tested.

But the script is functional, you would have to get your hands on the yuck code, eww.yuck inside that folder.

In 2 or 3 months I will buy a new laptop and then I will be able to add the battery. If you want to wait.

Internally eww has its so-called magic variables with which you can also display the battery.

NavatejR commented 5 months ago

So how do I enable it? Could you show opthe steps because I have never configured eww before

NavatejR commented 5 months ago

I don't mind editting the code myself if you don'tmind

NavatejR commented 5 months ago

in the other rices such as pamela they do show the battery percent its only a slight inconvenience for the zombie as I have to open up terminal and type cat /sys.. and find battery capacity

gh0stzk commented 5 months ago

The thing is that the other themes like pamela use polybar to show the battery information.

In z0mbi3 the bar is made with eww and it is a little more complicated because the code is not already in my dotfiles, it is not just that need to enabled, but rather the code has to be created.

Let me look for some dotfiles to show you how you could do it with the script that is in my dotfiles.

gh0stzk commented 5 months ago

Look this. This code is from the rxyhn repo, the bar from where i inspired, use the same bash script.

;; Battery Widgets ;;
(defwidget bat []
    (box    :orientation "v"    
            :space-evenly "false"
    (label  :class "bat"        
            :halign "end"       
            :text battery   
            :tooltip "Battery: ${battery-cappacity}%")))
(defpoll battery            :interval "1s"  "scripts/battery icon")
(defpoll battery-cappacity  :interval "1s"  "scripts/battery percent")

of course yo nee to change the path to script, and several other things, just check my code, copy a part of other widget and adpat it to this. from there you need to add the widget to some part of my bar, (bat)

of course this only shows a glyph shows you the percent. When the time comes, i will modify to show an image icon, not a glyph, to make it looks nicer. a notification when you are under certain percentage, etc.. and other improvs. But for now, that will show what you want.

NavatejR commented 5 months ago

Yes I ended up somehow fixing it by doing this I adjusted the eww.yuck by adding: ;; Battery Widgets ;; (defwidget bat [] (box :orientation "v" :space-evenly "false" (label :class "bat" :halign "end" :text battery :tooltip "Battery: ${battery-cappacity}%"))) (defpoll battery :interval "1s" "scripts/battery icon") (defpoll battery-cappacity :interval "1s" "scripts/battery percent") under ;; Workspaces Widgets ;; (defwidget workspaces [] (literal :content workspaces)) and

;; Control Panel Widgets ;;
(defwidget control []
    (box :orientation "v"
        :space-evenly false
        :class "control"
(bat)
(notifycenter)
(volum)
(wifi)
(pacman)))

under top widgets

and in eww.scss // icons info .control { padding: 0.5rem; background-color: $black; border-radius: 5px; }

.trayicon { background-repeat: no-repeat; background-size: 25px; min-height: 25px; min-width: 7px; margin: 0.2rem 0 0.2rem 0; }

.bar-updates-text { font-family: "JetBrainsMono NF"; font-size: 14px; font-weight: Bold; color: #8ea6c4; margin: 0.4rem 0 0.2rem 0.2rem; }

scale trough { all: unset; background-color: $background; border-radius: 5px; min-height: 80px; min-width: 10px; margin: 0.3rem 0 0.3rem 0.1rem; }

.volbar trough highlight { background: linear-gradient($red, $magenta, $blue, $cyan); border-radius: 5px; }

.bat{ font-family: JetBrainsMono Nerd Font; font-size: 1.4em; padding-right: 0.8rem; margin: 0.3rem -1 0.6rem 0.1rem; color: $blue; }

gh0stzk commented 5 months ago

Nice!! do you need something else or i can close the issue?