Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 961  / 1 Year ago, fri, february 10, 2023, 9:13:22

It is possible to bind custom key for switch to specific application?



For example:

super+1 switches to the chrome window (not a first in windows list).

super+2 switches to the nautilus window



Or at least:

super+1 switches to first window

super+2 switches to second window


More From » unity

 Answers
1

This would take a bit of work but you could do this with scripts and keybindings.



There is a tool called xdotool and it lets you simulate keyboard presses. You can bind your keyboard keys to run scripts that utilize this tool.



Using whatever language you prefer to pipe terminal commands, you can find specific process IDs with
ps aux | grep "process here"



Using xdotool search --pid "process ID here" you will get back multiple window IDs for a single application. I don't know how to sort through them to find the correct one, so what you could do is have your script, iterate thought the found IDs into



xdotool windowactivate "window ID here" which will bring up your window.



For example, my 1 key will be binded to run a script that find the process ID for "filezilla". Then it will find the window IDs with xdotool, take those IDs and then pass them through xdotool to pull up the window. The 2 key, could be "google-chrome"


[#26776] Saturday, February 11, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leddre

Total Points: 180
Total Questions: 113
Total Answers: 108

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
;