X11。如何知道窗户的完整尺寸(及其装饰物的尺寸)

发布于 2024-11-15 21:14:33 字数 524 浏览 0 评论 0原文

我想检索 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

Kicker 高度为 40,屏幕分辨率为 1920x1200,因此如果我想调整 Konsole 的大小以占据所有屏幕,但 Kicker 的大小应为 1920x1160 (1200-40)。

但当我这样做时,Konsole 会与踢球器尺寸重叠。 所以我认为这意味着这里可能不考虑窗户装饰。

我如何知道必须添加到 wmctrl 给出的窗口大小的装饰的大小?

谢谢

I would like to retrieve the complete size of any windows in X11 in order to automatically resize it.

So far I have used wmctrl but the size seems to be incomplete.
for instance

>$ 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

The Kicker height is 40 and the screen resolution is 1920x1200 so If I wanted to resize my Konsole to take all the screen but the kicker its size should be 1920x1160 (1200-40).

But when I do that, the Konsole overlaps the kicker size.
So I assume that its means that the windows decorations might not be taken into account here.

How can I know the size of the decorations that I would have to add to the windows size given by wmctrl ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心荒芜 2024-11-22 21:14:33
$ 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
$ 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文