-
Notifications
You must be signed in to change notification settings - Fork 0
/
getTermInfo
executable file
·46 lines (40 loc) · 1.46 KB
/
getTermInfo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
outfile=/home/$USER/.config/WallFade/TermInfo
TTY=$(tty | grep -Eo '[0-9]{0,9}')
WID=$(wmctrl -l | grep -Eo [0-9]{1}x[0-9a-f]{8} | tail -1)
X=$(xwininfo -id $WID | grep -E 'Absolute upper-left X: [0-9]{0,6}' | grep -Eo '[0-9]{0,6}')
Y=$(xwininfo -id $WID | grep -E 'Absolute upper-left Y: [0-9]{0,6}' | grep -Eo '[0-9]{0,6}')
if [ $(echo $WID | cut -c2-2) = "x" ]
then
if [[ 'lsof | grep $outfile' ]]
then
echo $TTY >> $outfile
echo $WID >> $outfile
echo $X >> $outfile
echo $Y >> $outfile
else
sleep 0.1
echo $TTY >> $outfile
echo $WID >> $outfile
echo $X >> $outfile
echo $Y >> $outfile
fi
fi
for (( i=1; i <= $(cat ~/.config/WallFade/TermColors | wc -l); i=$(( $i + 5 )) ))
do
MonXPos=$(cat ~/.config/WallFade/TermColors | head -$(( $i + 2 )) | tail -1)
MonXSize=$(cat ~/.config/WallFade/TermColors | head -$i | tail -1)
MonYPos=$(cat ~/.config/WallFade/TermColors | head -$(( $i + 3 )) | tail -1)
MonYSize=$(cat ~/.config/WallFade/TermColors | head -$(( $i + 1)) | tail -1)
if [ $X -ge $MonXPos ] && [ $X -lt $(( $MonXPos + $MonXSize )) ]
then
if [ $Y -ge $MonYPos ] && [ $Y -lt $(( $MonYPos + $MonYSize )) ]
then
#echo "$X >= $MonXPos < $(( $MonXPos + $MonXSize ))"
#echo "$Y >= $MonYPos < $(( $MonYPos + $MonYSize ))"
#echo "Setting color to #$(cat ~/.config/WallFade/TermColors | head -$(( $i + 4 )) | tail -1)"
printf "\033]10;#$(cat ~/.config/WallFade/TermColors | head -$(( $i + 4 )) | tail -1)\007"
fi
fi
done
$SHELL