├── README.md ├── bar.gif └── bar ├── assets └── pfp.png ├── eww.scss ├── eww.yuck ├── pollers.yuck ├── scripts ├── cpu ├── memory ├── music_info ├── pop-launcher ├── pop-power └── update-workspaces-1 ├── vars.yuck └── widgets.yuck /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | **WARNING: archived as of 30.07.2024 (haven't updated in a very long time, may no longer work.)** 4 | 5 | # eww-bar 6 | a bar made with eww 7 | 8 | ### usage 9 | - run ```eww open bar -c ~/PATH/TO/CONFIG``` 10 | 11 | ### installation 12 | - intall eww 13 | - put eww in /usr/bin/ 14 | - clone this repository 15 | - change the eww values to point to local files 16 | 17 | ### credits 18 | - [saimoomedits](https://github.com/saimoomedits) for inspiration and for some scripts 19 | - Velen#9805 on discord for workpaces script 20 | -------------------------------------------------------------------------------- /bar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/okktoplol/eww-bar/5110b3347aad0ff96f38962bd48dc64e0f922652/bar.gif -------------------------------------------------------------------------------- /bar/assets/pfp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/okktoplol/eww-bar/5110b3347aad0ff96f38962bd48dc64e0f922652/bar/assets/pfp.png -------------------------------------------------------------------------------- /bar/eww.scss: -------------------------------------------------------------------------------- 1 | * 2 | { 3 | all: unset; 4 | } 5 | 6 | /* separator */ 7 | 8 | .sepbar 9 | { 10 | color: #D9E0EE; 11 | font-family: VictorMono Nerd Font Mono; 12 | font-size: 24px; 13 | margin-right: 19px; 14 | margin-left: 19px; 15 | } 16 | 17 | /* tooltip */ 18 | tooltip 19 | { 20 | background-color: #161320; 21 | font-family: VictorMono Nerd Font Mono; 22 | font-size: 12px; 23 | } 24 | 25 | /* bar */ 26 | .bar 27 | { 28 | background-color: #161320; 29 | border-radius: 15px; 30 | } 31 | 32 | /* time*/ 33 | .time-cpu-mem 34 | { 35 | margin-right: 15px; 36 | } 37 | .time-label 38 | { 39 | color: #D9E0EE; 40 | font-family: VictorMono Nerd Font Mono; 41 | font-size: 18px; 42 | } 43 | 44 | /* mem cpu */ 45 | .mem 46 | { 47 | color: #FAE3B0; 48 | background-color: #302D41; 49 | border-radius: 10px; 50 | } 51 | .cpu 52 | { 53 | color: #F5C2E7; 54 | background-color: #302D41; 55 | border-radius: 10px; 56 | margin-right: 30px; 57 | } 58 | .cpu-and-mem 59 | { 60 | background-color: #161320; 61 | border-radius: 16px; 62 | margin-right: 20px; 63 | } 64 | 65 | /* volume and mic */ 66 | 67 | .vol 68 | { 69 | margin-left: 10px 70 | } 71 | .vol-icon 72 | { 73 | font-size: 20px; 74 | margin-right: 10px; 75 | } 76 | .mic-icon 77 | { 78 | font-size: 20px; 79 | margin-right: 10px; 80 | } 81 | 82 | .micvol 83 | { 84 | margin-left: 10px; 85 | } 86 | 87 | .volbar trough highlight 88 | { 89 | background-color: #F5C2E7; 90 | border-radius: 10px; 91 | } 92 | .micbar trough highlight 93 | { 94 | background-color: #FAE3B0; 95 | border-radius: 10px; 96 | } 97 | 98 | scale trough 99 | { 100 | border-radius: 10px; 101 | background-color: #302D41; 102 | min-height: 10px; 103 | min-width: 100px; 104 | } 105 | 106 | /* power */ 107 | 108 | .power-icon 109 | { 110 | font-size: 20px; 111 | } 112 | 113 | /* music */ 114 | 115 | .music-label 116 | { 117 | color: #D9E0EE; 118 | font-family: VictorMono Nerd Font Mono; 119 | font-size: 15px; 120 | margin-right: 19px; 121 | } 122 | 123 | .song_btn_prev 124 | { 125 | color: #D9E0EE; 126 | font-family: VictorMono Nerd Font Mono; 127 | font-size: 20px; 128 | margin-left: 0px; 129 | } 130 | 131 | .song_btn_play 132 | { 133 | color: #D9E0EE; 134 | font-family: VictorMono Nerd Font Mono; 135 | font-size: 20px; 136 | margin-left: 10px; 137 | } 138 | 139 | .song_btn_next 140 | { 141 | color: #D9E0EE; 142 | font-family: VictorMono Nerd Font Mono; 143 | font-size: 20px; 144 | margin-left: 10px; 145 | } 146 | 147 | /* workspaces */ 148 | 149 | .active 150 | { 151 | color: #F5C2E7; 152 | } 153 | 154 | .workspaces 155 | { 156 | padding-top: 14px; 157 | font-size: 18px; 158 | } 159 | 160 | /* power */ 161 | 162 | .power-icon 163 | { 164 | color: #F28FAD; 165 | font-family: VictorMono Nerd Font Mono; 166 | font-size: 20px; 167 | margin-right: 10px; 168 | } 169 | 170 | .lock-btn 171 | { 172 | color: #D9E0EE; 173 | font-family: VictorMono Nerd Font Mono; 174 | font-size: 50px; 175 | } 176 | 177 | .lock-btn:hover 178 | { 179 | color: #F28FAD; 180 | font-family: VictorMono Nerd Font Mono; 181 | font-size: 50px; 182 | } 183 | 184 | .power-btn 185 | { 186 | color: #D9E0EE; 187 | font-family: VictorMono Nerd Font Mono; 188 | font-size: 50px; 189 | } 190 | 191 | .power-btn:hover 192 | { 193 | color: #F28FAD; 194 | font-family: VictorMono Nerd Font Mono; 195 | font-size: 50px; 196 | } 197 | 198 | .restart-btn 199 | { 200 | color: #D9E0EE; 201 | font-family: VictorMono Nerd Font Mono; 202 | font-size: 50px; 203 | } 204 | 205 | .restart-btn:hover 206 | { 207 | color: #F28FAD; 208 | font-family: VictorMono Nerd Font Mono; 209 | font-size: 50px; 210 | } 211 | 212 | .powermenu 213 | { 214 | background-color: #161320; 215 | border-radius: 15px; 216 | border: 5px solid #302D41; 217 | } 218 | 219 | /* menu */ 220 | 221 | .menu-box 222 | { 223 | margin-right: 65px; 224 | font-size: 20px; 225 | } 226 | 227 | /* launcher */ 228 | 229 | .launchermenu 230 | { 231 | background-color: #161320; 232 | border-radius: 15px; 233 | border: 5px solid #302D41; 234 | } 235 | 236 | .launcher-icon 237 | { 238 | margin-top: 10px; 239 | margin-left: 10px; 240 | } 241 | 242 | .launcher-pfp-label 243 | { 244 | font-family: VictorMono Nerd Font Mono; 245 | font-size: 20px; 246 | margin-left: 10px; 247 | } 248 | 249 | .launcher-pfp-label2 250 | { 251 | font-family: VictorMono Nerd Font Mono; 252 | font-size: 25px; 253 | margin-left: 10px; 254 | margin-top: 20px; 255 | } 256 | 257 | .launcher-btn 258 | { 259 | color: #D9E0EE; 260 | font-family: VictorMono Nerd Font Mono; 261 | font-size: 50px; 262 | margin-top: 80px; 263 | } 264 | 265 | .launcher-btn:hover 266 | { 267 | color: #F28FAD; 268 | font-family: VictorMono Nerd Font Mono; 269 | font-size: 50px; 270 | margin-top: 80px; 271 | } -------------------------------------------------------------------------------- /bar/eww.yuck: -------------------------------------------------------------------------------- 1 | ; includes: 2 | 3 | ;pollers 4 | (include "pollers.yuck") 5 | 6 | ;vars 7 | (include "vars.yuck") 8 | 9 | ;widgets 10 | (include "widgets.yuck") 11 | 12 | ;windows 13 | (defwindow bar 14 | :monitor 0 15 | :windowtype "dock" 16 | :geometry (geometry :x "0%" 17 | :y "-15px" 18 | :width "90%" 19 | :height "40px" 20 | :anchor "bottom center") 21 | :reserve (struts :side "bottom" :distance "6%") 22 | (bar)) 23 | 24 | (defwindow powermenu 25 | :monitor 0 26 | :geometry (geometry :x "-100px" 27 | :y "-80px" 28 | :width "5%" 29 | :height "40%" 30 | :anchor "bottom right") 31 | (powermenu)) 32 | 33 | (defwindow launchermenu 34 | :monitor 0 35 | :geometry (geometry :x "150px" 36 | :y "-80px" 37 | :width "20%" 38 | :height "50%" 39 | :anchor "bottom left") 40 | (launchermenu)) -------------------------------------------------------------------------------- /bar/pollers.yuck: -------------------------------------------------------------------------------- 1 | ; polls 2 | (defpoll time0 :interval "10s" "date '+%H':%M") 3 | (defpoll date :interval "10s" "date '+%b %d'") 4 | (defpoll memory :interval "15s" "scripts/memory") 5 | (defpoll cpu :interval "15s" "scripts/cpu") 6 | (defpoll volume_percent :interval "3s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") 7 | (defpoll mic_percent :interval "3s" "amixer -D pulse sget Capture | grep 'Mono:' | awk -F'[][]' '{ print $2 }' | tr -d '%'") 8 | 9 | (defpoll song_artist :interval "100ms" "scripts/music_info --song") 10 | (defpoll song_status :interval "100ms" "scripts/music_info --status") 11 | 12 | (defpoll ws :interval "1ms" "scripts/update-workspaces-1") -------------------------------------------------------------------------------- /bar/scripts/cpu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # credits to adi1090x 4 | 5 | PREV_TOTAL=0 6 | PREV_IDLE=0 7 | cpuFile="/tmp/.cpu_usage" 8 | 9 | get_cpu() { 10 | if [[ -f "${cpuFile}" ]]; then 11 | fileCont=$(cat "${cpuFile}") 12 | PREV_TOTAL=$(echo "${fileCont}" | head -n 1) 13 | PREV_IDLE=$(echo "${fileCont}" | tail -n 1) 14 | fi 15 | 16 | CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics. 17 | unset CPU[0] # Discard the "cpu" prefix. 18 | IDLE=${CPU[4]} # Get the idle CPU time. 19 | 20 | # Calculate the total CPU time. 21 | TOTAL=0 22 | 23 | for VALUE in "${CPU[@]:0:4}"; do 24 | let "TOTAL=$TOTAL+$VALUE" 25 | done 26 | 27 | if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then 28 | # Calculate the CPU usage since we last checked. 29 | let "DIFF_IDLE=$IDLE-$PREV_IDLE" 30 | let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL" 31 | let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10" 32 | echo "${DIFF_USAGE}" 33 | else 34 | echo "?" 35 | fi 36 | 37 | # Remember the total and idle CPU times for the next check. 38 | echo "${TOTAL}" > "${cpuFile}" 39 | echo "${IDLE}" >> "${cpuFile}" 40 | } 41 | get_cpu 42 | -------------------------------------------------------------------------------- /bar/scripts/memory: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}') -------------------------------------------------------------------------------- /bar/scripts/music_info: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | get_status () 4 | { 5 | if [ $(playerctl status) = "Playing" ]; then 6 | echo "" 7 | elif [ $(playerctl status) = "Paused" ]; then 8 | echo "" 9 | else 10 | echo "" 11 | fi 12 | } 13 | 14 | get_song () 15 | { 16 | if [ -z $(playerctl metadata title) ]; then 17 | echo "No song playing" 18 | else 19 | echo " $(playerctl metadata title) - $(playerctl metadata artist)" 20 | fi 21 | } 22 | 23 | 24 | if [[ "$1" == "--song" ]]; then 25 | get_song 26 | elif [[ "$1" == "--status" ]]; then 27 | get_status 28 | elif [[ "$1" == "--toggle" ]]; then 29 | playerctl play-pause 30 | elif [[ "$1" == "--next" ]]; then 31 | { playerctl next; get_cover; } 32 | elif [[ "$1" == "--prev" ]]; then 33 | { playerctl previous; get_cover; } 34 | fi -------------------------------------------------------------------------------- /bar/scripts/pop-launcher: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | launcher() { 4 | LOCK_FILE_LAUNCHER="$HOME/.cache/eww-launcher.lock" 5 | 6 | run() { 7 | eww open launchermenu -c ~/Documents/eww/bar/ 8 | } 9 | 10 | # Open widgets 11 | if [[ ! -f "$LOCK_FILE_LAUNCHER" ]]; then 12 | eww close launchermenu -c ~/Documents/eww/bar/ 13 | touch "$LOCK_FILE_LAUNCHER" 14 | run && echo "ok good!" 15 | elif [[ -f "$LOCK_FILE_LAUNCHER" ]]; then 16 | eww close launchermenu -c ~/Documents/eww/bar/ 17 | rm "$LOCK_FILE_LAUNCHER" && echo "closed" 18 | fi 19 | } 20 | 21 | launcher -------------------------------------------------------------------------------- /bar/scripts/pop-power: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | power() { 4 | LOCK_FILE_POWER="$HOME/.cache/eww-power.lock" 5 | 6 | run() { 7 | eww open powermenu -c ~/Documents/eww/bar/ 8 | } 9 | 10 | # Open widgets 11 | if [[ ! -f "$LOCK_FILE_POWER" ]]; then 12 | eww close powermenu -c ~/Documents/eww/bar/ 13 | touch "$LOCK_FILE_POWER" 14 | run && echo "ok good!" 15 | elif [[ -f "$LOCK_FILE_POWER" ]]; then 16 | eww close powermenu -c ~/Documents/eww/bar/ 17 | rm "$LOCK_FILE_POWER" && echo "closed" 18 | fi 19 | } 20 | 21 | power -------------------------------------------------------------------------------- /bar/scripts/update-workspaces-1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | gib_workspace_names() { 4 | wmctrl -d \ 5 | | awk '{ print $1 " " $2 " " $9 }' \ 6 | | grep -v NSP 7 | } 8 | 9 | gib_workspace_yuck() { 10 | buffered="" 11 | gib_workspace_names | while read -r id active name; do 12 | name="${name#*_}" 13 | if [ "$active" == '*' ]; then 14 | active_class="active" 15 | else 16 | active_class="inactive" 17 | fi 18 | 19 | if wmctrl -l | grep --regexp '.*\s\+'"$id"'\s\+.*' >/dev/null; then 20 | button_class="occupied" 21 | button_name="ﱣ" 22 | else 23 | button_class="empty" 24 | button_name="祿" 25 | fi 26 | buffered+="(button :class \"$button_class $active_class\" :onclick \"wmctrl -s $id\" \"$button_name\")" 27 | echo -n "$buffered" 28 | buffered="" 29 | done 30 | } 31 | 32 | 33 | box_attrs=':orientation "h" :class "workspaces" :space-evenly false :halign "center" :valign "center" :vexpand false :spacing 8 ' 34 | 35 | echo "(box $box_attrs $(gib_workspace_yuck))" 36 | 37 | -------------------------------------------------------------------------------- /bar/vars.yuck: -------------------------------------------------------------------------------- 1 | ; vars 2 | (defvar hover_vol false) 3 | (defvar hover_mic false) 4 | (defvar hover_mus false) 5 | (defvar eww "eww -c ~/Documents/eww/bar") -------------------------------------------------------------------------------- /bar/widgets.yuck: -------------------------------------------------------------------------------- 1 | ; widgets 2 | (defwidget bar [] 3 | (box :class "bar" 4 | :orientation "h" 5 | (vol) 6 | (workspaces) 7 | (power-time-cpu-mem-music))) 8 | 9 | (defwidget powermenu [] 10 | (box :class "powermenu" 11 | :orientation "v" 12 | (lock-power-restart))) 13 | 14 | 15 | (defwidget launchermenu [] 16 | (box :class "launchermenu" 17 | :orientation "v" 18 | (pfp))) 19 | 20 | (defwidget sep [] 21 | (box :orientation "h" 22 | :valign "center" 23 | (label :class "sepbar" :text "|"))) 24 | 25 | (defwidget workspaces [] 26 | (literal :content ws)) 27 | 28 | (defwidget music [] 29 | (box :class "music" 30 | :orientation "h" 31 | :space-evenly true 32 | :halign "center" 33 | :valign "center" 34 | :tooltip "music" 35 | (eventbox :onhover "${eww} update hover_mus=true" 36 | :onhoverlost "${eww} update hover_mus=false" 37 | (box :orientation "h" 38 | :space-evenly "false" 39 | :halign "start" 40 | :valign "center" 41 | (label :class "music-label" 42 | :text song_artist 43 | :wrap "true") 44 | (revealer :reveal hover_mus 45 | :transition "slideright" 46 | :duration "0.5" 47 | (box :orientation "h" 48 | :space-evenly "false" 49 | :halign "start" 50 | :valign "center" 51 | (button :class "song_btn_prev" :onclick "/home/okk/Documents/eww/bar/scripts/music_info --prev" "") 52 | (button :class "song_btn_play" :onclick "/home/okk/Documents/eww/bar/scripts/music_info --toggle" song_status) 53 | (button :class "song_btn_next" :onclick "/home/okk/Documents/eww/bar/scripts/music_info --next" ""))))))) 54 | 55 | (defwidget vol [] 56 | (box :class "micvol" 57 | :halign "start" 58 | :valign "center" 59 | :orientation "h" 60 | (box :class "menu-box" 61 | :orientation "h" 62 | :halign "end" 63 | :valign "center" 64 | :space-evenly "false" 65 | (button :onclick "/home/okk/Documents/eww/bar/scripts/pop-launcher" 66 | "")) 67 | (box :class "mic" 68 | (eventbox :onhover "${eww} update hover_mic=true" 69 | :onhoverlost "${eww} update hover_mic=false" 70 | (box :orientation "h" 71 | :space-evenly "false" 72 | :halign "start" 73 | :valign "center" 74 | (label :text "" 75 | :wrap "true" 76 | :class "mic-icon") 77 | (revealer :reveal true 78 | :transition "slideright" 79 | :duration "0.5" 80 | (scale :class "micbar" 81 | :orientation "h" 82 | :value mic_percent 83 | :tooltip "mic is on ${mic_percent}%" 84 | :min-value 0 85 | :max-value 100 86 | :onchange "amixer -D pulse sset Capture {}%"))))) 87 | (box :class "vol" 88 | (eventbox :onhover "${eww} update hover_vol=true" 89 | :onhoverlost "${eww} update hover_vol=false" 90 | (box :orientation "h" 91 | :space-evenly "false" 92 | :halign "start" 93 | :valign "center" 94 | (label :text "" 95 | :wrap "true" 96 | :class "vol-icon") 97 | (revealer :reveal true 98 | :transition "slideright" 99 | :duration "0.5" 100 | (scale :class "volbar" 101 | :orientation "h" 102 | :value volume_percent 103 | :tooltip "volume is on ${volume_percent}%" 104 | :min-value 0 105 | :max-value 100 106 | :onchange "amixer -D pulse sset Master {}%"))))))) 107 | 108 | (defwidget cpu-and-mem [] 109 | (box :class "cpu-and-mem" 110 | :orientation "h" 111 | :halign "end" 112 | :valign "center" 113 | :space-evenly "false" 114 | (circular-progress :class "cpu" 115 | :tooltip "using ${cpu}% cpu" 116 | :value cpu 117 | :thickness 12) 118 | (circular-progress :class "mem" 119 | :tooltip "using ${memory}% ram" 120 | :value memory 121 | :thickness 12))) 122 | 123 | (defwidget power-time-cpu-mem-music [] 124 | (box :class "time-cpu-mem" 125 | :halign "end" 126 | :valign "center" 127 | :space-evenly "false" 128 | :orientation "h" 129 | (music) 130 | (sep) 131 | (cpu-and-mem) 132 | (sep) 133 | (label :text "${date}/" 134 | :class "time-label" 135 | :halign "end" 136 | :valign "center" 137 | :space-evenly "false" 138 | :tooltip "time" 139 | :orientation "h") 140 | (label :text time0 141 | :class "time-label" 142 | :halign "end" 143 | :valign "center" 144 | :space-evenly "false" 145 | :tooltip "time" 146 | :orientation "h" 147 | ) 148 | (sep) 149 | (power))) 150 | 151 | (defwidget power [] 152 | (box :orientation "h" 153 | :halign "end" 154 | :valign "center" 155 | :space-evenly "false" 156 | (button :onclick "/home/okk/Documents/eww/bar/scripts/pop-power" 157 | :class "power-icon" 158 | :tooltip "power off" 159 | "⏻"))) 160 | 161 | (defwidget lock-power-restart [] 162 | (box :orientation "v" 163 | :halign "center" 164 | :valign "center" 165 | :space-evenly "false" 166 | :spacing 70 167 | (box :orientation "v" 168 | :halign "center" 169 | :valign "center" 170 | :space-evenly "false" 171 | (button :onclick "systemctl reboot" 172 | :class "restart-btn" 173 | :tooltip "restart" 174 | "")) 175 | (box :orientation "v" 176 | :halign "center" 177 | :valign "center" 178 | :space-evenly "false" 179 | (button :onclick "/home/okk/.config/herbstluftwm/bin/herblock.sh" 180 | :class "lock-btn" 181 | :tooltip "lock" 182 | "")) 183 | (box :orientation "v" 184 | :halign "center" 185 | :valign "center" 186 | :space-evenly "false" 187 | (button :onclick "systemctl poweroff" 188 | :class "power-btn" 189 | :tooltip "power off" 190 | "")))) 191 | 192 | (defwidget pfp [] 193 | (box :orientation "v" 194 | :space-evenly "false" 195 | :halign "middle" 196 | :valign "start" 197 | (image :path "/home/okk/Documents/eww/bar/assets/pfp.png" 198 | :class "launcher-icon" 199 | :image-width 250 200 | :image-height 250) 201 | (label :text "okklol" 202 | :class "launcher-pfp-label") 203 | (label :text "${time0} - ${date}" 204 | :class "launcher-pfp-label2") 205 | (box :orientation "h" 206 | :space-evenly true 207 | (button :class "launcher-btn" 208 | :onclick "spotify & disown" 209 | :tooltip "discord" 210 | "ﭮ") 211 | (button :class "launcher-btn" 212 | :onclick "spotify & disown" 213 | :tooltip "spotify" 214 | "") 215 | (button :class "launcher-btn" 216 | :onclick "steam & disown" 217 | :tooltip "steam" 218 | "") 219 | (button :class "launcher-btn" 220 | :onclick "firefox -P default-release & disown" 221 | :tooltip "firefox non-private" 222 | "") 223 | (button :class "launcher-btn" 224 | :onclick "code & disown" 225 | :tooltip "vscode" 226 | "﬏")))) 227 | --------------------------------------------------------------------------------