config.ini and ability to use icons
This commit is contained in:
parent
e30b32499e
commit
e87284afc5
6 changed files with 73 additions and 8 deletions
3
config.ini
Normal file
3
config.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[daemon]
|
||||
use_icons=false
|
||||
icon_pack=Papirus
|
|
@ -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 ")"
|
||||
|
|
24
install.sh
24
install.sh
|
@ -1,4 +1,28 @@
|
|||
#! /bin/bash
|
||||
|
||||
# prerequisites
|
||||
if ! command -v eww &> /dev/null
|
||||
then
|
||||
echo "eww could not be found"
|
||||
echo "install eww-wayland to continue"
|
||||
exit
|
||||
fi
|
||||
|
||||
if ! command -v grim &> /dev/null
|
||||
then
|
||||
echo "grim could not be found"
|
||||
echo "install grim to continue"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
mkdir ~/.config/eww 2> /dev/null
|
||||
echo "created eww dir if it didn't existed"
|
||||
cp -r eww/* ~/.config/eww
|
||||
echo "copied the hyprmsn folder to the eww config"
|
||||
mkdir ~/.config/hyprmsn 2> /dev/null
|
||||
echo "created the hyprmsn dir"
|
||||
cp -r scripts windows ~/.config/hyprmsn/
|
||||
echo "copied the scripts, windows to the hyprmsn dir"
|
||||
cp config.ini ~/.config/hyprmsn/
|
||||
echo "copied the config.ini to the hyprmsn dir"
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
19
scripts/load_config.sh
Executable 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')
|
Loading…
Add table
Add a link
Reference in a new issue