Download Jar. Uses 206K of libraries. Click here for Pure Java version (6864L/50K).
!7 p { if (isWindows()) failInfoBox("Sorry Linux only"); File f = oneOfTheFiles("/proc/acpi/button/lid/LID/state", "/proc/acpi/button/lid/LID0/state"); if (f == null) fail("Huh"); bool lastOpen = false; repeat with sleep 1 { bool open = cic(printIndent(loadTextFile(f)), "open"); print("Lid: " + (open ? "open" : "closed")); if (open != lastOpen) { andy(open ? "Hello" : "Goodbye"); lastOpen = open; } } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010487 |
Snippet name: | Say Hello/Goodbye on lid opened/closed [Linux, OK] |
Eternal ID of this version: | #1010487/5 |
Text MD5: | 44bce7ee5b2993ab7522d6bb2293cf70 |
Transpilation MD5: | 54012d01f96a6c3964f8e1060837fe4a |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-05 19:03:01 |
Source code size: | 461 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 437 / 1001 |
Version history: | 4 change(s) |
Referenced in: | #1016085 - isNotebookLidOpen |