Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@kapolos

This comment has been minimized.

Copy link

@kapolos kapolos commented Aug 27, 2018

This script ... saved some of my hair from getting pulled out ☂️

# for reasons that are beyond sanity, this shitty closed source program

Couldn't have been said better.

If you ever visit Crete, I will be very happy to buy you a ton of raki 🍷 Thank you!

@mondragonfx

This comment has been minimized.

Copy link

@mondragonfx mondragonfx commented Mar 24, 2020

This script is great. Thank you for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.