What if I want to combine Ctrl+Shift+1+0 to obtain “≠”, for example? I’m saying this combination, like I could say any other (like a+b), it’s just one example.

  • palordrolap
    link
    fedilink
    51 year ago

    A couple of options present themselves.

    1. If you’re willing to forego the key combination and can live with an alternative, you might want to check if your system supports the Compose key. It might not be bound by default, but it’s often put on Scroll Lock, or, if you have a non-US keyboard, to Shift+AltGr.

    Once the Compose feature is activated, certain sequences of keypresses can be, well, composed into a new character. Various “obvious” combinations are usually supported by default.

    e.g to get “≠” I hit Shift+AltGr, let them go and then type “/” followed by “=” (no quotes). It also works with the slash and equals in the other order. Some compositions only work in one order, but most work either way. Other symbols that are very much not on my UK keyboard include ä, é, ß, ¤, °, ±, ², etc. (Shift+AltGr followed by "a, 'e, ss, ox, oo and ^2 respectively).

    1. Check if your window manager has a keyboard configuration tool that allows the running of commands on certain key combinations. I use Cinnamon which has this.

    You could then set up Ctrl+Shift+0 (probably not 1 and 0 at the same time though) to run a command like sleep 0.5; xdotool type "≠".

    You’d need to install xdotool if you don’t already have it installed, and you’d have to get ≠ for the command itself from the Character Map or copying it from another source to avoid the Catch-22 there.

  • lemmyvore
    link
    fedilink
    English
    4
    edit-2
    1 year ago

    I may be wrong but I don’t think xmodmap can do key combinations. You can use it to remap individual keys and modifiers.

    I would suggest autokey for what you want. With it, you create a phrase that outputs ≠ and assign it to the key combo you want.

    Keep in mind that using both 1 and 0 for a combo won’t work, you must use a single normal key plus optional modifiers.

    You can do it if you reassign either 1 or 0 to be a modifier, but I imagine you need to write 1 and 0 occasionally.

    You could remap one of them temporarily with xmodmap, trigger the combo you want with autokey, then map them back. You can use autokey to run commands to apply xmodmap maps, or you can run the commands in other ways (command line, taskbar shortcuts etc.)

    If you have a smart keyboard (for example one using Via or QMK firmware) you can do these kind of shenanigans directly with the firmware.

    • @MoshpiritOP
      link
      11 year ago

      I’ll investigate it, thanks!

  • @[email protected]
    link
    fedilink
    1
    edit-2
    1 year ago

    Edit: IGNORE I’m probably wrong. Old comment:

    I don’t think you can do that using xmodmap.

    You can only enable preconfigured options (which are defined somewhere under /usr/share/X11/xkb on my computer) using xmodmap.

    You can create your own keyboard configuration using xkbcomp, but it’s a pain in the ass and not super well documented. I did that once but forgot all about it.

    Edit: OK scratch that. I was thinking of setxkbmap, but I’m pretty sure there’s also a bunch of limitations to xmodmap. Sorry.

  • @[email protected]
    link
    fedilink
    11 year ago

    I don’t have the information regarding xmodmap, but here are two other options which I am using if you are interested.

    • With the compose key set, you can hit / = to get ≠. Or you can set custom sequences in .XCompose, but I don’t believe you can get the exact combination you suggested.
    • Use a virtual keyboard manager such as KMonad
  • @[email protected]
    link
    fedilink
    11 year ago

    Possibly look into using other level modifiers. I use caps lock as level 5 mod to use navigation at home row. You could then map custom keys to say Caps+0

    This would also help avoid polluting the ctrl, ctrl+shift layers at they are typically application level keybinds.

    But this would have a higher learning curve than using other tools for key mapping.