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)

svoid linux_fixNumPad() {
  if (!isLinux()) ret;
  File f = newFile("/etc/default/keyboard");
  S text = loadTextFile(f);
  LS lines = lines(text);
  S line = "XKBOPTIONS=\"numpad:microsoft\"";
  if (contains(lines, line))
    print("Num pad already fixed!");
  else if (contains(text, "XKBOPTIONS"))
    print("I am confused, please check " + f + "yourself and put in: " + line);
  else {
    sendToSuperUserVM("echo " + platformQuote(line) + " >>" + platformQuote(f));
    text = loadTextFile(f);
    lines = lines(text);
    if (contains(lines, line))
      print("Sucess fixing numpad! Please reboot machine.");
    else
      print("Boohoo, couldn't fix numpad in " + f);
  }
}

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: 157 / 187
Referenced in: