Script to Set Window Opacity in Linux Mint/Cinnamon


Simple Usage:

set-opacity.sh [window_title] [opacity_level (optional)]

So, for example:

set-opacity.sh firefox 70

Here’s the set-opacity.sh script:

if [ -z "$1" ]; then
	echo "Need window name (and optional opacity)"
	exit 1
fi
OPACITY=$2
if [ -z "$2" ]; then
	OPACITY=50
fi
WINDOWID=$(wmctrl -lx | grep -i "$1" | cut -d" " -f1)
if [ -z "$WINDOWID" ]; then
	echo "Title not found $1"
	exit 1
fi
xprop -id "$WINDOWID" -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY "$(printf 0x%x $((0xffffffff * OPACITY / 100)))"

Modified from a script found in here: https://github.com/smurphos/nemo_actions_and_cinnamon_scripts