It grew out of a niche, almost historical need: using a QWERTY keyboard, but needing access to German Umlauts (ä, ö, ü, as well as ß). Switching keyboard layouts is possible but exhausting (it's much more pleasant sticking to one); using modifier keys is similarly tedious, and custom setups break and aren't portable.
So this tool can do:
$ echo 'Gruess Gott, Poeten und Abenteuergruetze!' | srgn --german
Grüß Gott, Poeten und Abenteuergrütze!
meaning it not only replaces Umlauts and Eszett, it also knows when not to (Poeten), and handles arbitrary compound words. Write your text, slap it all into the tool, it spits out results instantly. The original text can use alternative spellings (ou, ae, ue, ss), which is ergonomic. Combined with tools like AutohotKey, GUI integration through a single keyboard shortcut is possible. See [0] for a similar example.
A niche need I haven't yet come across someone else having as well! (just the amount of text explaining what it's all about is saying a lot in terms of specificity...)
The tool now grew into a tree-sitter based (== language grammar-aware) text manipulation thing, mostly for fun. The bizarre German core is still there however.
I also use a QWERTY keyboard and I use a custom keyboard layout that maps alt-a to ä, alt-u to ü, alt-o to ö, alt-s to ß (plus the same for uppercase for the first 3). That works well for me without the need to post-process.
On macOS you can also access related symbols by long-pressing keys. Obviously for large blocks of text you're still going to want to switch layouts but for a quick IM reply or typing a couple of characters I think it's faster.
The faster way is to press Option + U and then the letter u for ü or a for ä. Have been using a US keyboard since before this long press feature came over from iOS and it’s way faster that way.
I’ve done the same exact thing but for Latvian diacriticals (āčēģīķļņšūž).
The default behaviour of the Latvian layout in macOS is to make apostrophe a dead key, which really grinds my gears. So I made it alt+whatever letter instead. As a dev I use apostrophe way too much to be okay with typing '+space for it.
Now that is a tool I never knew I needed, great idea! I get by with the compose key or just googling the Umlaut if I have not set it up.
I guess I have just nerdsniped myself into building a script/hack that can automatically edit the clipboard and/or selected text on button press. There goes my weekend, but thank you for building this part!
And how is it less tedious to have to select previously typed text all the time? Is it mainly better because then you don't need to do anything on individual chars, but do it in a batch?
> And how is it less tedious to have to select previously typed text all the time?
This is tedious, but I have that automated (AutoHotKey). So a single, AHK-managed hotkey does the equivalent of:
CTRL + SHIFT + HOME
CTRL + C
feed into tool, paste back
CTRL + V
So once done writing, I press that single button and it's done (CTRL+SHIFT+HOME select all text from cursor to beginning). To me, that's a better tradeoff than fiddling with compose keys, which I find to break flow. For very short text, compose key is possibly better; but again, once in AHK, it's a single shortcut. So once more than 1 compose key combination is needed, it's "worth it". But you're right: this is a custom setup and might not work for everyone.
Oh, I didn't see the "CTRL + SHIFT + HOME" part in the linked AHK script, only the later steps, that's definitely less tedious, though also more dangerous (wouldn't work in rich text apps with tables and pictures etc.? though maybe your tool is smart enough to deal with rich text in the clipboard) and also pollutes the undo buffer.
Agree re. the potential to break flow part of the compose keys in general (all these grammar things should be automated away), though maybe in case of needing just a single diacritic the least fiddly alternative could be something like a hotstring in AHK ",u" to "ü" (comma + a letter without spaces, which doesn't happen in regular typing or a deadkey in keyboard layout with a similar effect)
It's currently whitelist-based [0]. The downside is larger (code) size. The upside is simplicity. I imagine a blacklist could also work well, at smaller size but with more preprocessing needed.
I've been thinking about a tool to format a number where the common display format is abc.defg.hijk.lmn (but I'd be retrieving it from an e.g. database without the periods), the sample AutoHotkey script is a great starting point!
This is why I stick to layouts with separate keys for " and the dead-key ¨
Plenty of european layouts with qwerty and the necessary dead keys, that work on every OS.
It grew out of a niche, almost historical need: using a QWERTY keyboard, but needing access to German Umlauts (ä, ö, ü, as well as ß). Switching keyboard layouts is possible but exhausting (it's much more pleasant sticking to one); using modifier keys is similarly tedious, and custom setups break and aren't portable.
So this tool can do:
meaning it not only replaces Umlauts and Eszett, it also knows when not to (Poeten), and handles arbitrary compound words. Write your text, slap it all into the tool, it spits out results instantly. The original text can use alternative spellings (ou, ae, ue, ss), which is ergonomic. Combined with tools like AutohotKey, GUI integration through a single keyboard shortcut is possible. See [0] for a similar example.A niche need I haven't yet come across someone else having as well! (just the amount of text explaining what it's all about is saying a lot in terms of specificity...)
The tool now grew into a tree-sitter based (== language grammar-aware) text manipulation thing, mostly for fun. The bizarre German core is still there however.
[0]: https://github.com/alexpovel/betterletter/blob/c19245bf90589...