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

37
LINES

< > BotCompany Repo | #1025639 // Minimize OS To Tray [OK]

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

Uses 1113K of libraries. Click here for Pure Java version (13448L/65K).

1  
!7
2  
3  
cmodule MinimizeToTray > DynPrintLogAndEnabled {
4  
  transient bool activating;
5  
  
6  
  start {
7  
    JFrame f = getFrame(dm_desktopPane());
8  
    if (f == null) print("No frame found");
9  
    else {
10  
      var action = r {
11  
        if (!activating)
12  
          if (enabled)
13  
            f.setVisible(false);
14  
      };
15  
      ownResource(tempOnFrameIconified(f, action));
16  
      
17  
      if (isInIconifiedFrame(f))
18  
        if (enabled)
19  
          f.setVisible(false);
20  
        
21  
      print("Minimize to tray installed");
22  
    }
23  
24  
    Runnable rShow = r {
25  
      activating = true;
26  
      try {
27  
        activateFrame(dm_desktopPane(), windowsHack := false);
28  
      } finally {
29  
        activating = false;
30  
      }
31  
    };
32  
    S name = dm_osName();
33  
    dm_systemTrayIcon(dm_osIconID(), name, rShow, "Show " + name, rShow);
34  
  }
35  
  
36  
  bool warnOnDelete() { true; }
37  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025639
Snippet name: Minimize OS To Tray [OK]
Eternal ID of this version: #1025639/12
Text MD5: 12baf60be4b4ea12dc3c076d05ef0a6b
Transpilation MD5: 60feb971109646878a44ebe5e206ac19
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-08-03 06:38:23
Source code size: 835 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 268 / 164029
Version history: 11 change(s)
Referenced in: [show references]