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.
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.
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:Proposal
As suggested by @Marukesu we can achieve this by using the
Gdk.AppLaunchContext
, instead of theGLib.AppLaunchContext
. TheGdk
implementation extends theGLib
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.