elementary / applications-menu

Applications Menu for elementary OS and the Pantheon desktop environment
https://elementary.io
GNU General Public License v3.0
104 stars 35 forks source link

Include timestamp with app launch contexts #548

Closed Antolius closed 1 year ago

Antolius commented 1 year ago

Problem

When launching applications and actions we should provide the timestamp of the triggering event (e.g. menu item click). According to the documentation of Gdk.AppLaunchContext.set_timestamp method:

Window managers can use this information to avoid moving the focus to the newly launched application when the user is busy typing in another window. This is also known as 'focus stealing prevention'.

Proposal

As suggested by @Marukesu we can achieve this by using the Gdk.AppLaunchContext, instead of the GLib.AppLaunchContext. The Gdk implementation extends the GLib one and provides a setter for the timestamp.

Prior Art (Optional)

Dock will be doing this after this pull request is merged.

Budgie desktop also does it, for example here. Other DEs probably do it too, it was just easy for me to find example in Budgie's code since it's written in Vala too.