legacyTray: Add to ctrl-alt-tab

While legacy status icons are notoriously bad with regard to
accessibility (well, among many other things), we should still
make them available via ctrl-alt-tab ...

https://bugzilla.gnome.org/show_bug.cgi?id=746022
This commit is contained in:
Florian Müllner 2015-03-11 20:44:10 +01:00
parent cb3d5c2b51
commit 775a2ea051
2 changed files with 15 additions and 1 deletions

View File

@ -3,6 +3,7 @@ const GObject = imports.gi.GObject;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
const St = imports.gi.St; const St = imports.gi.St;
const CtrlAltTab = imports.ui.ctrlAltTab;
const Lang = imports.lang; const Lang = imports.lang;
const Layout = imports.ui.layout; const Layout = imports.ui.layout;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -53,7 +54,10 @@ const LegacyTray = new Lang.Class({
this._box = new St.BoxLayout(); this._box = new St.BoxLayout();
this._slider.add_actor(this._box); this._slider.add_actor(this._box);
this._concealHandle = new St.Button({ style_class: 'legacy-tray-handle' }); this._concealHandle = new St.Button({ style_class: 'legacy-tray-handle',
/* translators: 'Hide' is a verb */
accessible_name: _("Hide tray"),
can_focus: true });
this._concealHandle.child = new St.Icon({ icon_name: 'go-previous-symbolic' }); this._concealHandle.child = new St.Icon({ icon_name: 'go-previous-symbolic' });
this._box.add_child(this._concealHandle); this._box.add_child(this._concealHandle);
@ -83,6 +87,9 @@ const LegacyTray = new Lang.Class({
Main.layoutManager.addChrome(this.actor, { affectsInputRegion: false }); Main.layoutManager.addChrome(this.actor, { affectsInputRegion: false });
Main.layoutManager.trackChrome(this._slider, { affectsInputRegion: true }); Main.layoutManager.trackChrome(this._slider, { affectsInputRegion: true });
Main.ctrlAltTabManager.addGroup(this.actor,
_("Status Icons"), 'focus-legacy-systray-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.BOTTOM });
this._trayManager = new Shell.TrayManager(); this._trayManager = new Shell.TrayManager();
this._trayIconAddedId = this._trayManager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded)); this._trayIconAddedId = this._trayManager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
@ -121,14 +128,20 @@ const LegacyTray = new Lang.Class({
return; return;
let button = new St.Button({ child: icon, let button = new St.Button({ child: icon,
style_class: 'legacy-tray-icon',
button_mask: St.ButtonMask.ONE | button_mask: St.ButtonMask.ONE |
St.ButtonMask.TWO | St.ButtonMask.TWO |
St.ButtonMask.THREE, St.ButtonMask.THREE,
can_focus: true,
x_fill: true, y_fill: true }); x_fill: true, y_fill: true });
button.connect('clicked', button.connect('clicked',
function() { function() {
icon.click(Clutter.get_current_event()); icon.click(Clutter.get_current_event());
}); });
button.connect('key-focus-in', Lang.bind(this,
function() {
this._concealHandle.show();
}));
this._iconBox.add_actor(button); this._iconBox.add_actor(button);
this._sync(); this._sync();

View File

@ -30,6 +30,7 @@ js/ui/endSessionDialog.js
js/ui/extensionDownloader.js js/ui/extensionDownloader.js
js/ui/extensionSystem.js js/ui/extensionSystem.js
js/ui/keyboard.js js/ui/keyboard.js
js/ui/legacyTray.js
js/ui/lookingGlass.js js/ui/lookingGlass.js
js/ui/main.js js/ui/main.js
js/ui/messageTray.js js/ui/messageTray.js