Closed mrkumar9001 closed 8 years ago
in addition to this, I think it would be nice if tile.sh could handle only one window (only one window on screen). In my local copy I have this:
PANEL=${PANEL:-20}
GAP=${GAP:-20}
MOUSE_ORIG_POS="$(wmp)"
wmp 9000 9000 # arbitrary big value so mouse goes to edge of screen
SCREEN_WIDTH="$(wmp | awk '{print $1}')"
SCREEN_HEIGHT="$(wmp | awk '{print $2}')"
if [ "$(lsw | wc -l)" = 1 ]; then
wtp $GAP $GAP $((SCREEN_WIDTH - (2 * GAP))) $((SCREEN_HEIGHT - PANEL - (2 * GAP))) $(pfw)
exit
fi
HALF_SCREEN_WIDTH="$(($(wmp | awk '{print $1}') / 2))"
wmp $MOUSE_ORIG_POS`
MASTER=${MASTER:-$HALF_SCREEN_WIDTH}
The snippet above solves both issues, albeit hackily. Also, the snippest is for a bottom panel.
echo $(wattr w $(lsw -r)) / 2 | bc
But we'll keep tile.sh as is, so it remain simple and easy to understand for everyone who wants to 'improve it' like you did.
I don't know how we would do this, but here's an example.
MOUSE_ORIG_POS="$(wmp)"
wmp 9000 9000 # arbitrary big value so mouse goes to edge of screen
HALF_SCREEN_SIZE="$(($(wmp | awk '{print $1}') / 2))"
wmp $MOUSE_ORIG_POS
MASTER=${MASTER:-$HALF_SCREEN_SIZE}
my implementation uses wmp as a quick hack, but it could easily use xrandr as well. However, I'm not sure how this would work with multihead setups.