Open ces42 opened 1 year ago
Can you do it with the following?
[alt]
a = macro(esc 100ms C-v)
@tkna91 I'm confused. The example you provide will paste the clipboard (in most applications), same as
[alt]
a = C-v
(this will generate a alt up event before sending the control down event and re-press alt at the end of the macro).
What I'm looking for is a way to use keyd to produce control+v
from a script, regardless of what other modifiers are pressed.
Sorry if my guess is off. Are you saying that you want a mode that combines the current 1 and 2 operations below, which would be 3?
keyd virtual keyboard 0fac:0ade leftalt down
keyd virtual keyboard 0fac:0ade leftcontrol down
keyd virtual keyboard 0fac:0ade leftalt up
keyd virtual keyboard 0fac:0ade leftcontrol up
keyd virtual keyboard 0fac:0ade leftalt down
keyd virtual keyboard 0fac:0ade leftalt up
keyd do "C-v"
.
keyd virtual keyboard 0fac:0ade leftcontrol down
keyd virtual keyboard 0fac:0ade v down
keyd virtual keyboard 0fac:0ade v up
keyd virtual keyboard 0fac:0ade leftcontrol up
keyd do "C-v"
is executed (merge 1 and 2)
keyd virtual keyboard 0fac:0ade leftalt down
keyd virtual keyboard 0fac:0ade leftcontrol down
keyd virtual keyboard 0fac:0ade leftalt up
keyd virtual keyboard 0fac:0ade leftcontrol up
keyd virtual keyboard 0fac:0ade leftcontrol down
keyd virtual keyboard 0fac:0ade v down
keyd virtual keyboard 0fac:0ade v up
keyd virtual keyboard 0fac:0ade leftcontrol up
I think the way that keyd do
currently works is good and shouldn't be changed. I proposing a variant, say keyd nomoddo
, that would behave as follows: If keyd nomoddo C-v
is called when no modifiers are currently active then you would get
keyd virtual keyboard 0fac:0ade leftcontrol down
keyd virtual keyboard 0fac:0ade v down
keyd virtual keyboard 0fac:0ade v up
keyd virtual keyboard 0fac:0ade leftcontrol up
same as keyd do C-v
. However if you do keyd nomoddo C-v
while the alt layer is active (most likely because the alt key is physically being pressed) you would get
keyd virtual keyboard 0fac:0ade leftalt up
keyd virtual keyboard 0fac:0ade leftcontrol down
keyd virtual keyboard 0fac:0ade v down
keyd virtual keyboard 0fac:0ade v up
keyd virtual keyboard 0fac:0ade leftcontrol up
keyd virtual keyboard 0fac:0ade leftalt down
The problem with this proposal is that the behaviour would depend on whether or not the keyboard is currently managed by keyd. keyd can't release keys on keyboards that it hasn't grabbed, so the script would not be portable.
For this particular application you should be able to use something like xclip -o
, since most applications will automatically set the selection when you highlight text.
@ces42 Something like this might be an alternative for now.
[alt]
a = macro(500ms C-v)
#!/bin/bash
FILE=/tmp/file
date > $FILE
#X11
xclip < $FILE
#Wayland
#wl-copy < $FILE
sleep 0.5
keyd do C-v
Would it be possible to add a feature that is analogous do
keyd do
but ignores any active modifiers? What I mean is to add a function, say "nomoddo
" so that if I'm (physically) holdingalt
and then the commandkeyd nomoddo C-v
is runkeyd
will liftalt
, pressctrl
, tapv
, liftctrl
and then pressalt
again, same as when I have a binding likeUse case Many use cases for key remapping involve entering large amounts of text into programs (e.g. predetermined phrases, things like the current date+time, or scripts that copy the current mouse selection, modify it in some way and insert it back). The only easy way to do this seems to be to use the clipboard. The only (somewhat) reliable way to paste from the clipboard is to send
ctrl+v
orshift+insert
to the program, which can be easily done withkeyd do C-v
. Now the problem is that if I bind this action to something likealt+a
thenalt
will still be pressed when the action triggers and nothing gets pasted.