-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raw: Tiling script to stand in (replace?) broken (in 18.04) quicktile.
- "Crude quarter tiling tool for elementary OS": https://gist.github.com/peteruithoven/db0cba0b0849c8cb5e267f6e75126304 Thank you: github.com/peteruithoven - See also known issue: ssokolow/quicktile#95
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# Crude quarter tiling tool | ||
# Installation: | ||
# Move file to: /usr/local/bin/quarter-tiler | ||
# Make executable: sudo chmod +x /usr/local/bin/quarter-tiler | ||
# Assign keyboard shortcuts to commands like "quarter-tiler topleft" | ||
|
||
# Margins around windows (elementary OS native apps) (HiDPI) | ||
MARGIN_TOP=130 | ||
MARGIN_RIGHT=158 | ||
MARGIN_BOTTOM=185 | ||
MARGIN_LEFT=158 | ||
# Desktops info | ||
INFO=$(wmctrl -d | head -1) | ||
# Desktop size | ||
[[ $INFO =~ 'DG: '([0-9]+)'x'([0-9]+) ]] | ||
WIDTH=${BASH_REMATCH[1]} | ||
HEIGHT=${BASH_REMATCH[2]} | ||
# Available width height, and offsets see: $ wmctrl -d | ||
[[ $INFO =~ 'WA: '([0-9]+)','([0-9]+)' '([0-9]+)'x'([0-9]+) ]] | ||
OFFSET_X=${BASH_REMATCH[1]} | ||
OFFSET_Y=${BASH_REMATCH[2]} | ||
AV_WIDTH=${BASH_REMATCH[3]} | ||
AV_HEIGHT=${BASH_REMATCH[4]} | ||
|
||
X_LEFT=$((0-($MARGIN_RIGHT+$OFFSET_X))) | ||
X_CENTER=$(($AV_WIDTH/2+$MARGIN_RIGHT+$MARGIN_LEFT)) | ||
HALF_WIDTH=$X_CENTER | ||
Y_TOP=$((0-($MARGIN_TOP-$OFFSET_Y))) | ||
Y_CENTER=$(($Y_TOP+$HEIGHT/2)) | ||
HALF_HEIGHT=$(($AV_HEIGHT/2+$MARGIN_TOP+$MARGIN_BOTTOM)) | ||
SIZE=$HALF_WIDTH,$HALF_HEIGHT | ||
|
||
case "$1" in | ||
topleft) | ||
CMD="wmctrl -r :ACTIVE: -e 0,$X_LEFT,$Y_TOP,$SIZE" | ||
;; | ||
topright) | ||
CMD="wmctrl -r :ACTIVE: -e 0,$X_CENTER,$Y_TOP,$SIZE" | ||
;; | ||
bottomleft) | ||
CMD="wmctrl -r :ACTIVE: -e 0,$X_LEFT,$Y_CENTER,$SIZE" | ||
;; | ||
bottomright) | ||
CMD="wmctrl -r :ACTIVE: -e 0,$X_CENTER,$Y_CENTER,$SIZE" | ||
;; | ||
esac | ||
|
||
# In case window is tiled, disable tile | ||
wmctrl -r :ACTIVE: -b remove,maximized_vert | ||
# Wait for transition | ||
sleep 0.1s | ||
|
||
eval $($CMD) |