You could do something like:
xdotool search --onlyvisible . behave %@ focus getwindowgeometry |
while read x id && read x && read x; do
eval "$(xprop -notype -id "$id" \
8s '=$0\n' WM_CLASS \
32a '="$0+"\n' _NET_WM_STATE)"
[ "$WM_CLASS" = gnome-terminal ] &&
[ "$_NET_WM_STATE" = "_NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ" ]
rc=$?
if [ "$rc" != "$last_rc" ]; then
if [ "$rc" -eq 0 ]; then
echo "set high brightness"
else
echo "set low brightness"
fi
last_rc=$rc
fi
done
Replace the echo ...
with the actual command to set the brightness.
The idea is to use xdotool
to get notified when the window focus changes. Then, we use xprop
on the window id reported by xdotool
to see if the window that currently has the focus is gnome-terminal
and is maximised.
However, it doesn't work for windows that have connected after xdotool
has started.
A more robust method could be to just check the current active window in a loop:
while :; do
# wait for a focus event:
sh -c 'exec xdotool search --onlyvisible . behave %@ focus exec kill "$$"' 2> /dev/null
id=$(xdotool getactivewindow)
eval "$(xprop -notype -id "$id" \
8s '=$0\n' WM_CLASS \
32a '="$0+"\n' _NET_WM_STATE)"
[ "$WM_CLASS" = gnome-terminal ] &&
[ "$_NET_WM_STATE" = "_NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ" ]
rc=$?
if [ "$rc" != "$last_rc" ]; then
if [ "$rc" -eq 0 ]; then
echo "set high brightness"
else
echo "set low brightness"
fi
last_rc=$rc
fi
done
You can find out more details through the xdotool man page.
Best Answer
Go to the Settings panel, then to the Window Manager, Keyboard Tab. In here you can assign Win+Arrows to Tile window to the right, Tile window to the left, and also to Maximize and Minimize window.