LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-04-2012, 11:23 AM   #1
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 492

Rep: Reputation: 45
FULL LIST of Entering Special Characters with Compose Key?


I have found many lists of compose key sequences for entering special characters, e.g.:
  1. This one
    1. It is lacking, though. E.g., it lacks ← and → ( compose + -> or compose + -< ).
  2. a fuller list: http://fsymbols.com/keyboard/linux/compose/
  3. the most comprehensive I've seen yet: https://help.ubuntu.com/community/GtkComposeTable
Yet none of them are complete. The interrobang ‽, e.g., is not on those lists; its sequence is: comp. + ? + !


Is there a complete list? Why does KCharSelect not say how to enter special characters with the compose key? Or does it? Thanks
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-04-2012, 02:14 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I don't know if there is a "complete" list outside of the configuration files themselves, due to the sheer number of them. On most systems (I believe) you'll find them at one of these locations:

/usr/share/X11/locale/<locale>/Compose
/usr/X11R6/lib/X11/locale/<locale>/Compose

This page offers a short script that will search your locale's Compose file for you (only utf-8 locales supported).

http://www.pixelbeat.org/docs/xkeyboard/

Just hand it the actual character you want to find the mappings for and you'll get a list of the compose sequences defined for it.

If you're interested, I've rewritten it into a more solid bash-based script that can handle multiple input characters at once. I recommend it over the original, of course.

Code:
#!/bin/bash

# List the X compose sequences available to generate the specified character.
# I.E. the keyboard key sequence to enter after the compose (multi) key or
# a dead key is pressed.
#
# This version has been heavily modified by me (David the H.).  It is now
# bash-specific, reduces the need for external tools (only grep is needed),
# and can handle multiple inputs.
#
# Original script info follows.  For the original version, go here:
# http://www.pixelbeat.org/docs/xkeyboard/
#
# Author:
#    P@draigBrady.com
# Notes:
#    GTK+ apps use a different but broadly similar input method
#    to X by default. Personally I tell GTK+ to use the X one by
#    adding `export GTK_IM_MODULE=xim` to /etc/profile
# Changes:
#    V0.1, 09 Sep 2005, Initial release
#    V0.2, 04 May 2007, Added support for ubuntu
#

if [[ -z $* ]]; then
	echo "Usage: ${0##*/} 'character(s)'" >&2
	echo "Multiple characters are supported." >&2
	echo "They don't need to be space-separated." >&2
	exit 1
fi

if [[ $LANG =~ (.*)[.]UTF.*8 ]]; then

	lang="${BASH_REMATCH[1]}"
	codeset=UTF-8

else

	echo "Sorry, only UTF-8 is supported at present" >&2
	exit 1
	#could try and normalise codeset, and get char with printf %q
	#but would not be general enough I think.

fi

dir=/usr/share/X11/locale #ubuntu

if [[ ! -d "$dir" ]]; then

	dir=/usr/X11R6/lib/X11/locale #redhat/debian

fi

if [[ ! -f "$dir/locale.dir" ]]; then

	echo "Sorry, couldn't find your X windows locale data" >&2
	exit 1

fi

page="$( grep -m1 "${lang}.${codeset}$" <$dir/locale.dir )"
page=${page%%/*}

file="$dir/$page/Compose"

while read -n 1 character; do

	[[ -z $character ]] && continue
	echo "combinations found for [$character]"
	grep -F "\"$character\"" "$file"
	echo

done <<<"$@"

exit 0
Example usage (I have it aliased to "ximkeys"):
Code:
$ ximkeys ←→‽
combinations found for [←]
<Multi_key> <less> <minus>      : "←" U2190 # LEFTWARDS ARROW

combinations found for [→]
<Multi_key> <minus> <greater>   : "→" U2192 # RIGHTWARDS ARROW

combinations found for [‽]
<Multi_key> <exclam> <question>         : "‽"   U203D # INTERROBANG
Be aware though, as the original script header says, that GTK uses its own internal mapping system by default, ignoring the X compose table, so some compositions may be handled differently in GTK apps.

Last edited by David the H.; 01-04-2012 at 02:18 PM. Reason: updated example
 
3 members found this post helpful.
Old 01-05-2012, 12:11 AM   #3
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 492

Original Poster
Rep: Reputation: 45
Thumbs up

Quote:
Originally Posted by David the H. View Post
I've rewritten it into a more solid bash-based script that can handle multiple input characters at once. I recommend it over the original, of course.

Code:
#!/bin/bash

# List the X compose sequences available to generate the specified character.
# I.E. the keyboard key sequence to enter after the compose (multi) key or
# a dead key is pressed.
#
# This version has been heavily modified by me (David the H.).  It is now
# bash-specific, reduces the need for external tools (only grep is needed),
# and can handle multiple inputs.
#
# Original script info follows.  For the original version, go here:
# http://www.pixelbeat.org/docs/xkeyboard/
#
# Author:
#    P@draigBrady.com
# Notes:
#    GTK+ apps use a different but broadly similar input method
#    to X by default. Personally I tell GTK+ to use the X one by
#    adding `export GTK_IM_MODULE=xim` to /etc/profile
# Changes:
#    V0.1, 09 Sep 2005, Initial release
#    V0.2, 04 May 2007, Added support for ubuntu
#

if [[ -z $* ]]; then
	echo "Usage: ${0##*/} 'character(s)'" >&2
	echo "Multiple characters are supported." >&2
	echo "They don't need to be space-separated." >&2
	exit 1
fi

if [[ $LANG =~ (.*)[.]UTF.*8 ]]; then

	lang="${BASH_REMATCH[1]}"
	codeset=UTF-8

else

	echo "Sorry, only UTF-8 is supported at present" >&2
	exit 1
	#could try and normalise codeset, and get char with printf %q
	#but would not be general enough I think.

fi

dir=/usr/share/X11/locale #ubuntu

if [[ ! -d "$dir" ]]; then

	dir=/usr/X11R6/lib/X11/locale #redhat/debian

fi

if [[ ! -f "$dir/locale.dir" ]]; then

	echo "Sorry, couldn't find your X windows locale data" >&2
	exit 1

fi

page="$( grep -m1 "${lang}.${codeset}$" <$dir/locale.dir )"
page=${page%%/*}

file="$dir/$page/Compose"

while read -n 1 character; do

	[[ -z $character ]] && continue
	echo "combinations found for [$character]"
	grep -F "\"$character\"" "$file"
	echo

done <<<"$@"

exit 0
Thanks for the excellent script
 
Old 01-05-2012, 02:21 AM   #4
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by David the H. View Post
I don't know if there is a "complete" list outside of the configuration files themselves, due to the sheer number of them. On most systems (I believe) you'll find them at one of these locations:

/usr/share/X11/locale/<locale>/Compose
/usr/X11R6/lib/X11/locale/<locale>/Compose
Or at ~/.XCompose - if you or somebody or some utility has created this file. (This is the best way to add user customisations - it can include the full locale file.)
 
1 members found this post helpful.
Old 02-01-2012, 12:16 AM   #5
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 492

Original Poster
Rep: Reputation: 45
No ∞ symbol?

I can't find the infinity ∞ symbol. I wonder why.
 
Old 02-01-2012, 04:26 AM   #6
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by Geremia View Post
I can't find the infinity ∞ symbol. I wonder why.
Not enough googling?

In your ~./XCompose file, a line like this
Code:
<Multi_key> <8> <8>             : "∞"   U221E # INFINITY
will do the trick
(or whatever other sequences of keys you want to use - some people like <0> <0> - one guy likes <1> <slash> <0> )
 
Old 02-02-2012, 04:46 PM   #7
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 492

Original Poster
Rep: Reputation: 45
Quote:
Originally Posted by SecretCode View Post
<1> <slash> <0>
Haha thanks
 
Old 09-16-2019, 09:16 PM   #8
oblate
LQ Newbie
 
Registered: Sep 2019
Posts: 1

Rep: Reputation: Disabled
I came across this thread and found it does not have a satisfactory answer for my use case, using the compose sequences in a script without already having x11 (or possibly linux) installed. In this case we can get the listing straight from the source (more or less): https://raw.githubusercontent.com/mi...-8/Compose.pre.
 
  


Reply

Tags
character, characters, kde, keybindings, special



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Lost compose key after changing to utf-8 BroX Slackware 4 03-04-2012 10:30 AM
Creating new compose and dead-key combinations DavidMcCann Linux - General 3 10-13-2007 05:01 AM
How do I get Right-Alt key to be just Alt and not generate special characters? (KDE) KWTm Linux - General 2 06-25-2005 09:26 PM
compose key not working jkobrien Linux - Hardware 1 08-05-2004 08:18 AM
Compose special characters under X11 in rdesktop spiky Linux - General 1 06-10-2004 06:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration