我们是否有一个选项可以自动调整结果窗口的宽度和高度,而不是手动指定高度和宽度的值?
答案1
使用此脚本:
安装x11-utils
,我们需要xwininfo
sudo apt-get install x11-utils
并使用以下代码创建脚本
#!/bin/bash
# resizes the window to full height and 50% width and moves into upper right corner
#define the height in px of the top system-bar:
TOPMARGIN=27
#sum in px of all horizontal borders:
RIGHTMARGIN=10
# get width of screen and height of screen
SCREEN_WIDTH=$(xwininfo -root | awk '$1=="Width:" {print $2}')
SCREEN_HEIGHT=$(xwininfo -root | awk '$1=="Height:" {print $2}')
# new width and height
W=$(( $SCREEN_WIDTH / 2 - $RIGHTMARGIN ))
H=$(( $SCREEN_HEIGHT - 2 * $TOPMARGIN ))
zenity --entry --ok-label=sure --width=$W --height=$H