Found a workaround - i think this should be fixed on awt really:
//workaround for java X11 issue (Toolkit.getScreenInsets) wrong values
private static ProcessBuilder panelWorkaround = new ProcessBuilder("xprop", "-root", "-notype", "_NET_WORKAREA");
private static final boolean isX11 = GraphicsEnvironment.getLocalGraphicsEnvironment() instanceof X11GraphicsEnvironment;
private Rectangle getAdequateFullSize() throws HeadlessException {
//bug in linux x11 binding (getScreenInsets not counting panels)...
if (isX11) {
try {
Process proc = panelWorkaround.start();
String output = IoUtils.toString(proc.getInputStream(), true);
String[] results = output.split("=");
if (proc.waitFor() == 0 && results.length == 2) {
//first window
String[] firstWindowProperties = results[1].split(",");
int x = Integer.parseInt(firstWindowProperties[0].trim());
int y = Integer.parseInt(firstWindowProperties[1].trim());
int width = Integer.parseInt(firstWindowProperties[2].trim());
int height = Integer.parseInt(firstWindowProperties[3].trim());
return new Rectangle(x, y, width, height);
}
} catch (Exception ex) {
ex.printStackTrace();
return getNormalAdequateSize();
}
}
return getNormalAdequateSize();
}
private Rectangle getNormalAdequateSize() throws HeadlessException {
Insets i = getToolkit().getScreenInsets(getGraphicsConfiguration());
Rectangle max = new Rectangle(getToolkit().getScreenSize());
max.x += i.left;
max.y += i.top;
max.width -= (i.left + i.right);
max.height -= (i.top + i.bottom);
return max;
}