Skip to content

Commit

Permalink
ui scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
subhra74 committed Apr 18, 2020
1 parent fb9f70c commit aa42c3c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions muon-app/src/main/java/muon/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,20 @@ public static void main(String[] args) throws UnsupportedLookAndFeelException {
Security.setProperty("networkaddress.cache.ttl", "0");
Security.setProperty("networkaddress.cache.negative.ttl", "0");

System.out.println("Sacle: " + System.getProperty("sun.java2d.uiScale"));

Security.addProvider(new BouncyCastleProvider());
File appDir = new File(CONFIG_DIR);
if (!appDir.exists()) {
appDir.mkdirs();
}
loadSettings();

if (settings.isManualScaling()) {
System.setProperty("sun.java2d.uiScale.enabled", "true");
System.setProperty("sun.java2d.uiScale", String.format("%.2f", settings.getUiScaling()));
}

if (settings.getEditors().size() == 0) {
System.out.println("Searching for known editors...");
settings.setEditors(PlatformUtils.getKnownEditors());
Expand Down
19 changes: 19 additions & 0 deletions muon-app/src/main/java/muon/app/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public class Settings {
// 2 Open with internal editor
, numberOfSimultaneousConnection = 3;

private float uiScaling = 1.0f;
private boolean manualScaling = false;

private List<EditorEntry> editors = new ArrayList<>();

private String defaultPanel = "FILES";
Expand Down Expand Up @@ -546,4 +549,20 @@ public void setEditors(List<EditorEntry> editors) {
this.editors = editors;
}

public float getUiScaling() {
return uiScaling;
}

public void setUiScaling(float uiScaling) {
this.uiScaling = uiScaling;
}

public boolean isManualScaling() {
return manualScaling;
}

public void setManualScaling(boolean manualScaling) {
this.manualScaling = manualScaling;
}

}

0 comments on commit aa42c3c

Please sign in to comment.