9

In my ~/.XCompose, I have this line:

<Multi_key> + <3> + <3> : "¯\_(ツ)_/¯" # Shrug.

Which sadly, does not do what I want. Since only the first characters of the shrug is used.

Can I have multiple characters based of one key combinations?

6

1 Answer 1

5

Compose sequences which outputs strings (as opposed to just boring characters) seem to work in some applications. I’ve only tested a few.

It works in:

  • gedit
  • xterm

It doesn’t work in:

  • firefox
  • gnome-terminal

Also your mapping doesn’t work for me. But it does if I remove the plus signs:

<Multi_key> <3> <3> : "¯\_(ツ)_/¯" # Shrug.

And you should escape the backwards slash:

<Multi_key> <3> <3> : "¯\\_(ツ)_/¯" # Shrug.

Update 2021-10-30

I’ve ended up using compose sequences that output strings (rather than just single keysyms/characters) quite a lot. I mostly use it for single words.

In my experience it works really well, i.e. it works on most contexts that I type things.

This emoji now works for me in all four applications that I originally tested.

My own strings don’t contain Katakana () so they might be easier to use in more settings (higher Unicode code points might be less supported?).

Some exceptions:

  • Can’t use compose mappings to strings (or any compose mappings?) in the search prompt in CopyQ (clipboard manager)
  • Might not work in popup dialogs or other secondary windows
  • It works in Intellij but the string is ostensibly typed rapidly one character at a time, instead of just appearing right away like it does in most applications. This has no functional downside
8
  • 1
    Of course, it works in things I do not use and does not in things I do. Typical! ☺Thank you. Oct 29, 2019 at 8:03
  • 2
    I've tested right now, and those multi-char sequences definitely work on the browser (but seem to fail in Qt applications). Remember that ~/.XCompose is read by libX11 only during a program startup, which means new processes will support new mappings, while old ones need to be relaunched. wiki.debian.org/XCompose Nov 12, 2019 at 13:39
  • 2
    Works for me in Firefox and gnome-terminal on Fedora 32. IBus 1.5.21 (Aug 23, 2019) had enhancements to the Compose key functionality. That might explain why it now works. desktopi18n.wordpress.com/2019/10/17/ibus-1-5-21-is-released I tested in both X11 and Wayland. May 15, 2020 at 5:44
  • 3
    @TomAnderson I successfully tested in the Cinnamon Spin of Fedora 32. The blog post I linked to says "you need to enable more than one IBus engine." I used im-chooser > Use IBus > Preferences to add Japanese - Kana Kanji and then the above example of 33 becoming a shrug worked. I do see a warning printed in the console by im-chooser which says "GTK+ supports to output one char only." But it works anyway. Jun 8, 2020 at 2:59
  • 2
    @RobinA.Meade Aha! I had missed that detail, and indeed, with that trick, it works! Thank you! I don't know Japanese, so i have picked Ancient Greek as my second engine, which is fine υντιλ ι αχτἰατε ιτ βψ μιστακε. I notice that now when i use the compose key, a special marker appears, an underlined square overlapping a circle. Clearly some more powerful sorcery is now at work. Right, off to set up compose sequences for all the alchemical symbols i've been missing ... Jun 8, 2020 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .