all repos — zenUtils @ 3c181c194ad82c1afddd0dd32ae5aa3e5e41d840

misc utilities for computing zen

transsetter.sh (raw)

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
47
48
#!/bin/sh

# A background script to provide terminal/editor compositing in a Ryudo
# session.
# Licensed under the MIT License -- do what you want with it.
# Copyleft 2021 Derek Stevens <drkste@zoho.com>

termprog=Alacritty
geditor=kate
opacity=0.85

setter=$(which transset)
if [ -z "$setter" ]; then
  setter=$(which transset-df)
fi

if [ -z "$setter" ]; then
  echo "we need transset or transset-df in PATH!"
  exit 1
fi

if which xcompmgr > /dev/null; then
  xcompmgr -n&
else
  ehco "we need xcompmgr in PATH!"
  exit 1
fi

if ! which xshove > /dev/null; then
  echo "we need xshove in PATH!"
  exit 1
fi

wlist=$(mktemp)

while true; do
  xshove > $wlist
  while read wprop; do
    wid=$(echo ${wprop} | awk '{print $1}')
    wclass=$(echo ${wprop} | awk '{print $3}')
		if [ "$wclass" = "${geditor}" ]; then
			$setter -i 0x$wid ${opacity} > /dev/null
		elif [ "${wclass}" = "${termprog}" ]; then
			$setter -i 0x$wid ${opacity} > /dev/null
	  fi
  done < $wlist
  sleep 0.2
done