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

24
LINES

< > BotCompany Repo | #1026954 // CPU Temperature Tray Icon

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

Uses 5085K of libraries. Click here for Pure Java version (8573L/40K).

!7

cm CPUTemp > DynBigNumber {
  int digits = 0;
  switchable double interval = 5;
  switchable S pattern = "= $DEG °C =";
  transient JLabel lbl;
  
  start {
    dm_addTrayIcon(lbl = dm_fieldLabel_noAutoToolTip value());
    componentPopupMenuItems(lbl,
      "Show Module", rThreadEnter dm_showModule,
      "Remove", rThreadEnter dm_deleteModule);
    setDescription("CPU TEMP");
    doEveryAndNow(interval, r actualUpdate);
  }
  
  void actualUpdate {
    //time "CPU Temp" { // <= 5 ms
      setValue(replace(pattern, "$DEG", formatDoubleX(oshi_cpuTemperature(), digits)));
    //}
    toolTip(lbl, "CPU temperature: " + value);
  }
}

Author comment

Began life as a copy of #1018430

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1026954
Snippet name: CPU Temperature Tray Icon
Eternal ID of this version: #1026954/10
Text MD5: 4ab2b549efa51012ea9a0bd28c2f07a6
Transpilation MD5: ef80ede36cd2d5f079c83ae92ab8914b
Author: stefan
Category: javax / modules
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-08 17:02:05
Source code size: 666 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 187 / 64776
Version history: 9 change(s)
Referenced in: [show references]