search: copy result to clipboard if requested
Some search providers such as GNOME Characters want to copy search results to clipboard. However, on Wayland, clipboards are only accessible from applications that have a visible surface on display. This patch allows a search provider to request the shell to copy a search result to clipboard when 'clipboardText' is included in the meta of the result. https://bugzilla.gnome.org/show_bug.cgi?id=775099
This commit is contained in:
parent
73680e2433
commit
0142fae742
@ -278,7 +278,8 @@ const RemoteSearchProvider = new Lang.Class({
|
||||
name: metas[i]['name'],
|
||||
description: metas[i]['description'],
|
||||
createIcon: Lang.bind(this,
|
||||
this.createIcon, metas[i]) });
|
||||
this.createIcon, metas[i]),
|
||||
clipboardText: metas[i]['clipboardText'] });
|
||||
}
|
||||
callback(resultMetas);
|
||||
},
|
||||
|
@ -152,6 +152,8 @@ const SearchResultsBase = new Lang.Class({
|
||||
|
||||
this._resultDisplays = {};
|
||||
|
||||
this._clipboard = St.Clipboard.get_default();
|
||||
|
||||
this._cancellable = new Gio.Cancellable();
|
||||
},
|
||||
|
||||
@ -181,6 +183,8 @@ const SearchResultsBase = new Lang.Class({
|
||||
|
||||
_activateResult: function(result, id) {
|
||||
this.provider.activateResult(id, this._terms);
|
||||
if (result.metaInfo.clipboardText)
|
||||
this._clipboard.set_text(St.ClipboardType.CLIPBOARD, result.metaInfo.clipboardText);
|
||||
Main.overview.toggle();
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user