4 ms·
I use autokey not as a hotkey but as text expansion. If I type "..c" then this is expanded into "{}" with the cursor inside the braces. And to surround text wit
by limecat 3y ago
I use autokey not as a hotkey but as text expansion. If I type "..c" then this is expanded into "{}" with the cursor inside the braces. And to surround text with "{}" I use ",,c", hence "whatever,,c" becomes "{whatever}". I have similar text expansion for other symbols that require AltGr, square braces are ..s and ,,s for instance. On Windows Autohotkey can do the same, just the scripting language is different. The Autokey text for curly braces is simply "{}<left>" and for surrounding with curly braces the script is:
import time
keyboard.send_keys("<shift>+<ctrl>+<left>")
time.sleep(0.25)
sample = clipboard.get_selection()
keyboard.send_key("<delete>")
keyboard.send_keys("{%s}" % sample)
Maybe it helps you.
- jagaerglad 3y agoThat is actually very smart and helpful, thanks! :) My only gripe with autokey is that it's the only thing holding me back from wayland. Hawck is supposed to work with wayland but I never got it to work, was a while ago I tried though https://github.com/snyball/Hawck https://github.com/snyball/Hawck
- limecat 3y agoI don't use Wayland, but it seems xdg-desktop-portal since 1.16.0 has a 'Global Shortcuts portal'. Perhaps check it out. https://github.com/flatpak/xdg-desktop-portal https://github.com/flatpak/xdg-desktop-portal