[go: up one dir, main page]

Skip to content

Commit

Permalink
autotile: only kill xmmv on windows dragged to the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
lwilletts committed May 29, 2020
1 parent 115e82d commit 9fb99e5
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions autotile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ main() {
-l|--left|left) METHOD="left" ;;
-r|--right|right) METHOD="right" ;;
-b|--browse|browse) METHOD="browse" ;;
-h|--help|help) usage 0 ;;
*) usage 1 ;;
-h|--help|help) usage 0 ;;
*) usage 1 ;;
esac

mattr "$2" && SCR="$2" || {
if mattr "$2"; then
SCR="$2"
else
printf '%s\n\n' "$2 is not a connected screen."
usage 1
}
fi

# init var
nWindowsOld=0
Expand All @@ -41,24 +43,24 @@ main() {

# compare number of current windows vs number of old windows
if [ "$nWindows" -ne "$nWindowsOld" ]; then

# readjust counter
nWindowsOld="$nWindows"

# exceptions to autotiling
case "$(atomx WM_CLASS "$(lsw | tail -n 1)")" in
python3|DiscordCanary) continue ;;
esac

# kill xmmv when windows are dragged on to the screen
pkill xmmv 2> /dev/null
# kill xmmv only when a window is dragged to the screen
if [ "$nWindows" -gt "$nWindowsOld" ]; then
pkill xmmv 2> /dev/null
fi

# autotile given monitor
tile "$METHOD" "$SCR"
fi

# re-adjust counter
nWindowsOld="$nWindows"
fi

sleep 0.20
sleep 0.10
done
}

Expand Down

0 comments on commit 9fb99e5

Please sign in to comment.