Reputation: 31
I have created and script that uses xdotool to open new tabs in specific firefox containers. I need to map three keys, for instance ctrl+y+p to open a personal container, ctrl+y+b to open the banking container and so on. I cannot find a tool that lets you map more than two keys.
Is there something like what I have described?
Thanks a lot.
Edit: For anyone looking for an answer, I found a way. I use i3 so I just added a mode triggered by pressing the first two keys and then mapped the "b" to the command + escape (to exit the mode).
Upvotes: 3
Views: 3316
Reputation: 370
Install xdotool if you haven't already done so, for example:
sudo apt-get install xdotool
As per your example (CTRL+y+p), execute:
DISPLAY=:0 xdotool keydown ctrl keydown y keydown p
Which presses the three keys but does not release them after. An alternative way:
DISPLAY=:0 xdotool key ctrl+y+p
:0 is a typical value for the display, but in my Raspberry Pi, for example, it needed to be DISPLAY=:10. If you are still having trouble with the display variable and get a message like this:
xdotool can't open display (null)
then you could obtain the display value with:
ps -u $(id -u) -o pid= | \
while read pid; do
cat /proc/$pid/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=:'
done | grep -o ':[0-9]*' | sort -u
Another alternative way to obtain DISPLAY values (it will be the number after the ':' )
xauth list
This works in raspbian too:
w -hs | awk '{print $3}' | sort -u | grep -v -
Good luck
Upvotes: 2