I'm on Debian 9.11 with the MATE desktop (pinebook pro) I've an Init script /etc/init.d/customMapping that remaps some of my keys using both setxkbmap and xmodmap. Here it is #! /bin/sh  ### BEGIN INIT INFO # Provides:          customMapping # Required-Start:    $local_fs x11-common xserver display # Required-Stop:     $local_fs x11-common xserver display # Default-Start:     2 3 4 5 # Default-Stop:      0 1 6 # Short-Description: Custom keyboard mapping # Description:       This is a simple Init script #                    Custom keyboard mapping ### END INIT INFO #  # Some things that run always echo &quot;customMapping script&quot;  # Carry out specific functions when asked to by the system case &quot;$1&quot; in   start)     echo &quot;Starting script customMapping &quot;     echo &quot;start&quot; &gt;&gt; /opt/test.txt      # Make Caps Lock a Control key     setxkbmap -option ctrl:nocaps &gt; /opt/logs 2&gt;&amp;1      # Swap Left Control with Left Alt     setxkbmap -option ctrl:swap_lalt_lctl &gt; /opt/logs 2&gt;&amp;1      # Make Pause/Break an End key     xmodmap -e &quot;keycode 127 = End&quot; &gt; /opt/logs 2&gt;&amp;1      # Make Screen Lock a Home key     xmodmap -e &quot;keycode 78 = Home&quot; &gt; /opt/logs 2&gt;&amp;1      ;;   stop)     echo &quot;Stopping custom Mapping&quot;     ;;   *)     echo &quot;Usage: /etc/init.d/customMapping {start|stop}&quot;     exit 1     ;; esac  exit 0   As you can see I've tried several kind of keywords in the Required-Start section but this doesn't work and when I check in the /opt/logs file I see the following error messages  Cannot open display &quot;default display&quot; Cannot open display &quot;default display&quot; xmodmap:  unable to open display '' xmodmap:  unable to open display ''  What value should I set in Required-Start in order for my script to access display (X server)? Also is the Default-Start values correct? Thank you
120515
I've been able to change the keyboard layout/mapping when the  is running using ~/.Xmodmap (and I suppose you could also do it through the  directly, eg. using  as a wrapper around X protocol calls).  I've been able to do the same (somewhat) on the console/tty (ie. when X is not running) using loadkeys.     Is there a way to customize the keyboard layout similarly, but from a single source, in such a way that it affects both X and the console, ie. in a way that is "X-and-console agnostic"?   (The only way I can think of is by writing a "keyboard driver" that talks to the kernel's input interface, evdev, and sends the input you want (through uinput?), or something, but I don't know if this even makes sense, or if there's an easier way.)
7514
I just put my drive with my existing Ubuntu 17.10 installation from my old into my new laptop which has a different keyboard layout and I noticed that the functionality to switch keyboards is missing. There is no icon in the menu bar and pressing super + space also does nothing. It works fine at the desktop and at the lockscreen, just not in GDM… it's working on Fedora though and I did nothing fancy there either.  I compared Fedora GDM config in /etc with Ubuntu, no luck.  Please tell me what's required to get it working.  I prefer to use Wayland, if your answer suggests configuring something related to X11 please explain why.  Edit:  Here is what I see in Region &amp; Language, there is no Login Screen button as far as I can see.    Edit 2:  As requested by Gunnar Hjalmarsson:  $ cat /etc/default/keyboard  XKBLAYOUT=de,us,gb XKBVARIANT=,intl, BACKSPACE=guess
86211
I would like to start Debian without the GUI and then just type commands in to launch the desired programs (which are located on my local machine), eg  $ chromium-browser &amp;   I already do a similar thing when sshing in to other machines on the LAN - it is handy if I need to visualise csv data for example in soffice. i currently have gnome desktop and Debian 7 installed.  I have , however I am reluctant to try them out for fear of being locked out of using the web browser once I do this (I will need it to seek help using the browser if I get stuck).  I was wondering if I could temporarily test out the method of starting the GUI on one of the other terminals (eg ctrl+alt+f1) to see if there are any problems? Will this work? Will it be equivalent to starting the GUI when booting without a GUI?  If this is feasible, please could someone provide full instructions for:   enabling the GUI on terminal f1 so that i can run gui programs (without showing the full desktop interface) turning off the desktop interface GUI on bootup   obviously I will need to run X11 to load GUI programs - that's fine, but I'm looking to boot up into text mode and then just execute GUI programs as needed.  doing some tests on an ubuntu 12.04 virtualbox vm (hopefully not too different to debian 7?)...  $ ps aux | grep gdm # *blank* $ ps aux | grep kdm # *blank* $ ps aux | grep lightdm root      1225  0.0  0.0 270664  3500 ?        Ssl  12:43   0:00 lightdm root      1234  1.9  2.2 236564 112276 tty7    Ss+  12:43   0:01 /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none root      1382  0.0  0.0 156772  3572 ?        Sl   12:43   0:00 lightdm --session-child 12 19 $ sudo update-rc.d lightdm disable update-rc.d: warning: /etc/init.d/lightdm missing LSB information update-rc.d: see &lt;http://wiki.debian.org/LSBInitScripts&gt;  Disabling system startup links for /etc/init.d/lightdm ...  Removing any system startup links for /etc/init.d/lightdm ...    /etc/rc0.d/K20lightdm    /etc/rc1.d/K20lightdm    /etc/rc2.d/K80lightdm    /etc/rc3.d/K80lightdm    /etc/rc4.d/K80lightdm    /etc/rc5.d/K80lightdm    /etc/rc6.d/K20lightdm  Adding system startup for /etc/init.d/lightdm ...    /etc/rc0.d/K20lightdm -&gt; ../init.d/lightdm    /etc/rc1.d/K20lightdm -&gt; ../init.d/lightdm    /etc/rc6.d/K20lightdm -&gt; ../init.d/lightdm    /etc/rc2.d/K80lightdm -&gt; ../init.d/lightdm    /etc/rc3.d/K80lightdm -&gt; ../init.d/lightdm    /etc/rc4.d/K80lightdm -&gt; ../init.d/lightdm    /etc/rc5.d/K80lightdm -&gt; ../init.d/lightdm $ sudo shutdown -r 0   and the gui is back up and running again after the reboot! so this clearly did not have the desird effect. however:  $ sudo /etc/init.d/lightdm stop   kills the gui. moving to tty2 (by pressing ctrl+alt+f2) and attempting to open firefox:  $ firefox &amp; Error: no display specified   so attempting to specify a display:  $ export DISPLAY='0.0' $ firefox &amp; Error: cannot open display: 0.0   and now i'm stuck. i can still get the gui back on ctrl+alt+f7 by entering the following into tty2:  $ sudo /etc/init.d/lightdm start   but this is not what i want. i just want to be able to run firefox without showing all the other desktop things such as the clock and the menu bars, etc.  trying out some of the things in ' answer  $ sudo /etc/init.d/lightdm stop $ echo "#!/bin/bash" &gt; ~/.xinitrc $ echo "exec firefox" &gt;&gt; ~/.xinitrc $ xinit   this does exactly what i want :)
47865
I'm trying to simulate a media key press using a custom shortcut.  So far, I've been able to achieve the simulation I need using the command:  xdotool key XF86AudioPlay   It works perfectly, it pauses or starts the music player every time it is run.  The problem comes when trying to run it as a shortcut.  First I tried to run an alias with a custom shortcut, but it did not work.  As explained on :     The commands run by keyboard bindings are not parsed via a shell. Your best bet is to create a directory bin in your homedir.   Next I created the suggested script and named it simplay:  #!/bin/sh xdotool key XF86AudioPlay   It is located inside a bin folder which is part of the PATH, this works fine and can be run from any location.  When trying to create the Custom Shortcut, I was unable to get it to execute, the configuration is the following:  Name: test Command: simplay  Shortcut: Ctrl+Alt+R   After searching a bit more I found another way to execute the shortcut:  gnome-terminal -e simplay   I tried it on a terminal and noticed that when executing it it would rapidly open a new terminal window, execute the child process, pausing the music and immediately close the window.  I changed the command on the shortcut and when hitting it I noticed the same behavior opening a terminal and immediately being closed but this time the child process did not pause the music, which makes me think that the script has been called on all my previous attempts but it is somehow not being able to execute.  How can I solve this problem according to your knowledge?
94829
When I do this in my terminal:  echo -e "\xF0\x9f\x8d\xba"   I get a cool beer mug in my terminal: 🍺  However, when I start screen, and try the same, I'm getting a �. How do I get the nice beer mug?  This is my .screenrc:  nethack on startup_message off defscrollback 3000 hardstatus on hardstatus alwayslastline hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %c" termcapinfo xterm 'bc@:bs@' ignorecase on maptimeout 0 vbell off defutf8 on defencoding utf8   Also running screen with the -U option doesn't help.
106997
I need to automate desktop configuration via Puppet, virtual terminal  or ssh.  Unfortunately, invocation of gsettings via ssh or virtual terminal gives:  gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize "4"  (process:29520): dconf-WARNING **: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY   When I set the $DISPLAY with export DISPLAY=:0.0 it gives another error:  (process:29862): dconf-WARNING **: failed to commit changes to dconf: Could not connect: Connection refused   What can I do?
27331
I looking into writing my own init.d scripts to control several services running on my Linux server. I came across an example online which contained:  nohup $EXEC_SCRIPT 0&lt;&amp;- &amp;&gt; $LOG_FILE &amp; echo $! &gt; $PID_FILE   From what I understand:   nohup Catches the hangup signal  $EXEC_SCRIPT is a variable containing the command to be run  0&lt;&amp;- &amp;&gt; Not come across this before $LOG_FILE similar to $EXEC_SCRIPT but contains the log file path &amp; starts logging to $LOG_FILE in the background? $! is the PID of the most last background command &gt; writes the result of $! to the $PID_FILE   I can work through it with this knowledge but the 0&lt;&amp;- &amp;&gt; is completely throwing me off. I don't like to include things that I don't at least partially understand first.
15274
I would like to rebind some keys on Linux via Xmodmap. Left and up cursor on my Acer (yes, I know) laptop have broke. I would like to map shift+down to up, and shift+right to left. Struggling to determine the syntax for this from man pages. This syntax is wrong, throws bad modifier, but captures the intent:  add Shift_L+Down = Up
60600
I would like to disable  Shift+Command+Q keyboard shortcut for Log Out.   I am using Karabiner at the moment, but I only managed to disable it completely using the following xml:  &lt;?xml version="1.0"?&gt; &lt;root&gt;     &lt;item&gt;         &lt;name&gt;Disable COMMAND SHIFT Q for Logout&lt;/name&gt;         &lt;identifier&gt;disable_CMD_SHIFT_Q_private&lt;/identifier&gt;         &lt;autogen&gt;__KeyToKey__ KeyCode::Q, VK_SHIFT | VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE&lt;/autogen&gt;     &lt;/item&gt; &lt;/root&gt;   but I would like to have the keyboard combination available in emacs (in ESS for debugging).  Is there some way that I can effectively unmap the keyboard combination?
62328
I've tried to read and understand this:   As a test, since my layout is "Polish, programmer" in the /usr/share/X11/xkb/symbols/pl file I played with remapping the 'q' character to 'x', and it worked just fine.  But what I want, is to remap LWIN (Left Super) to Left Control.   So I tried this: I started editing /usr/share/X11/xkb/symbols/pc file, assuming this is the 'root' of all the other files. Commented out this line:  //key &lt;LWIN&gt; {  [ Super_L       ]   };   and added this one:  key &lt;LWIN&gt; {    [ Control_L     ]   };   and rebooted PC, with no success. I.e. LWIN + C, doesn't copy selected text in text editors to clipboard, instead it just produces the 'c' letter. In the terminal instead of stopping current programm it also just produces the 'c' letter.  Here is my config file:   When I try the xev command and then press the Left Control Key, I see this:  KeyPress event, serial 40, synthetic NO, window 0x5a00001,     root 0x7e, subw 0x0, time 1053321, (374,-259), root:(374,545),     state 0x0, keycode 133 (keysym 0xffe3, Control_L), same_screen YES,     XKeysymToKeycode returns keycode: 37     XLookupString gives 0 bytes:      XmbLookupString gives 0 bytes:      XFilterEvent returns: False  KeyRelease event, serial 40, synthetic NO, window 0x5a00001,     root 0x7e, subw 0x0, time 1053425, (374,-259), root:(374,545),     state 0x0, keycode 133 (keysym 0xffe3, Control_L), same_screen YES,     XKeysymToKeycode returns keycode: 37     XLookupString gives 0 bytes:      XFilterEvent returns: False   BTW. Ask ubuntu suggests me two links to similar questions, but they are old, and suggest using xmodmap, and afaik it's no longer correct answer on Ubuntu >= 16.04 (Xenial) and this is precisely the version I have.  BTW2. I would really like to avoid using apps like Xbindkeys, considering there is a built in solution, which I guess I almost understand, and already spent some time on trying to understand it.
115779
I would like to use an interactive Posix bash shell but the autocomplete feature doesn't work. When I type the Tab character it simply prints a tab. The tab completion works only when I'm in a non-Posix shell or in a Posix shell with Emacs input mode. I find Emacs input mode very awkward, as I am used to vi input mode. Invoking bash with the sh command doesn't help.  Here is my /etc/inputrc:  # do not bell on tab-completion set bell-style audible  set meta-flag on set input-meta on set convert-meta off set output-meta on  # Completed names which are symbolic links to # directories have a slash appended. set mark-symlinked-directories on  set editing-mode vi set keymap vi-insert set mark-modified-lines on  $if mode=emacs  # for Linux console and RH/Debian xterm "\e[1~": beginning-of-line "\e[4~": end-of-line # commented out keymappings for pgup/pgdown to reach begin/end of history #"\e[5~": beginning-of-history #"\e[6~": end-of-history "\e[5~": history-search-backward "\e[6~": history-search-forward "\e[3~": delete-char "\e[2~": quoted-insert "\e[5C": forward-word "\e[5D": backward-word "\e[1;5C": forward-word "\e[1;5D": backward-word  # for rxvt "\e[8~": end-of-line "\eOc": forward-word "\eOd": backward-word  # for non RH/Debian xterm, can't hurt for RH/Debian xterm "\eOH": beginning-of-line "\eOF": end-of-line  # for FreeBSD console "\e[H": beginning-of-line "\e[F": end-of-line $endif
79708
I've got a script that is executed in order to have suspending/resuming working in my laptop. Then I have another series of xinput,xkbset and xmodmap commands that are executed when I initiate a session to have two-finger scrolling and keyboard shortcuts set up. When I resume from suspend, two-finger scrolling and my keyboard shortcuts won't work. I need to manually execute the commands in the second file again. How can I add those to the suspend/resume script to have this done automatically? See below:  suspend/resume script  /etc/pm/sleep.d/20_custom-ehci_hcd  #!/bin/sh #inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&amp;postcount=19 #...and http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug     # tidied by tqzzaa :)  VERSION=1.1 DEV_LIST=/tmp/usb-dev-list DRIVERS_DIR=/sys/bus/pci/drivers DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd HEX="[[:xdigit:]]" MAX_BIND_ATTEMPTS=2 BIND_WAIT=0.1  unbindDev() {   echo -n &gt; $DEV_LIST 2&gt;/dev/null   for driver in $DRIVERS; do     DDIR=$DRIVERS_DIR/${driver}_hcd     for dev in `ls $DDIR 2&gt;/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do       echo -n "$dev" &gt; $DDIR/unbind       echo "$driver $dev" &gt;&gt; $DEV_LIST     done   done }  bindDev() {   if [ -s $DEV_LIST ]; then     while read driver dev; do       DDIR=$DRIVERS_DIR/${driver}_hcd       while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do           echo -n "$dev" &gt; $DDIR/bind           if [ ! -L "$DDIR/$dev" ]; then             sleep $BIND_WAIT           else             break           fi           MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))       done       done &lt; $DEV_LIST   fi   rm $DEV_LIST 2&gt;/dev/null }  case "$1" in   hibernate|suspend) unbindDev;;   resume|thaw)       bindDev;; esac   touchpad two-finger scrolling and keyboard shortcuts script  xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Two-Finger Scrolling" 8 1 xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1 xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 10 xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 8 setxkbmap -layout gb xkbset m xkbset exp =m xmodmap -e "keycode 135 = Pointer_Button2"
28996
I'd like to remap my keys such that Ctrl behaves as the Caps Lock key and vice-versa. Also, if possible I'd like the settings to be available only within the currently logged-in user. How can I achieve this?  I'm a vim user, unlike the other people who use this machine, so I'd like those settings only for my account.
96729
I just jumped into a command line virtual console using Ctrl-Alt-F1, and i would now like to return to the gui. startx gives me something along the lines of 'this server is already active for display 0' if ...etc. it gives me a command to remove /tmp/.X0lock if that isn't the case...I could just restart the machine, but i'm worried i might mess something up.
72056
I am running Ubuntu 16.10 on a MacbookPro and keys 49 and 94 are inverted... I resolved this problem with xmodmap, but this won't apply permanently. After some research I found xmodmap is no longuer use by Ubuntu but xkb instead. So I searched in the configuration of xkb and I found in the config file /usr/share/X11/xkb/keycodes/macintosh this lines :   xkb_keycodes "badmap" {     &lt;TLDE&gt; =  94;     &lt;LSGT&gt; =  49; };  xkb_keycodes "goodmap" {     &lt;TLDE&gt; =  49;     &lt;LSGT&gt; =  94; };   This is exactly my problem, this two keys are inverted. So I wondering if I can't change my layout configuration with the param badmap.    The ouput of setxkbmap -query -v 10  Setting verbose level to 10 locale is C Trying to load rules file ./rules/evdev... Trying to load rules file /usr/share/X11/xkb/rules/evdev... Success. Applied rules from evdev: rules:      evdev model:      pc105 layout:     fr,fr,us variant:    mac,oss, Trying to build keymap using the following components: keycodes:   evdev+aliases(azerty) types:      complete compat:     complete symbols:    pc+fr(mac)+fr(oss):2+us:3+inet(evdev) geometry:   pc(pc105) rules:      evdev model:      pc105 layout:     fr,fr,us variant:    mac,oss,
12924
I cannot make xmodmap run on login in Ubuntu 13.04. I have searched around, including in askubuntu and all answers I found do not work.  I have a file named .Xmodmap in my home folder which contains the desired mappings. If I run it manually it works fine, so there is no error there. In order to make it run on startup, I have tried:     Using various .xinitrc containing one of the following commands:      xmodmap .Xmodmap xmodmap ~/.Xmodmap   /usr/bin/xmodmap /home/NAME/.Xmodmap if [ -s ~/.Xmodmap ]; then xmodmap ~/.Xmodmap fi  Using .Xresources instead of .xinitrc with the same variations. Setting it as a startup application.   None of the above works in Ubuntu 13.04 (64-bit). I also saw a few ideas about globally changing the keyboard mappings, but most of them were not applicable in Ubuntu 13.04 (i.e. the corresponding files did not exist where specified) and I prefer not to touch the global settings anyway.
27288
I have caps-lock key remapped to control, which usually works fine, but after some uptime and one/more suspend/awake cycles* this mapping breaks, and caps-lock reverts back to the default behavior -- i.e. turning on the led and capitalizing whatever I type. (Even though the Tweaks UI still shows it as being mapped to Ctrl -- see picture below.)  Questions:  Is this a known issue (with maybe a known fix)? (Could not find anything relevant with a quick search.) Is there a way to debug the problem, preferably from the command line?  *Remark: I'm not sure it is the suspend/awake cycle that causes the problem, but I can't connect it to anything else... Remark2: removing and readding the mapping (or rebooting) solves the problem, but it would be nice to find a more permanent solution.