xdotool - how do I select text using shift+Home or shift+End?
Solution 1
Try the following:
xdotool keyup Shift+Super+Left key shift+Home
The keyup statement will release the hotkey you are pressing before simulating pressing the key combination shift+Home.
Solution 2
In order to bind Shift+Home/End together with xdotool, please use:
xdotool key --window '$(xdotool getactivewindow)' Shift+Home
xdotool key --window '$(xdotool getactivewindow)' Shift+End
Then, you can customize your shortcut by Shift+Alt+Right Arrow
and Shift+Alt+Left Arrow
.
Related videos on Youtube
greenerr
Updated on September 18, 2022Comments
-
greenerr over 1 year
I'm trying to get text selection working the way I want on my laptop using Ubuntu 16.04. I don't have home/end keys on my laptop, so I installed xdotool and using the keyboard settings I mapped
Super+left
toxdotool getactivewindow key Home
andSuper+right
toxdotool getactivewindow key End
.This is working as expected. However, I'd also like to have
Shift+Super+Left
select text from my cursor to the beginning of the line, and similarlyShift+Super+Right
select to the end of the line. I tried mapping these combinations to xdotool usingxdotool getactivewindow key shift+Home
but this doesn't seem to work.I've also tried running
sleep 4 && xdotool key shift+Home
in a terminal and then switching to my text editor, and it seems like only theHome
key is firing - no text is selected. So it seems like a xdotool problem and not my keyboard. Does anyone know the proper key combination for xdotool to select text to the beginning/end of a line?Update:
Running
sleep 4 && xdotool key Shift+Home
with a capital S for shift works. Text is highlighted in my text editor from my cursor to the beginning of the line. However, it's still not working as a shortcut even with a capital S. So now I'm thinking there is something else wrong with the way I'm inputting the xdotool command into Ubuntu's keyboard settings.-
Jacob Vlijm over 7 yearsIf I understand correctly, you want to select the line? Is a triple-click an option?
-
Arijit Chatterjee over 7 yearsHere goes a resource for you cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
-
wjandrea over 7 yearsIn my experience, Xdotool is not good for complex keyboard shortcuts.
-
greenerr over 7 years@wjandrea are there better options for what I'm trying to do?
-
greenerr over 7 years@wjandrea nevermind, I installed Autokey and managed to get it working using that.
-
-
dgonzalez over 7 years+1 to autokey, maybe not the best/exact answer to original question... but i can't live without it!
-
Mateen Ulhaq over 2 yearsAlso:
xdotool getactivewindow key Shift+Home