config.ini and ability to use icons

This commit is contained in:
ShakedGold 2023-07-07 13:34:47 +03:00
parent e30b32499e
commit e87284afc5
6 changed files with 73 additions and 8 deletions

View file

@ -32,16 +32,35 @@ echo "(box"
OLD_IFS="$IFS"
IFS=$'\n'
windows=$(hyprctl clients | rg 'Window ([A-Fa-f0-9]+)' | sed -E 's/.*\-> (.*):/\1/g')
classes=$(hyprctl clients | rg 'class: ' | sed "s/.*class: //g")
source $HOME/.config/hyprmsn/scripts/load_config.sh
i=1
for window in $windows; do
window_class=$(echo $classes | tr ' ' '\n' | head -$i | tail -1)
window_str=$(trun $window)
window_img=$(img $window)
if [ $use_icons == true ]; then
find_icon=$(find /usr/share/icons/$icon_pack -iname "$window_class*" | head -4 | tail -1)
if [[ $find_icon == "/usr/share/icons/$icon_pack" ]]; then
window_img=$(img $window)
fi
window_img=$find_icon
else
window_img=$(img $window)
fi
#echo $window_img
eww="(box :orientation \"v\" :class \"window-box\" (image :path \"$window_img\" :image-width 192 :image-height 108) (button :onclick \"scripts/move_to_window.sh \'$window\'\" :class \"window-button\" (box :orientation \"v\" "
eww="(box :orientation \"v\" :class \"window-box\" (image :path \"$window_img\" :image-width 192 :image-height 108) (button :onclick \"$HOME/.config/eww/hyprmsn/scripts/move_to_window.sh \'$window\'\" :class \"window-button\" (box :orientation \"v\" "
for string in $(echo -e $window_str); do
eww="$eww $(echo -e "(label :text \"$string\")")"
done
eww="$eww)))"
echo $eww
i=$(( $i + 1 ))
done
IFS=$OLD_IFS
echo ")"