Skip to content

Instantly share code, notes, and snippets.

@Supermathie
Forked from thwarted/resize-java-iKVM-viewer
Created January 18, 2019 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Supermathie/a2aaa61895c170fc404c5c3f5cbea236 to your computer and use it in GitHub Desktop.
Save Supermathie/a2aaa61895c170fc404c5c3f5cbea236 to your computer and use it in GitHub Desktop.
resize-java-iKVM-viewer: find all supermicro Java iKVM Viewer windows and resize them to display all the content
#!/bin/bash
# find all supermicro Java iKVM Viewer windows and resize
# them to display all the content
#
# for reasons that are beyond sanity, this shitty closed source program
# sets the min and max window sizes to the same values, making it unresizable
# through dragging.
# this wouldn't be so bad if it actually resized the window to display all
# the content. it constantly resizes based on the resolution of the
# remote display.
#
# bind this program to a hot key or create a panel icon or something
# to invoke when the iKVM viewer is the wrong size. it will loop
# over all iKVM windows and set their size based on the reported
# resolution
PATH=/bin:/usr/bin
for winid in $( wmctrl -l | grep -iE 'Java iKVM Viewer.+(Resolution.+FPS|No Signal)' | awk '{ print $1 }' ); do
read width x height < <( wmctrl -l |
grep $winid |
grep -iE 'Java iKVM Viewer.+Resolution' |
sed -e 's/^.\+Resolution //; s/ - F.\+$//;'
)
if [[ -z "$width" || -z "$height" ]]; then
width=643
height=504
fi
xprop -id $winid -remove WM_NORMAL_HINTS
wmctrl -i -r $winid -e 0,-1,-1,$(( width + 10 )),$(( height + 30 ))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment