Skip to content

Commit

Permalink
feat(polybar): updated polybar cava integration
Browse files Browse the repository at this point in the history
  • Loading branch information
umgbhalla committed Nov 26, 2022
1 parent 61f5b9a commit 53183bd
Show file tree
Hide file tree
Showing 14 changed files with 665 additions and 203 deletions.
89 changes: 83 additions & 6 deletions base/programs/program-list

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion base/scripts/.scripts/boxes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/env bash

box=$(echo -en "archlinux\nalpine\ndebian\nubuntu:20.04\nfedora\nnode:14.20.0-bullseye-slim\nmcr.microsoft.com/playwright\nmcr.microsoft.com/playwright:v1.25.0-focal" | fzf -i +m --height 10% --reverse )
box=$(echo -en "bytelearn/hcsolveer:preprod\npython:3.11\narchlinux\nalpine\ndebian\nubuntu:20.04\nfedora\nnode:14.20.0-bullseye-slim\nmcr.microsoft.com/playwright\nmcr.microsoft.com/playwright:v1.25.0-focal" | fzf -i +m --height 10% --reverse )
echo $box
docker run -w /workdir -p 8000:8000 -it --rm -v `pwd`:/workdir $box bash
2 changes: 1 addition & 1 deletion base/scripts/.scripts/p_now
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
power=$(echo -en "$(cat /sys/class/power_supply/BAT0/power_now) / 1000000" | kalker)
power=$(echo -en "$(cat /sys/class/power_supply/BAT0/power_now) / 1000000" | kalker -p 4)
echo -en "$power watts"

347 changes: 176 additions & 171 deletions base/zsh/.config/zsh/.zcompdump

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions base/zsh/.config/zsh/profile.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ pth $ANDROID_SDK_ROOT/tools/
pth $HOME/.node_modules/bin
pth $HOME/.yarn/bin
pth $HOME/.config/yarn/global/node_modules/.bin
pth $HOME/.deta/bin
pth $HOME/.cargo/bin
pth $HOME/.local/share/gem/ruby/3.0.0/bin
pth /usr/local/go/bin
Expand Down
4 changes: 2 additions & 2 deletions themes/cr0nus/bspwm/.config/bspwm/bspwmrc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ c window_gap 0
c left_padding 10
c right_padding 10
c top_padding 36
c bottom_padding 10
c bottom_padding 36
#unixporn mode
# c bottom_padding 10
# c left_padding 60
Expand Down Expand Up @@ -95,7 +95,7 @@ R Slack desktop='^9'
R "Vivaldi-stable" desktop='^1'
R notion-app desktop='^4'
R "discord" desktop='^10'
R "code" desktop='^5'
R "Code" desktop='^5'
R firefox desktop='^2'
R Emacs desktop='^1' state='tiled'
R "Thunar" state='floating'
Expand Down
2 changes: 1 addition & 1 deletion themes/cr0nus/dunst/.config/dunst/dunstrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
class = Dunst
corner_radius = 0
ignore_dbusclose = false
highlight = "#EA0068"
highlight = "#C58AF9"
force_xwayland = false

### Legacy
Expand Down
26 changes: 14 additions & 12 deletions themes/cr0nus/polybar/.config/polybar/bars.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fixed-center = true
# Dimension defined as pixel value (e.g. 35) or percentage (e.g. 50%),
# the percentage can optionally be extended with a pixel offset like so:
# 50%:-10, this will result in a width or height of 50% minus 10 pixels
width = 80%
width = 85%
height = 30

# Offset defined as pixel value (e.g. 35) or percentage (e.g. 50%)
Expand Down Expand Up @@ -101,10 +101,10 @@ font-4 = "CaskaydiaCove Nerd Font:size=14;6"
; # Opacity value between 0.0 and 1.0 used on fade in/out

# Modules are added to one of the available blocks
modules-left = sps sps date_i date calendar_i sps battery sps power
modules-center = bspwm
modules-left = sps date_i date calendar_i sps backlight sps battery sps audio_i sps memory sps network separatorIndent cpu power
modules-center =
; modules-center = polywins sps mod sps bspwm spotify separatorIndent
modules-right = bluetooth sps memory sps network cpu separatorIndent sps
modules-right = bluetooth sps bspwm
dim-value = 1.0
; line-size = 2
# Restack the bar window and put it above the
Expand All @@ -129,6 +129,8 @@ enable-ipc = true
; tray-background = ${color.alt-bg}
; tray-scale = 1
; tray-detached = true
scroll-up = bright_light up
scroll-down = bright_light down


[bar/systray]
Expand Down Expand Up @@ -195,12 +197,12 @@ enable-ipc = true

[bar/sub]
bottom = true
override-redirect = true
override-redirect = false
fixed-center = true
width = 96.875%
height = 60
offset-x = 1.56%
offset-y = -29
width = 96%
height = 66
offset-x = 2%
offset-y = -34
# Background ARGB color (e.g. #f00, #ff992a, #ddff1023)
background = ${color.alt-bg}
; background = #00000000
Expand Down Expand Up @@ -262,9 +264,9 @@ font-4 = "CaskaydiaCove Nerd Font:size=15;-11"


# Modules are added to one of the available blocks
modules-left = sps sps ffrecord screenss sps ocr sps battery
modules-center = ytm
modules-right = sps audio_i sps sps backlight sps sps
modules-left =
modules-center = cava
modules-right =
dim-value = 1.0
; line-size = 2
# Restack the bar window and put it above the
Expand Down
42 changes: 42 additions & 0 deletions themes/cr0nus/polybar/.config/polybar/cava.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#! /bin/bash

# bar="⠀▂▃▄▅▆▇█"
# bar="​▂▃▄▅▆▇█"
bar="▁▂▃▄▅▆▇█"
dict="s/;//g;"

# creating "dictionary" to replace char with bar
i=0
while [ $i -lt ${#bar} ]
do
dict="${dict}s/$i/${bar:$i:1}/g;"
i=$((i=i+1))
done

# make sure to clean pipe
pipe="/tmp/cava.fifo"
if [ -p $pipe ]; then
unlink $pipe
fi
mkfifo $pipe

# write cava config
config_file="/tmp/polybar_cava_config"
echo "
[general]
bars = 130
[output]
method = raw
raw_target = $pipe
data_format = ascii
ascii_max_range = 7
" > $config_file

# run cava in the background
cava -p $config_file &

# reading data from fifo
while read -r cmd; do
echo $cmd | sed $dict
done < $pipe
4 changes: 2 additions & 2 deletions themes/cr0nus/polybar/.config/polybar/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ green = #9ec49f
yellow = #c4c19e
magenta =#c49ec4
blue = #a39ec4
blue2 = #fc0068
blue3 = #EA0068
blue2 = #C58AF9
blue3 = #a56Ac9
blue4 = #605f74
cyan = #9ec3c4
6 changes: 3 additions & 3 deletions themes/cr0nus/polybar/.config/polybar/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ xdo raise -a "polybar-sub_eDP-1"

sleep 3
# hiding some bars
hideIt.sh --name '^polybar-sub_eDP-1$' -w --peek 4 -d bottom -i 1 --hover &
echo "########################################################################"
notify-send "hiding sub bar "
# hideIt.sh --name '^polybar-sub_eDP-1$' -w --peek 4 -d bottom -i 1 --hover &
# echo "########################################################################"
# notify-send "hiding sub bar "
# hideIt.sh --name '^polybar-main_eDP-1$' -w --peek 4 -d bottom -i 1 --hover &
# echo "########################################################################"
# echo "hiding main bar "
Expand Down
16 changes: 16 additions & 0 deletions themes/cr0nus/polybar/.config/polybar/modules.ini
Original file line number Diff line number Diff line change
Expand Up @@ -628,3 +628,19 @@ interval = 2
format-padding = 1
format-foreground = ${color.cyan}
format-background = ${color.alt-bg}

[module/cava]
type = custom/script
tail = true
label-foreground = ${color.blue2}
exec = $HOME/.config/polybar/cava.sh
; exec-if = pgrep -f "/opt/spotify/spotify --uri"
format = <label>
format-font = 4
label = %output%
click-right = playerctl play-pause &
click-left = playerctl next &
click-middle = playerctl previous &
scroll-up = volume up
scroll-down = volume down

Loading

0 comments on commit 53183bd

Please sign in to comment.