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

@ -1,5 +1,5 @@
#! /bin/bash
missioncontroldir=$HOME/.config/hyprmsn
hyprmsn=$HOME/.config/hyprmsn
OLDIFS="$IFS"
IFS=$'\n' # bash specific
@ -8,8 +8,8 @@ do
special_line=$line
special_line=$(echo $special_line | sed 's/\[\([^]]*\)\]/\\[\1\\]/g') #add \ to []
special_line=$(echo $special_line | sed 's/'\''\.\*\\^//g') #add \ to special characters
icon=$(ls "$missioncontroldir/windows" | grep -F $special_line)
echo -en "$line\x00icon\x1f$missioncontroldir/windows/$icon\n"
icon=$(ls "$hyprmsn/windows" | grep -F $special_line)
echo -en "$line\x00icon\x1f$hyprmsn/windows/$icon\n"
done | rofi -dmenu )
IFS="$OLDIFS"

View file

@ -1,9 +1,9 @@
#! /bin/bash
missioncontroldir=$HOME/.config/hyprmsn
mkdir $missioncontroldir/windows 2> /dev/null
hyprmsn=$HOME/.config/hyprmsn
mkdir $hyprmsn/windows 2> /dev/null
window=$(hyprctl activewindow -j | jq --raw-output .title)
rm -rf $missioncontroldir/windows/*.jpeg 2> /dev/null
rm -rf $hyprmsn/windows/*.jpeg 2> /dev/null
while true; do
new_window=$(hyprctl activewindow -j | jq --raw-output .title)
@ -20,5 +20,5 @@ while true; do
at=$(echo $at_size | tr ' ' '\n' | head -1 | tail -1)
size=$(echo $at_size | tr ' ' '\n' | head -2 | tail -1 | tr ',' 'x')
sleep 0.4
grim -g "$at $size" -t jpeg -q 50 "$missioncontroldir/windows/$window_no_slash.jpeg"
grim -g "$at $size" -t jpeg -q 50 "$hyprmsn/windows/$window_no_slash.jpeg"
done

19
scripts/load_config.sh Executable file
View file

@ -0,0 +1,19 @@
#! /bin/bash
config=$HOME/.config/hyprmsn/config.ini
section() {
section_name=$1
sed -n "/\[$section_name\]/,/^$/p" $config | sed -E "s/\[.*\]//g" | sed '/^[[:space:]]*$/d'
}
# daemon section
section daemon > /dev/null
# SOURCING
# support comments
sed "s/;/#/g" $config | grep -Ev "\[.*\]" | source /dev/stdin
# remove spaces
source <(grep = $config | sed 's/ *= */=/g')