r/linux4noobs • • 5h ago

learning/research What system file does one edit to change keyboard short cuts. Example: for '♥' that's 'CTRL'+'SHIFT'+'U'+2665. I'd like to to be 'ALT'+3. Thanks

Pretty straight forward, there are a group of symbols that I use, and would prefer to be able to still use them very quickly (fewer keystrokes, more 'intuitive' selections.

While I know them for Alt code, I don't know where to instruct Linux to do the same.

No specific OS given as I think this would be a handy informative for any OS that users know how to do so in, assuming they're all a single text file that needs to be edited.

Thanks!

The specific ones I'd like to re-bind:

  • ° =CTRL + SHIFT+U+00B0 or ALT+167
  • ≠ =CTRL + SHIFT+U+2260or ALT+8800
  • ≥ =CTRL + SHIFT+U+2265or ALT+242
  • ≤ =CTRL + SHIFT+U+2264or ALT+243
  • ≈ =CTRL + SHIFT+U+2248or ALT+247
  • 🡙 =CTRL + SHIFT+U+1F859or ALT+18
  • 🡘 =CTRL + SHIFT+U+1F858
  • ˅ =CTRL + SHIFT+U+02C5
  • ˄ =CTRL + SHIFT+U+202C4
  • ⅛ =CTRL + SHIFT+U+215B
  • ⅙ =CTRL + SHIFT+U+2159or ALT+8537
  • ⅕ =CTRL + SHIFT+U+2155
  • ¼ =CTRL + SHIFT+U+00BCor ALT+0188
  • ⅓ =CTRL + SHIFT+U+2153
  • ⅜ =CTRL + SHIFT+U+215C
  • ⅖ =CTRL + SHIFT+U+2156
  • ½ =CTRL + SHIFT+U+00BDor ALT+0189
  • ⅗ =CTRL + SHIFT+U+2157
  • ⅝ =CTRL + SHIFT+U+215D
  • ⅔ =CTRL + SHIFT+U+8532
  • ¾ =CTRL + SHIFT+U+00BEor ALT+0190
  • ⅘ =CTRL + SHIFT+U+2158
  • ⅚ =CTRL + SHIFT+U+215A
  • ⅞ =CTRL + SHIFT+U+215E
  • ♥ = CTRL + SHIFT+U+2665or ALT+3

Yes, this just took me 33 min to write this up, #1 because I'm old and slow. #2 Because I wanted to manually learn the unicode-codes (and show my work)

Thanks for your help in figuring out how to re-bind/add keyboard shortcuts to various Linux distros.

8 Upvotes

17 comments sorted by

5

u/m4uri 4h ago

On Linux the usual way is the Compose key plus a ~/.XCompose file, not Alt codes. First enable a Compose key, e.g. Right Alt (GNOME: Tweaks > Keyboard, KDE: System Settings > Keyboard > Key Bindings, Mint Cinnamon: Keyboard > Layouts > Options). Then create ~/.XCompose:

include "%L"
<Multi_key> <h> <h> : "♥" U2665

Log out and back in, then RightAlt, h, h gives ♥. Pick sequences that don't clash with the defaults in /usr/share/X11/locale/en_US.UTF-8/Compose.

Good news, a lot of your list already works out of the box: Compose o o gives °, Compose 1 2 gives ½, Compose = / gives ≠, Compose > = gives ≥.

Small fix for your list: ⅔ is U+2154 and ˄ is U+02C4.

2

u/Testificate_2011 4h ago

Small fix for your list: ⅔ is U+2154 and ˄ is U+02C4.

Thank you so much, editing now!

Also, more so, thank you for the instructions. Trying to act on it now...

Nothing is appearing on my system when searching "GNOME" or "GNOME Tweaks" And I currently don't run KDE/Mint Connamon (but hopefully that will help others). is "GNOME Tweaks" a different program one must download and install from online?

What is the actual file directory, and file name for the <filename>.XCompose ? /home/<user>/ ?

These details ^ always seem to be missing from instructions, and the short hand isn't intuitive to understand what is going on or where something is being pointed towards.

Good news, a lot of your list already works out of the box: Compose o o gives °, Compose 1 2 gives ½, Compose = / gives ≠, Compose > = gives ≥.

I have 0 clue what you're doing here. I don't have a 'compose' button. "Composition" is something I've done for music, but not on a computer. and I don't understand the syntax that's being provided either o o or is it oo ? As shown I, and most novice users get extremely confused when short hands are used and not taught first.

Thanks, hopefully some clarification will help to make this a reality.

1

u/Rich_Warthog8823 3h ago

The Compose key can be assigned to any key, but it has to be the first key when pressing combinations for special letters.  GNOME Tweaks probably needs to be installed through whatever your package manager is, if you're not finding it when searching for system packages.  The ~/ is always a shortcut for /home/user/, you're correct with that guess.  I'd also navigate to that /usr/share/X11/locale/en_US.UTF-8/Compose file path to see what the defaults are.

5

u/ResponsibilityBig343 4h ago

I don't know how its done universally for all desktop environment(maybe something to do with the display server). On my window manager i3 I can configure it in .config file. I personally find it easier to do these things via desktop env/window manager configs.

-3

u/Testificate_2011 4h ago

Well that's neat for windows. Hoping to learn about Linux systems.

I think in the windows 3.1 era I edited a .config files for keybinds, but I wouldn't trust that memory.

6

u/ResponsibilityBig343 3h ago

Not windows. I'm talking about 'window' manager on linux systems. They decide how different windows/tabs are organized on your screen.

1

u/Eric_Dawsby 4h ago

Commenting because I want to know too

2

u/Testificate_2011 4h ago edited 4h ago

Yay! Lets hope people who know are willing to teach others, and not just karma farm with "Try a different distro." "RTFM - Look at me! I'm helpful because I'm telling them to do the work that I ignored they already did, I'm the best teacher in the world hur hur"

EDIT: I have no clue why children are so hostile on this subreddit, meant for new users. They must be very upset individuals, and I hope they get the care they deserve/need in the real world sooner rather than later.

1

u/AutoModerator 5h ago

There's a resources page in our wiki you might find useful!

Try this search for more information on this topic.

✻ Smokey says: take regular backups, try stuff in a VM, and understand every command before you press Enter! :)

Comments, questions or suggestions regarding this autoresponse? Please send them here.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

-1

u/tbrigadier 4h ago

Read the manuals and teh googles about XCompose.

3

u/Testificate_2011 4h ago

Well, if manuals on "teh goodles" about XCompose, answered this question I'd love to teach others. If you don't know, that's ok to. If you do know, please share!

2

u/tbrigadier 4h ago

I mean, literally, "man XCompose"

0

u/Testificate_2011 4h ago

Ok, what is "man XCompose" that's not a program that comes up when searching for it on my system (Linux4Noobs here meaning new users who don't know what's going on, and don't know shortcuts or program names and locations)

Also, if you don't know how to do what's requested in the post, that's ok. Don't need to answer questions that aren't being asked.

3

u/Rich_Warthog8823 3h ago

Sorry, people have been hostile.  Man is short for manual.  In the terminal, you can type "man xcompose" to read the manual for that, but it might not show anything if it's not installed.  You can (and it's what I do too) also search online for "man [program or command]" and more than likely, the first few top results will have the entries you're looking for. 

2

u/pahool 1h ago

Yeah, you may need to install either libX11-devel or libX11-docs to get the xcompose documentation. I had to install libX11-devel on fedora to get the man pages for XCompose.

This page:

https://gist.github.com/LexouDuck/d5ac0037b35731199205b48869aebe66

has a brief explanation of xcompose and an example of a pretty robust xcompose config file.

0

u/ResponsibilityBig343 4h ago

Not nagging on man pages but if one was to man pages for every module they use they'd be 10yrs older.

2

u/tbrigadier 4h ago

Sure. Not insisting on that.