Created
May 11, 2019 14:31
-
-
Save danielsanfr/970aeb7232041544f17c15c5af510813 to your computer and use it in GitHub Desktop.
Adjust WM_CLASS of Android Studio Beta version on GNU/Linux (and X.org) so you can have 2 different icons on docks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Update WM_CLASS | |
fault_tolerance=0 | |
beta_timeout=50 | |
while true; do | |
wids=$(timeout 2 xdotool search --sync --onlyvisible --class "jetbrains-studio") | |
if [ -z "$wids" ] ; then | |
if [ $fault_tolerance -eq 0 ]; then | |
fault_tolerance=1 | |
else | |
echo "Can't find any Android Studio Beta window" | |
exit 0 | |
fi | |
else | |
fault_tolerance=0 | |
fi | |
for wid in $wids; do | |
pid=$(xdotool getwindowpid $wid) | |
if [ ! -z "$pid" ] ; then | |
path=$(readlink -f /proc/$pid/exe) | |
if [[ $path == *"beta"* ]]; then | |
echo "Find Android Studio Beta window!" | |
beta_timeout=50 | |
xprop -id $wid -f WM_CLASS 8s -set WM_CLASS "jetbrains-studio-beta" | |
else | |
beta_timeout="$(($beta_timeout-1))" | |
if [ $beta_timeout -eq 0 ]; then | |
echo "Can't find any Android Studio Beta window" | |
exit 0 | |
fi | |
fi | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much, this method helped me