wmctrl不正确的大小调整和移动-取决于应用程序

时间:2018-08-20 07:33:15

标签: bash wmctrl

调整大小并使用fun number_in_months (dates :( int * int * int) list, months : int list)= if null dates then 0 else if null months then 0 else let fun dm_notempty (dates : (int * int * int) list, months : int list)= if (null (tl dates) andalso null (tl months)) andalso (#2 (hd dates) <> hd months) then 0 else if (null (tl dates) andalso null (tl months)) andalso (#2 (hd dates) = hd months) then 1 else let val dates_tl = dm_notempty(tl dates, tl months) in if #2(hd dates) = hd months then dates_tl + 1 else dates_tl + 0 end in dm_notempty(dates, months) end 移动时,结果既不正确,又取决于应用程序。

示例: 在撰写本文时,我正在运行emacs,chrome,spotify和gnome-terminal

wmctrl

现在,ws=$(wmctrl -d | grep "*" | awk '{print $1}') n=$(wmctrl -l | awk '{print $2 ";" $1}' | grep ^$ws | wc -l) windows=$(wmctrl -l | awk '{print $2 ";" $1}' | grep ^$ws | cut -d ";" -f 2) window1=$(echo $windows | cut -d " " -f 1) window2=$(echo $windows | cut -d " " -f 2) window3=$(echo $windows | cut -d " " -f 3) window4=$(echo $windows | cut -d " " -f 4) for i in ${windows[@]} ; do wmctrl -ir $i -b remove,maximized_horz,maximized_vert done wmctrl -ir $window1 -e 1,0,0,960,540 wmctrl -ir $window2 -e 1,0,540,960,540 wmctrl -ir $window3 -e 1,960,0,960,540 wmctrl -ir $window4 -e 1,960,540,960,540 产生以下结果(删除了不相关的信息):

wmctrl -lG

为4个终端窗口运行完全相同的代码会产生:

width  height
952    540   emacs
960    540   chromium
954    529   gnome-terminal
960    540   Spotify

所有尺寸都不正确,但是不同的应用程序具有不同的尺寸,而同一应用程序的所有窗口具有相同的尺寸。

预期:

width  height
954    529   gnome-terminal
954    529   gnome-terminal
954    529   gnome-terminal
954    529   gnome-terminal

我似乎找不到任何讨论此确切问题的帖子。

非常感谢所有帮助!

1 个答案:

答案 0 :(得分:0)

每个窗口都有装饰(即边框)。 gnome终端窗口的左侧边框为6像素宽,顶部为11像素高边框(可能是标题栏)。移动窗口时,它会移动窗口的位置(不包括边框尺寸),但是wmctrl -G输出显示的是包含边框尺寸的几何图形。参见this topic。您可以使用xwininfo魔术来获取边框大小,例如here