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

20
LINES

< > BotCompany Repo | #1031214 // linux_fixNumPad - doesn't work like this because we can't read the file as non-root

JavaX fragment (include)

1  
svoid linux_fixNumPad() {
2  
  if (!isLinux()) ret;
3  
  File f = newFile("/etc/default/keyboard");
4  
  S text = loadTextFile(f);
5  
  LS lines = lines(text);
6  
  S line = "XKBOPTIONS=\"numpad:microsoft\"";
7  
  if (contains(lines, line))
8  
    print("Num pad already fixed!");
9  
  else if (contains(text, "XKBOPTIONS"))
10  
    print("I am confused, please check " + f + "yourself and put in: " + line);
11  
  else {
12  
    sendToSuperUserVM("echo " + platformQuote(line) + " >>" + platformQuote(f));
13  
    text = loadTextFile(f);
14  
    lines = lines(text);
15  
    if (contains(lines, line))
16  
      print("Sucess fixing numpad! Please reboot machine.");
17  
    else
18  
      print("Boohoo, couldn't fix numpad in " + f);
19  
  }
20  
}

Author comment

Began life as a copy of #1031213

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031214
Snippet name: linux_fixNumPad - doesn't work like this because we can't read the file as non-root
Eternal ID of this version: #1031214/1
Text MD5: ab8ba26c8003e44337cbdc8ae98f16f8
Author: stefan
Category: javax / linux
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-20 17:33:15
Source code size: 701 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 189
Referenced in: [show references]