I searched and played around in the system settings but I can’t quite figure it out, is there a way to set a keyboard shorcut that pastes some pre-defined text with EndeavourOS’s built in tools?
Or do I really have to install something like xdotool?
LE: Oh and espanso doesn’t seem to work, it has a bug detailed here , who knows when it will be fixed, and I’ve searched alternativeTo and haven’t found anything else that works/is current/not discontinued/for wayland not x11.
Tried xdotool with xdotool-gui too and either it’s not what I am looking for(that’s what some youtube vids would suggest) or I can’t figure out how to use it.
You can do it only with bash.
Just create an entry “bind key:command”
For example I have this silly thing.
#F12 cowsay info
alias cowinfo='echo -ne "Who am I?\t$(whoami)\nWhere am I?\t$(pwd)\nWhen am I?\t$(date "+%T %d.%m.%Y")\nWhat'\''s this?\t$(uname -n)\nWhat'\''s on it?\t$(uname -sr)\n\n$(fortune)" | cowsay -n'
bind '"\e[24~":"\C-kcowinfo\n"'
When I press F12 in terminal it will write it and execute the command.
example
~ >>> cowinfo
___________________________________________________________________________
/ Who am I? vlkon \
| Where am I? /home/vlkon |
| When am I? 18:11:57 04.10.2024 |
| What's this? pc |
| What's on it? Linux 6.11.1-arch1-1 |
| |
| Every program has (at least) two purposes: |
\ the one for which it was written and another for which it wasn't. /
---------------------------------------------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
~ >>>
I am using KDE Plasma, and what I want is primarily for the browser(brave) but I suppose it wouldn’t hurt if it worked everywhere, if that is doable.
Basically since I was unable to get keepassxc’s autotype feature to work properly under wayland it would be nice if I could set a key combo, say Left Ctrl+2 for example, and when I press it my email adress gets inserted/pasted/whatever you wanna call it into the text field I am in.
I’ll try that ai thing tomorrow morning if nobody comes up with a better idea until then, good night all.
aur/espanso-wayland-git 2.2.0.r64.gd99e5d9-4 (+7 0.52) (Installed: 2.2.0.r100.g335f6673-1)
Cross-platform Text Expander written in Rust (built for Wayland)
That definitely works, haven’t installed the non-git version for ages.
xdotool is for x, not wayland.
Oh, this can be done inside the command field of KDE’s shortcut manager. One second.
The command should be:
xdotool type "email@email.com"
Note: I’m testing this in Openbox. So, right now, it opens a bunch of apps for me possibly due to conflicting shortcut keys/managers, but it should work for you.
If it doesn’t, log out and log back in, then remove the shortcut.
Under wayland (and not only there) ydotool is the replacement(?) of xdotool.
Installation or setting is not trivial but you will find a case here in the forum about it.
Edit: @VIKINGS
It seems to me you tend to over-specify the claims you make here on the forum. Although some of them do encourage us to learn new things.
I tried ydotool and a python program with pyautogui and they work partially
but writing the at sign (@) caused difficulties not to mention the universal usage.
In the spirit of KISS CopyQ would cover your basic needs IMO. Peace.
Thank you very much for everyone’s suggestions, but I would really like to go with @ddnn 's as the winner if possible. It’s exactly what I wanted, a simple way to do it with the OS’s built in tools, no need to install and configure any extra stuff, yaaay.
However I tried it(with Ctrl+2 and Ctrl+@ aka Ctrl+Shift+2 and Ctrl+Alt+2) and the first time I press the buttons after adding the command and giving it a shortcut it works correctly(except that annoying input permission box still pops up), but after that just like he pointed out it has some weird behavior opening up extra windows or pasting a ton of extra stuff(no idea where it gets it from), or it simply does nothing, or in the case of ctrl+alt+2 it starts pasting a . instead of whatever I wrote…
The weird thing is it that stuff only happens while I have a shorcut defined for the command. If I leave the command there with no defined shorcut(or if I delete the command altogether) and then go back to the same places and use the shortcuts nothing happens(at least that I can tell), apart from Ctrl+2 selecting the second tab in brave.
And if there where conflicts because those shortcuts already had other actions defined like @ddnn seems to suggest(if I understood him correctly) shouldn’t they still do stuff when I remove my command?
So any suggestions how I could get this working properly? Cause it would be awesome…
Just a guess. Try to add some delay before the xdotool command.
As Shift, Ctrl and Alt you are holding influence xdotool type command as well. sleep 1; xdotool type "whatever"
Also for the key selection it is probably better to use meta key (or is it called windows key?) since almost no application have that key mapped for any function.
Guess we’ll find out @xircon , adding that sleep part to the command like @vlkon suggested and changing the shorcut to Ctrl+Meta+2(just Meta+2 conflicts with some plasmashell thing) seems to work fine for the moment.
I’m gonna use it for a couple of days and if no issues pop up I’ll come back and update the thread with solution tags and stuff.
Played around with it these past couple of days and throught the Ctrl+Meta+2 command I added initially to insert my email worked fine. However at one point I figured hey if this works it would be nice to have a couple more, maybe a second email, etc.
So I tried to add another command with Ctrl+Meta+1 and Ctrl+Meta+3 and both of them displayed that weird behavior again, however if I set the second command to Ctrl+Meta+z it works too. So now I have 2 commands that work, yaay.
I suppose @xircon and @eso do have a point given all this instability so for those that want more options/a smoother experience maybe check out their advice/posts.
But for me and for now this is enough and pretty much just what I was looking for, so I am gonna copy&paste @ddnn and @vlkon 's posts and mark that as the solution, no offence to anyone, I do appreciate all of your help/advice.