diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d4c7e0..734450e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Changelog ### 4.05.2021 +- ignore Dock type windows, like tint2 panel +- better size and position calculation with gap - handle undecorated windows - handle gap diff --git a/clicksnap b/clicksnap index 5d8459e..c397c42 100755 --- a/clicksnap +++ b/clicksnap @@ -21,6 +21,8 @@ HEX_ID=$(printf '0x%x\n' $WINDOW) CHILD_ID=$(xwininfo -id $HEX_ID -children|grep "\"" | awk '{print $1}') +if xwininfo -id $CHILD_ID -wm |grep Dock ; then exit 0 ;fi # Ignore Dock eg. tint2 + if xwininfo -id $CHILD_ID -wm |grep Undecorated ; then # Undecorated T="0" else # Decorated @@ -51,23 +53,23 @@ OFF_Y="${OFFSET#*,}" case $POS_CODE in 00) # top-left - W=$((AVAIL_X/2-GAP)) H=$((AVAIL_Y/2-T-GAP)) X=$((0+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP/2));; + W=$((AVAIL_X/2-GAP*3/2)) H=$((AVAIL_Y/2-T-GAP*3/2)) X=$((0+OFF_X+GAP)) Y=$((0+OFF_Y+GAP));; 10) # top - W=$((AVAIL_X-GAP)) H=$((AVAIL_Y/2-T-GAP)) X=$((0+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP/2));; + W=$((AVAIL_X-GAP*2)) H=$((AVAIL_Y/2-T-GAP*3/2)) X=$((0+OFF_X+GAP)) Y=$((0+OFF_Y+GAP));; 20) # top-right - W=$((AVAIL_X/2-GAP)) H=$((AVAIL_Y/2-T-GAP)) X=$((AVAIL_X/2+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP/2));; + W=$((AVAIL_X/2-GAP*3/2)) H=$((AVAIL_Y/2-T-GAP*3/2)) X=$((AVAIL_X/2+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP));; 01) # left - W=$((AVAIL_X/2-GAP)) H=$((AVAIL_Y-T-GAP)) X=$((0+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP/2));; + W=$((AVAIL_X/2-GAP*3/2)) H=$((AVAIL_Y-T-GAP*2)) X=$((0+OFF_X+GAP)) Y=$((0+OFF_Y+GAP));; 11) # center W=$((AVAIL_X/8*6-OFF_X)) H=$((AVAIL_Y/8*6-T)) X=$((AVAIL_X/8+OFF_X/2)) Y=$((AVAIL_Y/8+OFF_Y/2));; 21) # right - W=$((AVAIL_X/2-GAP)) H=$((AVAIL_Y-T-GAP)) X=$((AVAIL_X/2+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP/2));; + W=$((AVAIL_X/2-GAP*3/2)) H=$((AVAIL_Y-T-GAP*2)) X=$((AVAIL_X/2+OFF_X+GAP/2)) Y=$((0+OFF_Y+GAP));; 02) # bottom-left - W=$((AVAIL_X/2-GAP)) H=$((AVAIL_Y/2-T-GAP)) X=$((0+OFF_X+GAP/2)) Y=$((AVAIL_Y/2+OFF_Y+GAP/2));; + W=$((AVAIL_X/2-GAP*3/2)) H=$((AVAIL_Y/2-T-GAP*3/2)) X=$((0+OFF_X+GAP)) Y=$((AVAIL_Y/2+OFF_Y+GAP/2));; 12) # bottom - W=$((AVAIL_X-GAP)) H=$((AVAIL_Y/2-T-GAP)) X=$((0+OFF_X+GAP/2)) Y=$((AVAIL_Y/2+OFF_Y+GAP/2));; + W=$((AVAIL_X-GAP*2)) H=$((AVAIL_Y/2-T-GAP*3/2)) X=$((0+OFF_X+GAP)) Y=$((AVAIL_Y/2+OFF_Y+GAP/2));; 22) # bottom-right - W=$((AVAIL_X/2-GAP)) H=$((AVAIL_Y/2-T-GAP)) X=$((AVAIL_X/2+OFF_X+GAP/2)) Y=$((AVAIL_Y/2+OFF_Y+GAP/2));; + W=$((AVAIL_X/2-GAP*3/2)) H=$((AVAIL_Y/2-T-GAP*3/2)) X=$((AVAIL_X/2+OFF_X+GAP/2)) Y=$((AVAIL_Y/2+OFF_Y+GAP/2));; esac