Uses 6517K of libraries. Click here for Pure Java version (10969L/56K).
!7 set flag OshiNotSticky. cm MemoryTrayIcon > DynPrintLog { transient S value; // OS size in MB + free memory transient JLabel lbl; transient bool _startMinimized = true; switchable bool countSwap = true; switchable double interval = 10.0; // restart to take effect switchable bool showOSSizeInTray = true; // otherwise only free mem, full specs in tooltip transient long processSize, freeMem, totalMem; start { dm_registerAs_direct processSize(); dm_vmBus_answerToMessage freeSystemMemory(() -> freeMem); dm_vmBus_answerToMessage totalSystemMemory(() -> totalMem); doEveryAndNow(interval, r actualUpdate); dm_addTrayIcon(onLeftClick(rThreadEnter dm_verboseGC, lbl = dm_fieldLabel_noAutoToolTip('value))); componentPopupMenuItems(lbl, "Garbage Collect", rThreadEnter { dm_gc(); actualUpdate(); }, "Show Module", rThreadEnter dm_showModule, "Remove", rThreadEnter dm_deleteModule); } void actualUpdate { processSize = oshi_currentProcessResidentSize(); long mb = toM(processSize); GlobalMemory mem = oshi_systemMemory(); totalMem = mem.getTotal(); long mb2 = freeSystemMemory(mem); if (countSwap) mb2 -= mem.getSwapUsed(); freeMem = mb2; mb2 = toM(mb2); if (set_trueIfChanged(this, value := (showOSSizeInTray ? mb + " / " : "") + mb2)) { fireChangeWithoutPersisting(); vmBus_send processSize(processSize); } toolTip(lbl, "OS size in memory: " + mb + " MB, free system memory: " + mb2 + " MB"); } }
Began life as a copy of #1020802
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1022569 |
| Snippet name: | OS Size + Free Memory Tray Icon [Dyn Module] |
| Eternal ID of this version: | #1022569/16 |
| Text MD5: | 5002b2b62a09eec3c6351ee16943ae8c |
| Transpilation MD5: | ae930525ae19efb1d436cf3b11dbafa6 |
| Author: | stefan |
| Category: | javax / modules |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-09-02 00:53:05 |
| Source code size: | 1584 bytes / 44 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 819 / 632662 |
| Version history: | 15 change(s) |
| Referenced in: | [show references] |