Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
11
votes
2
answers
10042
views
Keyboard emulation in Wayland
Is there a way to make `xdotool` or `xte` or any other alternative to work in Fedora 26? I'm trying to emulate keypresses (using xbindkeys), e.g. pressing `Alt+B` would emulate pressing `Ctrl+Shift+B`. But apparently neither `xdotool` nor `xte` work in Wayland (for security reasons [?]) Is there a w...
Is there a way to make
xdotool
or xte
or any other alternative to work in Fedora 26?
I'm trying to emulate keypresses (using xbindkeys), e.g. pressing Alt+B
would emulate pressing Ctrl+Shift+B
. But apparently neither xdotool
nor xte
work in Wayland (for security reasons [?])
Is there a workaround? Otherwise how do I rebind keys to other keys?
iLemming
(543 rep)
Jul 26, 2017, 06:19 AM
• Last activity: Mar 15, 2024, 03:27 PM
7
votes
2
answers
5293
views
How to remap keys only for a particular keyboard in Linux?
I have a numpad connected via USB and my goal is to be able to remap keys on that numpad so they can run custom commands or be mapped to other key combinations. I have this in my `.xbindkeysrc` file: ~ $ cat .xbindkeysrc "xte 'keydown Super_L' 'key Left' 'keyup Super_L'" m:0x10 + c:79 + Release Mod2...
I have a numpad connected via USB and my goal is to be able to remap keys on that numpad so they can run custom commands or be mapped to other key combinations.
I have this in my
.xbindkeysrc
file:
~ $ cat .xbindkeysrc
"xte 'keydown Super_L' 'key Left' 'keyup Super_L'"
m:0x10 + c:79 + Release
Mod2 + KP_Home
This remaps the NUM 7 key (which normally prints 7) to Super_L + Left Arrow
. That's great and it works, BUT FOR ALL KEYBOARDS, while my goal is to make it work only for the numpad.
Been searching how to do it, but the closest I got was to use xinput set-button-map
. Unfortunately, this seems to only work for devices like mouses. I like tried fetching what the button map is for the numpad with xinput get-button-map [device id]
but it just prints numbers from 1 to 7 and I definitely have more buttons on my keypad, so it doesn't necessarily make sense.
Any advice?
orion3
(211 rep)
Aug 16, 2019, 08:17 AM
• Last activity: Jul 25, 2021, 06:19 PM
1
votes
0
answers
481
views
xte bash command from xautomation not working on debian
I tried with multiple commands, from xte 'key a' to xte 'keydown Control_L" "key Tab" "keyup Control_L" for alt-tabbing, or xte 'mousemove 100 100' and nothing works; I just get a blank new line in bash.
I tried with multiple commands, from
xte 'key a'
to
xte 'keydown Control_L" "key Tab" "keyup Control_L"
for alt-tabbing, or
xte 'mousemove 100 100'
and nothing works; I just get a blank new line in bash.
Fedja Mladenovic
(47 rep)
Dec 28, 2019, 02:03 PM
• Last activity: Dec 28, 2019, 07:16 PM
2
votes
1
answers
877
views
How do I get xbindkeys to separate its modifiers from xte's?
When I do such as this in `.xbindkeysrc` "xte 'keydown Control_L' 'key W' 'keyup Control_L'" Shift + b:9 it performs the action of ctrl+shift+w instead of just the ctrl+w I expected. Any idea how to fix this? Adding `+ Release` to the second line doesn't help.
When I do such as this in
.xbindkeysrc
"xte 'keydown Control_L' 'key W' 'keyup Control_L'"
Shift + b:9
it performs the action of ctrl+shift+w instead of just the ctrl+w I expected. Any idea how to fix this? Adding + Release
to the second line doesn't help.
Brōtsyorfuzthrāx
(297 rep)
Feb 15, 2018, 07:51 AM
• Last activity: Feb 17, 2018, 11:23 AM
0
votes
1
answers
1562
views
How to close epiphany through a script with cron?
I have been making scripts to open and close a specific website with a cronjob on the raspberry Pi. The opening script works perfectly. It is as follows: #!/bin/bash export DISPLAY=:0 && epiphany-browser http://mywebsite sleep 30 xte "key F11" -x:0 xte "key F5" -x:0 But the one to close the browser...
I have been making scripts to open and close a specific website with a cronjob on the raspberry Pi. The opening script works perfectly. It is as follows:
#!/bin/bash
export DISPLAY=:0 && epiphany-browser http://mywebsite
sleep 30
xte "key F11" -x:0
xte "key F5" -x:0
But the one to close the browser doesn't work at all, and I can't figure out why. Is there something wrong with the script? I made it by looking at this SuperUser question .
#!/bin/bash
WID =
xdotool search "epiphany-browser" | head-1
xdotool windowactivate --sync $WID
xdotool key --clearmodifiers ctrl+q
Note: Couldn't get this code to work but the "killall" command works just fine.
angelfmf
(23 rep)
Jul 29, 2015, 11:21 AM
• Last activity: Jan 20, 2018, 05:49 PM
1
votes
1
answers
5934
views
Mapping mouse events to key presses using xbindkeys
I want to map various mouse actions to key presses using `xbindkeys`. All my attempts to do this in my `.xbindkeysrc` file have failed. Attempts have been made using `xte` and `xdotool`. Below is a summary of what has been tried - although I'd like to map several mouse actions so far I've just been...
I want to map various mouse actions to key presses using
xbindkeys
. All my attempts to do this in my .xbindkeysrc
file have failed. Attempts have been made using xte
and xdotool
. Below is a summary of what has been tried - although I'd like to map several mouse actions so far I've just been trying to initiate a right-button mouse click.
The following xdotool
and xte
commands work perfectly when called from a terminal, from the graphical pop-up Run Command
text-box, and from within a script called from the terminal and the Run Command
text-box. It is only when called using keys set in the .xbindkeysrc
file that they fail.
Entries from .xbindkeysrc:
"xdotool click 3"
control + 8
"xte 'mouseclick 3'"
control + 7
# -x :0 sets the display.
"xte -x :0 'mouseclick 3'"
control + 6
# Starting a text editor window works fine.
"leafpad"
control + 1
I also had no luck placing the same commands (one at a time) in a script and calling that in .xbindkeysrc
. I added a command at the bottom of the script to create a file - the file gets created every time so I know that the script is being run successfully.
"/full/path/to/mouse/button/script"
control + 5
Please note that there have been no silly mistakes like not restarting xbindkeys
after making alterations, I've been checking that it is running and added a command to .xbindkeysrc
which launches a text editor window so that I can be sure xbindkeys
is running properly.
System Info.
OS: GNU/Linux x86_64
Kernel: 3.13.0-24-generic
Distro: Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16
[Based On: Ubuntu 14.04.5 LTS, Trusty Tahr]
mattst
(525 rep)
Nov 15, 2017, 06:08 PM
• Last activity: Nov 16, 2017, 03:21 PM
4
votes
1
answers
1689
views
detect if key is pressed from script
I would like to detect if a key is being pressed when running a script. I have the following script: #!/bin/bash sleep 0.5 xte 'str sometext' I run this script using a shortcut to paste "sometext" where I'm at in kde. I used a sleep 0.5 here because the script itself is run with a shortcut that uses...
I would like to detect if a key is being pressed when running a script. I have the following script:
#!/bin/bash
sleep 0.5
xte 'str sometext'
I run this script using a shortcut to paste "sometext" where I'm at in kde. I used a sleep 0.5 here because the script itself is run with a shortcut that uses ctrl and alt. If the sleep 0.5 is omitted, the result is that ctrl+s, ctrl+o, etc... is sent. I think the solution would be to add some bussy wait at the beginning that would block untill no keys are being pressed. How can I get this to work in the script?
Silverrocker
(1865 rep)
Oct 11, 2012, 03:36 PM
• Last activity: Dec 9, 2016, 05:52 PM
2
votes
1
answers
1649
views
xte and keyboard mapping
I'm trying to fake `xinput` events with `xte`: xte "str $(echo ' ')" But, I get: WQBC@g;qil '"` `4WQBC@g;qil<co;X4`
I'm trying to fake
xinput
events with xte
:
xte "str $(echo '')"
But, I get:
WQBC@g;qil'"`
4WQBC@g;qil
daisy
(55777 rep)
May 25, 2012, 09:05 AM
• Last activity: Dec 17, 2014, 06:43 AM
Showing page 1 of 8 total questions