That's an interesting request, and we'll have to divide it to two different requests:
- Create a custom keyboard shortcut that executes a command in Ubuntu:
If you're not familiar with this feature, this Ubuntu documentation will make it easy for you.
- Create a desktop environment mouse action automation (essentially control your mouse actions using commands).
This can be done using the xdotool
, which needs to be installed first, using the:
sudo apt-get install -y xdotool
command.
Using xdotool to move your mouse position to a specific location on screen:
Sending the xdotool
a mousemove
command argument, followed by our desired location will cause the mouse position to move onto that point on screen:
xdotool mousemove X Y
Where X
is your horizontal position, and Y
is your vertical position - the trick is to find where your notification appears, and choose a location that is inside the notification popup. (usually, 1000
70
is the default location, depending on your resolution and system settings).
How may I determine exactly where my notification appears?
You may use the notify-send
command to invoke a notification!
The first argument would be the title, while the second argument is the body:
notify-send "my_title" "my_message"
Once the notification is gone, place a file or a folder in the middle of where it was, and start experimenting the xdotool
command.
Whenever you've pointed over that file it would be highlighted, just as if you were hovering your mouse over files manually!
Final step - imitating a mouse hover on the notification so it expands:
If you've reached this part, you've probably noticed that the notification did not expand - that is because we also need to move our mouse a little on top of it to imitate a user's behavior of expanding it.
The solution? just use another xdotool mousemove
command right after the first one was executed within the range of your notification pop up, for example:
xdotool mousemove 1000 70 && xdotool mousemove 900 70
If you see the result suites you, copy the working command and create a keyboard shortcut just as described in the link at the top of this answer.
Enjoy you new tweak!