Ubuntu – xdotool – how to select text using shift+Home or shift+End

keyboardshortcut-keysxdotool

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 to xdotool getactivewindow key Home and Super+right to xdotool 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 similarly Shift+Super+Right select to the end of the line. I tried mapping these combinations to xdotool using xdotool 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 the Home 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:

Runningsleep 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.

Best Answer

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.

Related Question