Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Ubuntu 實現視窗左右分屏:wmctrl + Shell 腳本自動計算解析度並平鋪

編輯:關於 Linux

安裝 wmctrl

sudo apt-get install wmctrl

分屏腳本

#!/bin/sh
set -- $(xwininfo -root | awk -F'[ :]+' '/(Width|Height):/ {print $3}')
width=$1
height=$2
win1=$(xwininfo | awk '/^xwininfo: W/ {print $4}')
win2=$(xwininfo | awk '/^xwininfo: W/ {print $4}')
wmctrl -i -r $win1 -e 0,0,0,$((width/2)),$height
wmctrl -i -r $win2 -e 0,$((width/2)),0,$((width/2)),$height

使用方式

  1. 執行腳本。
  2. 滑鼠點選想要分屏的兩個視窗(各點一下)。
  3. 兩視窗自動左右平鋪佔滿螢幕。

擴充

依邏輯修改腳本可實現四等分、上下分屏等任意佈局。

結語

wmctrl + 簡短 Shell 腳本,即可在 Ubuntu 獲得類 Windows Snap 的視窗分屏體驗。

Copyright © Windows教程網 All Rights Reserved