Skip to content

Commit 35f3f1b

Browse files
authored
Merge branch 'prasanthrangan:main' into main
2 parents 2fa3535 + 911d625 commit 35f3f1b

File tree

6 files changed

+144
-16
lines changed

6 files changed

+144
-16
lines changed

Configs/.config/hyde/hyde.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,31 @@ rofiScale=9
8787
#// available styles - 1 (default) , 2
8888
wlogoutStyle=1
8989

90+
# waybar
91+
92+
# // waybar_cava_bar - bar for waybar cava - default "▁▂▃▄▅▆▇█"
93+
# waybar_cava_bar="░▒▓█"
94+
# waybar_cava_bar="▖▗▘▙▚▛▜▝▞▟"
95+
# waybar_cava_bar="▂▃▄▅▆▇█"
96+
# waybar_cava_bar="▕▏▎▍▌▋▊▉"
97+
# waybar_cava_bar="⣀⣄⣤⣦⣶⣷⣿"
98+
# waybar_cava_bar="⠁⠂⠄⡀⢀⠠⠐⠈"
99+
# waybar_cava_bar="⠋⠙⠹⢸⣰⣤⣦⣶"
100+
# waybar_cava_bar="🌑🌒🌓🌔🌕🌖🌗🌘"
101+
# waybar_cava_bar="🌕🌖🌗🌘🌒🌓🌔🌕"
102+
# waybar_cava_bar="★☆★☆★☆★☆"
103+
# waybar_cava_bar="⣾⣽⣻⢿⡿⣟⣯⣷"
104+
# waybar_cava_bar="ᗧᗣᗤᗥᗦᗧᗣᗤᗥᗦ"
105+
106+
# // waybar_cava_width - width for waybar cava - default 8
107+
# waybar_cava_width=10
108+
109+
# // waybar_cava_range - range for waybar cava - default 7
110+
# waybar_cava_range=7
111+
112+
# // waybar_cava_stbmode - standby mode for waybar cava - default 0
113+
# 0: clean - totally hides the module
114+
# 1: blank - makes module expand as spaces
115+
# 2: full - occupies the module with full bar
116+
# 3: low - makes the module display the lowest set bar
117+
# waybar_cava_stbmode=0
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"custom/cava": {
2+
"format": "{}",
23
"exec": "waybar_cava.sh",
3-
"format": "{}"
4-
},
4+
"restart-interval": 1,
5+
"hide-empty": true
6+
},

Configs/.local/share/bin/logoutlaunch.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export fntSize=$(( y_mon * 2 / 100 ))
5555
#// detect wallpaper brightness
5656

5757
[ -f "${cacheDir}/wall.dcol" ] && source "${cacheDir}/wall.dcol"
58+
# Theme mode: detects the color-scheme set in hypr.theme and falls back if nothing is parsed.
59+
if [ "${enableWallDcol}" -eq 0 ]; then
60+
colorScheme="$({ grep -q "^[[:space:]]*\$COLOR[-_]SCHEME\s*=" "${hydeThemeDir}/hypr.theme" && grep "^[[:space:]]*\$COLOR[-_]SCHEME\s*=" "${hydeThemeDir}/hypr.theme" | cut -d '=' -f2 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' ;} ||
61+
grep 'gsettings set org.gnome.desktop.interface color-scheme' "${hydeThemeDir}/hypr.theme" | awk -F "'" '{print $((NF - 1))}')"
62+
colorScheme=${colorScheme:-$(gsettings get org.gnome.desktop.interface color-scheme)}
63+
# should be declared explicitly so we can easily debug
64+
grep -q "dark" <<< "${colorScheme}" && dcol_mode="dark"
65+
grep -q "light" <<< "${colorScheme}" && dcol_mode="light"
66+
[ -f "${hydeThemeDir}/theme.dcol" ] && source "${hydeThemeDir}/theme.dcol"
67+
fi
5868
[ "${dcol_mode}" == "dark" ] && export BtnCol="white" || export BtnCol="black"
5969

6070

Configs/.local/share/bin/swwwallbash.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env bash
22

3-
43
#// set variables
54

65
export scrDir="$(dirname "$(realpath "$0")")"
@@ -14,7 +13,6 @@ if [ -z "${wallbashImg}" ] || [ ! -f "${wallbashImg}" ] ; then
1413
echo "Error: Input wallpaper not found!"
1514
exit 1
1615
fi
17-
1816
wallbashOut="${dcolDir}/$(set_hash "${wallbashImg}").dcol"
1917

2018
if [ ! -f "${wallbashOut}" ] ; then
@@ -23,6 +21,11 @@ fi
2321

2422
set -a
2523
source "${wallbashOut}"
24+
if [ -f "${hydeThemeDir}/theme.dcol" ] && [ "${enableWallDcol}" -eq 0 ] ; then
25+
source "${hydeThemeDir}/theme.dcol"
26+
echo "[theme] Overriding dominant colors from \"${hydeTheme}\""
27+
echo "[note] Remove \"${hydeThemeDir}/theme.dcol\" to use wallpaper dominant colors"
28+
fi
2629
[ "${dcol_mode}" == "dark" ] && dcol_invt="light" || dcol_invt="dark"
2730
set +a
2831

@@ -263,5 +266,4 @@ if [ "${enableWallDcol}" -eq 0 ]; then
263266
grep -q "light" <<< "${colorScheme}" && enableWallDcol=3
264267
fi
265268

266-
find "${wallbashDir}/Wall-Ways" -type f -name "*.dcol" | parallel fn_wallbash {}
267-
269+
find "${wallbashDir}/Wall-Ways" -type f -name "*.dcol" | parallel fn_wallbash {}
Lines changed: 92 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,117 @@
11
#!/bin/env bash
22
#----- Optimized bars animation without much CPU usage increase --------
3-
bar="▁▂▃▄▅▆▇█"
3+
#----- Optimized bars animation without much CPU usage increase pt2 --------
4+
5+
scrDir=$(dirname "$(realpath "$0")")
6+
# shellcheck source=/dev/null
7+
. "${scrDir}/globalcontrol.sh"
8+
usage() {
9+
cat <<HELP
10+
Usage: $(basename "$0") [OPTIONS]
11+
12+
Options:
13+
--bar <waybar_cava_bar> Specify the characters to use for the bar animation (default: ▁▂▃▄▅▆▇█).
14+
--width <waybar_cava_width> Specify the width of the bar.
15+
--range <waybar_cava_range> Specify the range of the bar.
16+
--help Display this help message and exit.
17+
--restart Restart the waybar_cava.
18+
--mode <waybar_cava_stbmode> Specify the standby mode for waybar cava (default: 0).
19+
HELP
20+
exit 1
21+
}
22+
23+
# Parse command line arguments using getopt
24+
if ! ARGS=$(getopt -o "hr" -l "help,bar:,width:,range:,restart,mode:" -n "$0" -- "$@"); then
25+
usage
26+
fi
27+
28+
eval set -- "$ARGS"
29+
while true; do
30+
case "$1" in
31+
--help | -h)
32+
usage
33+
;;
34+
--bar)
35+
waybar_cava_bar="$2"
36+
shift 2
37+
;;
38+
--width)
39+
waybar_cava_width="$2"
40+
shift 2
41+
;;
42+
--range)
43+
waybar_cava_range="$2"
44+
shift 2
45+
;;
46+
--restart) # restart the waybar_cava
47+
pkill -f "cava -p /tmp/bar_cava_config"
48+
exit 0
49+
;;
50+
--mode)
51+
waybar_cava_stbmode="$2"
52+
shift 2
53+
;;
54+
--)
55+
shift
56+
break
57+
;;
58+
*)
59+
usage
60+
;;
61+
esac
62+
done
63+
64+
bar="${waybar_cava_bar:-▁▂▃▄▅▆▇█}"
465
dict="s/;//g"
566

667
# Calculate the length of the bar outside the loop
768
bar_length=${#bar}
69+
bar_width=${waybar_cava_width:-${bar_length}}
70+
bar_range=${waybar_cava_range:-$((bar_length - 1))}
871

72+
standby_mode=${waybar_cava_stbmode:-0} # 0:clean, 1:blank, 2:full,3:last
73+
if [ "${standby_mode}" -le 0 ]; then unset standby_bar; fi
974
# Create dictionary to replace char with bar
10-
for ((i = 0; i < bar_length; i++)); do
11-
dict+=";s/$i/${bar:$i:1}/g"
75+
i=0
76+
while [ $i -lt "${bar_length}" ] || [ $i -lt "${bar_width}" ]; do
77+
if [ $i -lt "${bar_length}" ]; then
78+
dict="$dict;s/$i/${bar:$i:1}/g"
79+
fi
80+
if [ $i -lt "${bar_width}" ] && [ "${standby_mode}" -gt 0 ]; then
81+
if [ "${standby_mode}" -eq 2 ]; then
82+
standby_bar="$standby_bar${bar:$i:1}"
83+
elif [ "${standby_mode}" -eq 1 ]; then
84+
standby_bar="$standby_bar "
85+
fi
86+
fi
87+
((i++))
1288
done
1389

1490
# Create cava config
1591
config_file="/tmp/bar_cava_config"
1692
cat >"$config_file" <<EOF
1793
[general]
18-
bars = 10
94+
bars = ${bar_width}
95+
sleep_timer = 1
1996
2097
[input]
2198
method = pulse
2299
source = auto
23-
24100
[output]
25101
method = raw
26102
raw_target = /dev/stdout
27103
data_format = ascii
28-
ascii_max_range = 7
104+
ascii_max_range = ${bar_range}
29105
EOF
30106

31-
# Kill cava if it's already running
32-
pkill -f "cava -p $config_file"
107+
listen_to_cava() {
108+
echo ""
109+
while IFS= read -r line; do
110+
if grep -qE "^0;(0;)*$" <<<"$line" && [ "${standby_mode}" -ne 3 ]; then echo "${standby_bar}" && continue; fi
111+
sed -u "$dict" <<<"${line}"
112+
done < <(cava -p "$config_file")
113+
}
33114

34-
# Read stdout from cava and perform substitution in a single sed command
35-
cava -p "$config_file" | sed -u "$dict"
115+
# Call the function
116+
listen_to_cava &
117+
disown # saves a tiny bit of memory

Scripts/themepatcher.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ while IFS= read -r fchk; do
115115
print_prompt -y "[!!] " "${fchk} --> do not exist in ${Theme_Dir}/Configs/"
116116
fi
117117
done <<< "$config"
118+
if [ -f "${Fav_Theme_Dir}/theme.dcol" ];then
119+
print_prompt -n "[ok] " "found theme.dcol to override wallpaper dominant colors"
120+
restore_list+="Y|Y|\${HOME}/.config/hyde/themes/${Fav_Theme}|theme.dcol|hyprland\n"
121+
fi
118122
readonly restore_list
119123

120124
# Get Wallpapers

0 commit comments

Comments
 (0)