Author

Topic: Here is how to produce the ₿ (Bitcoin) symbol in xorg (Linux/BSD/etc) by keypres (Read 213 times)

legendary
Activity: 2030
Merit: 1573
CLEAN non GPL infringing code made in Rust lang
a little geeky but would come handy to me, thanks.

Glad it helped you. I decided to post this because I couldn't quickly find the answer on how to do it myself, so I decided to tackle this problem and post the solution. Now its hopefully indexed by the search engines, so the next person (using Xorg) that wants to push a key and get ₿ (or any other unicode symbol) can hopefully find this post now.
member
Activity: 532
Merit: 15
a little geeky but would come handy to me, thanks.
legendary
Activity: 2030
Merit: 1573
CLEAN non GPL infringing code made in Rust lang
The (Bitcoin) symbol exists officially in unicode under code U+20BF since 2017 (Unicode v10). If you have a fairly recent Unicode font, such as Google's Noto, you can already see the Bitcoin symbol and use it by copy paste or unicode input along the traditional fiat symbols like $, £, €, etc.

But wouldn't it be nice to have it at your disposal by just pressing a key? Well you can!

xmodmap to the rescue. Yup, xmodmap can assign any key you like to produce this (or any other) unicode symbol.

All you need to do is execute the xmodmap command. First take a look at your current settings with xmodmap -pke

I noticed an unassigned key, menu with shift, so in my case i used:
Code:
xmodmap -e "keycode 135 = Menu U20BF Menu"

The columns after = means what does the key do when you just press it, when you press it with shift, or when you use altgr. US keyboards might actually just need the first two, other more complex key combinations exist such as when the compose key is enabled (ie. a 4th column means altgr+shift, etc).

If you add this to your user xmodmap config file, at ~/.Xmodmap then you don't need to repeat this command every time you login:
Code:
keycode 135 = Menu U20BF Menu

If you want to use another key, or some unused key, you can use xev to find out the keycode, just run:
Code:
xev -event keyboard
and press the key to find out its keycode. In Arch and its derivatives you need to install the package xorg-xev.

And that is all, you can now just press your key and have the (Bitcoin) symbol ready for your chats or any other text typing.
Jump to: