Skip to content

Instantly share code, notes, and snippets.

@thwarted
Last active September 15, 2022 08:59
Show Gist options
  • Save thwarted/160f7d05ae38d1bfc4eb to your computer and use it in GitHub Desktop.
Save thwarted/160f7d05ae38d1bfc4eb 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
@bodik
Copy link

bodik commented Sep 15, 2022

Options->Preference->Window->Untick Auto-resize Window

thank you @BtbN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment