我想检索X11中任何窗口的完整大小,以便自动调整大小。
到目前为止,我已经使用了wmctrl但是大小似乎不完整。 例如
>$ wmctrl -lG
0x00e0000f -1 0 0 1920 1200 tclogin1 KDE Desktop
0x010000ee -1 0 1160 1920 40 tclogin1 kicker
0x01200008 0 4 28 1920 1127 tclogin1 ...p7zip_9.13/bin - Shell No. 8 - Konsole
踢球者的身高是40,屏幕分辨率是1920x1200所以如果我想调整我的Konsole的大小来拍摄所有的屏幕,但其尺寸应该是1920x1160(1200-40)。
但是当我这样做时,Konsole重叠了踢球者的大小。 所以我认为这意味着这里可能不会考虑窗户装饰。
如何知道我必须添加到wmctrl给出的窗口大小的装饰大小?
由于
答案 0 :(得分:3)
$ cat allborders.sh
# assumptions:
# windows ids are at least 5 digits long
# we dont need to bother with windows that have no name
# "first argument" from the pipe is east (could be west)
#
WINDOW_IDS=`xwininfo -int -root -tree |\
grep '[0-9]*\ (has no name)' -v |\
grep -Eo '[0-9]{5,}'`
for win in $WINDOW_IDS;
do
xprop -id $win |\
grep -Ee '^(_NET_FRAME_EXTENTS|WM_CLASS)' |\
sed 's/.*=\ //' |\
sed -e :a -e '/$/N;s/\n/ /;ta' |\
grep ^[0-9] |\
while read line;
do
set -- $line
E=`echo $1|sed 's/,$//'`
W=`echo $2|sed 's/,$//'`
N=`echo $3|sed 's/,$//'`
S=`echo $4|sed 's/,$//'`
NAME=`echo $5|sed 's/,$//'`
CLASS=`echo $6|sed 's/,$//'`
echo -e "$CLASS $NAME $N $E $S $W"
done
done
$ ./allborders.sh
"URxvt" "urxvt" 1 1 1 1
"XTerm" "aterm" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"Firefox" "Navigator" 18 1 3 1
"Gmpc" "gmpc" 18 1 3 1
"XTerm" "aterm" 0 0 0 0
"XTerm" "one" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"XTerm" "one" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"XTerm" "aterm" 0 0 0 0
"FbPager" "fbpager" 0 0 0 0