Download Jar. Uses 206K of libraries. Click here for Pure Java version (6864L/50K).
1 | !7 |
2 | |
3 | p { |
4 | if (isWindows()) failInfoBox("Sorry Linux only"); |
5 | File f = oneOfTheFiles("/proc/acpi/button/lid/LID/state", "/proc/acpi/button/lid/LID0/state"); |
6 | if (f == null) fail("Huh"); |
7 | bool lastOpen = false; |
8 | repeat with sleep 1 { |
9 | bool open = cic(printIndent(loadTextFile(f)), "open"); |
10 | print("Lid: " + (open ? "open" : "closed")); |
11 | if (open != lastOpen) { |
12 | andy(open ? "Hello" : "Goodbye"); |
13 | lastOpen = open; |
14 | } |
15 | } |
16 | } |
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: | 438 / 1003 |
Version history: | 4 change(s) |
Referenced in: | [show references] |