Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

42
LINES

< > BotCompany Repo | #1026809 // Minimize OS To Tray v2 [with better fullscreen handling, dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (7140L/37K).

!7

cmodule MinimizeToTray > DynPrintLogAndEnabled {
  transient bool activating;
  bool fullScreen;
  
  start {
    checkIfFullScreen();
    JFrame f = getFrame(dm_desktopPane());
    if (f == null) print("No frame found");
    else {
      ownResource(tempOnFrameIconified(f, r {
        if (!activating)
          f.setVisible(false) }));
      ownResource(tempOnWindowStateChanged(f, r checkIfFullScreen));
      print("Minimize to tray installed");
    }

    Runnable rShow = r {
      activating = true;
      try {
        activateFrame(dm_desktopPane(), windowsHack := false, maximize := fullScreen);
      } finally {
        activating = false;
      }
    };
    S name = dm_osName();
    dm_systemTrayIcon(dm_osIconID(), name, rShow, "Show " + name, rShow);
  }

  void checkIfFullScreen {
    JFrame f = getFrame(dm_desktopPane());
    if (f == null) ret;
    int state = f.getState();
    if (state == JFrame.MAXIMIZED_BOTH)
      setField(fullScreen := true);
    else if (state == JFrame.NORMAL)
      setField(fullScreen := false);
  }
  
  bool warnOnDelete() { true; }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026809
Snippet name: Minimize OS To Tray v2 [with better fullscreen handling, dev.]
Eternal ID of this version: #1026809/4
Text MD5: eb33995f830e69301c0484bd2f560ce0
Transpilation MD5: 859af3a07f5741f92181f8d0c5559c9b
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-23 19:44:40
Source code size: 1119 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 131 / 12357
Version history: 3 change(s)
Referenced in: [show references]