3

Please, i need someone to help me in making a very simple bash script. The job of this script is just to press a certain combination of keys on the keyboard.

My objective is to create a script that would turn off the Kubuntu desktop effects completely. The key combination for that is: "Left-ALT + Left-Shift + F12". I am aware that there is a widget that might do this job, but i am trying to learn how to accomplish it with a bash script.

I have tried to do an online search but i guess i was choosing the wrong set of keywords. I did not manage to reach a tutorial or a reference that would mention this task.

Thanks in advance for your help!

P.S: Any suggestions, references, notes, comments or tutorials would also be greatly be appreciated.

  • 1
    Look up xdotool. – muru Apr 11 '16 at 5:44
  • Thank you very much for teaching me how to do that. It is working perfectly! Please add it as an answer @muru in order to accept it. The code is: xdotool key alt+shift+F12 – Ken Apr 11 '16 at 6:09
  • I didn't teach you anything, I just provided a pointer. Good answer, that. – muru Apr 11 '16 at 11:40
5

For those who wants to accomplish this task, please follow the steps below:

Create an empty file and write the following simple bash script inside:

#!/bin/bash
xdotool key alt+shift+F12

Save the file as ".sh" and make it executable.

You can add any set of keys and this tool can also allow you to automate the mouse. You can create very useful scripts with it if used properly.

Happy coding!


Credits: Special thanks to @muru for teaching me how to write this script.


Tutorial: http://manpages.ubuntu.com/manpages/trusty/en/man1/xdotool.1.html

  • Pertaining to the question asked, irrespective of the details provided (disabling desktop effects): What if you're running a headless system with no X11? xdotool will not work. – Andy Forceno Nov 25 '19 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.