Do we have an option in zenity to auto adjust the width and height of the results window instead of manually specifying the values of height & width ?
Asked
Active
Viewed 7,620 times
1 Answers
2
Using this script:
Install x11-utils
, we need xwininfo
sudo apt-get install x11-utils
and create a script with the code below
#!/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