Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 509  / 3 Years ago, tue, june 1, 2021, 11:05:12

Using Kubuntu on a Macbook there is no delete key. Delete can be done with Backspace+Fn, but there is only one Fn on the farthest corner from Backspace, so that a delete action requires both hands.


I don't use CapsLock for uppercase, I use Shift for that, so CapsLock could be used for delete. I can make it act as a Backspace with the keyboard advanced settings, but this new Backspace doesn't work with Fn in order to delete.


How could I make CapsLock work as a key for "Backspace+Fn=delete" or simply turn it into a Delete key?


More From » keyboard

 Answers
4

Here and here I have found that the keycode for Capslock is 66. From here I've got the command to remap Caps Lock as Delete:


xmodmap -e "keycode 66 = Delete"

After testing that it worked I have made it run at startup by creating the file ~/.config/autostart/capslock-delete.desktop (based on last link) with the lines:


[Desktop Entry]
Exec=sh -c 'xmodmap -e "keycode 66 = Delete"'
Name=capslock is delete
Terminal=false
Type=Application

It may happen that the Capslock key continues to trigger lock-uppercase beside doing delete. It needs to be disabled as said here, or in KDE, under keyboard settings - Advanced - Capslock behavior - Disable...


Update:


In case the solution of the said above desktop file or command to run at startup is not working, following this answer, this seems to work in Kubuntu 22.04:



  • create a file ~/.Xmodmap containing the keycode setting: keycode 66 = Delete



  • create a script like for example ~/bin/capslock.delete.sh:


     #!/bin/bash           
    sleep 1;
    echo "running xmodmap"
    xmodmap ~/.Xmodmap


  • make the .sh file executable



  • add the same script file to be executed at startup






In case one still wants a key or key combination to lock the upper keys (the CapsLOck key default behavior), the following command - involving xdotool - which can be associated with shortcut like Super+CapsLock or Alt+CapsLock) - will do:


xdotool key Caps_Lock

Install xdotool:


sudo apt install xdotool

I have associated Alt+CapsLock with the command sh -c 'xdotool key Caps_Lock'.


One would expect that xdotool might be used in the first place to get the delete action with a command like:


xdotool key Delete

but that doesn't seem to work very well, as said here; I have been able to use it - sort of - with Ctrl+D, but that only deletes text to the right without deleting files. A good alternative to get the delete action (as well as others that I haven't tested) is to use AutoKey, described here, about the delete action:


enter image description here


[#588] Wednesday, June 2, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tionpromoti

Total Points: 14
Total Questions: 112
Total Answers: 113

Location: Tonga
Member since Tue, Nov 30, 2021
3 Years ago
tionpromoti questions
;