first commit

This commit is contained in:
ShakedGold 2023-06-12 12:27:36 +03:00
commit e2e03d0832
3 changed files with 43 additions and 0 deletions

25
scripts/daemon.sh Executable file
View file

@ -0,0 +1,25 @@
#! /bin/bash
missioncontroldir=$HOME/.config/hyprmsn
mkdir $missioncontroldir/windows 2> /dev/null
window=$(hyprctl activewindow -j | jq --raw-output .title)
rm -rf $missioncontroldir/windows/* 2> /dev/null
while true; do
new_window=$(hyprctl activewindow -j | jq --raw-output .title)
new_window=$(echo $new_window | sed 's/\[\([^]]*\)\]/\\[\1\\]/g') #add \ to []
new_window=$(echo $new_window | sed 's/'\''\.\*\\^//g') #add \ to special characters
if [[ "$window" == "$new_window" ]]; then
continue
fi
window=$new_window
at_size=$(hyprctl clients | sed -n "/$window/,/^\$/p" | grep -Ew 'at|size' | tr -d '[a-z]|:|\t| ')
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.jpeg"
done