
<a target="_blank"></a>
<code>sudo apt-get install wmctrl</code>
<code>#!/bin/sh</code>
<code></code>
<code>set -- $(xwininfo -root| awk -f '[ :]+' '/ (width|height):/ { print $3 }')</code>
<code>width=$1</code>
<code>height=$2</code>
<code>win1=$(xwininfo| awk '/^xwininfo: w/ { print $4 }')</code>
<code>win2=$(xwininfo| awk '/^xwininfo: w/ { print $4 }')</code>
<code>wmctrl -i -r $win1 -e 0,0,0,$((width/2)),$height</code>
<code>wmctrl -i -r $win2 -e 0,$((width/2)),0,$((width/2)),$height</code>
執行腳本,點選選擇 2 個視窗,就可以将 2 個視窗左右平鋪整個螢幕。
根據這個腳本,其實你可以設計出更複雜的切分方案。
本文來自雲栖社群合作夥伴“linux中國”,原文釋出日期:2015-08-21