Question

first time question, but have gotten plenty of answers from your site so thanks peeps.

I want to add a .desktop file to the unity launcher that will open a new tab in chrome and auto press the ctrl+shift+. buttons so that it automatically opens a voice search.

I am brand new to bash scripting and for the life of me can't figure out the syntax, this is where I've gotten.

I've made a .desktop icon that runs a bash script, this is the .desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Google
Exec= '/bin/run-google.sh'
Icon=google_voice
StartupWMClass=www.google.co.uk__webhp

and it runs this bash script

#!/bin/bash
#opens voice search
sudo 
google-chrome "https://www.google.co.uk"

all is well and good so far, for the next step I have downloaded xdotool and I want it to press the ctrl+shift+period buttons in order to bring up the voice search thingy. I have tried

xdotool key ctrl+shift+period

in the bash script but this doesn't work.

any help is massively appreciated!

Was it helpful?

Solution

I managed to figure this out almost imediately, I feel silly!

in the bash script I put

xdotool keydown ctrl+shift+period

sleep 3

xdotool keyup ctrl+shift+period

Thats my first useful bit of bash, I feel proud of myself and I managed to figure it out all by myself!! ;-) love it when a plan comes together!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top