aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts
diff options
context:
space:
mode:
authorSherLock707 <kirangeorge1995@gmail.com>2023-12-29 14:52:13 +0530
committerSherLock707 <kirangeorge1995@gmail.com>2023-12-29 14:52:13 +0530
commit8f2104a3a0d0f1c5561917e9ec2dd61622a65926 (patch)
treeb69281ad02a353d6a98a392a767a9e933a31a785 /config/hypr/scripts
parent46677e3f5bbc124459c5fa8b84d51ae22c7ad8ae (diff)
Added custom cava based music visualizer for waybar
Diffstat (limited to 'config/hypr/scripts')
-rwxr-xr-xconfig/hypr/scripts/waybar_cava.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/config/hypr/scripts/waybar_cava.sh b/config/hypr/scripts/waybar_cava.sh
new file mode 100755
index 00000000..2ecc4d0b
--- /dev/null
+++ b/config/hypr/scripts/waybar_cava.sh
@@ -0,0 +1,59 @@
+# #! /bin/bash
+
+# --------------------Smooth bars animation with 1-2% increase in CPU usage -------------------
+# 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
+
+# # write cava config
+# config_file="/tmp/polybar_cava_config"
+# echo "
+# [general]
+# bars = 10
+
+# [output]
+# method = raw
+# raw_target = /dev/stdout
+# data_format = ascii
+# ascii_max_range = 7
+# " > $config_file
+
+# # read stdout from cava
+# cava -p $config_file | while read -r line; do
+# echo $line | sed $dict
+# done
+
+# --------------------Optimized bars animation with 1-2% increase in CPU usage -------------------
+bar="▁▂▃▄▅▆▇█"
+dict="s/;//g"
+
+# Calculate the length of the bar outside the loop
+bar_length=${#bar}
+
+# Create dictionary to replace char with bar
+for ((i = 0; i < bar_length; i++)); do
+ dict+=";s/$i/${bar:$i:1}/g"
+done
+
+# Create cava config
+config_file="/tmp/polybar_cava_config"
+cat >"$config_file" <<EOF
+[general]
+bars = 10
+
+[output]
+method = raw
+raw_target = /dev/stdout
+data_format = ascii
+ascii_max_range = 7
+EOF
+
+# Read stdout from cava and perform substitution in a single sed command
+cava -p "$config_file" | sed -u "$dict"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage