Sunday, April 28, 2024
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 6087  / 3 Years ago, sun, july 18, 2021, 9:06:01

I am looking to avoid ever typing in my email address again. Is there a way to configure a key to paste some pre-set bit of text like my email.



I'd like this to work across all applications ideally.



thanks


More From » shortcut-keys

 Answers
1

1) Install xclip and xdotool



sudo apt-get install xclip xdotool


2) Make a file myscript.sh



mkdir ~/bin
gedit ~/bin/myscript.sh


3) Copy paste this script into it



#!/bin/bash
TEXT="[email protected]"
printf '%s' "$TEXT" | xclip -i -selection clipboard
xdotool key --clearmodifiers "ctrl+v"


4) Make the file executable



chmod +x ~/bin/myscript.sh


5) Make a shortcut



Settings -> Keyboard -> Shortcuts -> Custom shortcuts -> click [+]




  • Name: anything, Command: /home/USERNAME/bin/myscript.sh


    • Replace the USERNAME with your username


  • Click on the Disabled text and then press your magical keystroke. For example Ctrl-Shift-S

  • You may have to restart unity with setsid unity or by logging in and out to make the shortcut work. (at least i had this bug on Ubuntu 13.10)



Troubleshooting



If you have any problems with pasting the text. Try changing xdotool key to xdotool sleep 0.5 key. It gives you time to take your hands off the keyboard before xdotool tries to press "Ctrl-V"


[#29971] Sunday, July 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
thellfi

Total Points: 222
Total Questions: 103
Total Answers: 123

Location: Palau
Member since Mon, Aug 16, 2021
3 Years ago
thellfi questions
;