19
19
const Me = ExtensionUtils.getCurrentExtension();
20
20
const Convenience = Me.imports.convenience;
22
const SETTINGS_BEHAVIOUR_KEY = 'behaviour';
23
const SETTINGS_HIGHLIGHT_KEY = 'highlight-selected';
24
const SETTINGS_SHOW_APP_ICON_KEY = 'show-app-icon';
22
const SETTINGS_APP_ICON_MODE = 'app-icon-mode';
23
const SETTINGS_CURRENT_WORKSPACE_ONLY = 'current-workspace-only';
28
name: N_("All & Thumbnails"),
29
description: N_("This mode presents all applications from all workspaces in one selection \
30
list. Instead of using the application icon of every window, it uses small \
31
thumbnails resembling the window itself."),
33
{ label: N_("Show overlaid application icon"), key: SETTINGS_SHOW_APP_ICON_KEY }
37
name: N_("Workspace & Icons"),
38
description: N_("This mode lets you switch between the applications of your current \
39
workspace and gives you additionally the option to switch to the last used \
40
application of your previous workspace. This is always the last symbol in \
41
the list and is separated by a separator/vertical line if available. \n\
42
Every window is represented by its application icon."),
44
{ label: N_("Move current selection to front before closing the popup"), key: SETTINGS_HIGHLIGHT_KEY }
26
thumbnail_only: N_("Thumbnail only"),
27
app_icon_only: N_("Application icon only"),
28
both: N_("Thumbnail and application icon"),
49
31
const AltTabSettingsWidget = new GObject.Class({
54
36
_init : function(params) {
55
37
this.parent(params);
56
this.column_spacing = 10;
39
this.orientation = Gtk.Orientation.VERTICAL;
59
41
this._settings = Convenience.getSettings();
61
let introLabel = _("The Alternate Tab can be used in different modes, that \
62
affect the way windows are chosen and presented.");
64
this.attach(new Gtk.Label({ label: introLabel, wrap: true, sensitive: true,
65
margin_bottom: 10, margin_top: 5 }),
43
let presentLabel = _("Present windows as");
44
this.add(new Gtk.Label({ label: presentLabel, sensitive: true,
45
margin_bottom: 10, margin_top: 5 }));
70
let currentMode = this._settings.get_string(SETTINGS_BEHAVIOUR_KEY);
49
let currentMode = this._settings.get_string(SETTINGS_APP_ICON_MODE);
71
50
for (let mode in MODES) {
72
51
// copy the mode variable because it has function scope, not block scope
73
52
// so cannot be used in a closure
74
53
let modeCapture = mode;
75
let obj = MODES[mode];
76
let name = Gettext.gettext(obj.name);
77
let description = Gettext.gettext(obj.description);
78
let nextra = obj.extra_widgets.length;
54
let name = Gettext.gettext(MODES[mode]);
80
56
radio = new Gtk.RadioButton({ group: radio, label: name, valign: Gtk.Align.START });
81
57
radio.connect('toggled', Lang.bind(this, function(widget) {
83
this._settings.set_string(SETTINGS_BEHAVIOUR_KEY, modeCapture);
84
this._updateSensitivity(widget, widget.active);
59
this._settings.set_string(SETTINGS_APP_ICON_MODE, modeCapture);
86
this.attach(radio, 0, top, 1, nextra + 1);
88
let descriptionLabel = new Gtk.Label({ label: description, wrap: true, sensitive: true,
89
xalign: 0.0, justify: Gtk.Justification.FILL });
90
this.attach(descriptionLabel, 1, top, 1, 1);
93
for (let i = 0; i < nextra; i++) {
94
let key = obj.extra_widgets[i].key;
95
let label = Gettext.gettext(obj.extra_widgets[i].label);
97
let extra = new Gtk.CheckButton({ label: label });
98
this._settings.bind(key, extra, 'active', Gio.SettingsBindFlags.DEFAULT);
100
radio._extra.push(extra);
101
this.attach(extra, 1, top + i + 1, 1, 1);
104
63
if (mode == currentMode)
105
64
radio.active = true;
106
this._updateSensitivity(radio, radio.active);
112
_updateSensitivity: function(widget, active) {
113
for (let i = 0; i < widget._extra.length; i++)
114
widget._extra[i].sensitive = active;
68
let check = new Gtk.CheckButton({ label: _("Show only windows in the current workspace"),
70
this._settings.bind(SETTINGS_CURRENT_WORKSPACE_ONLY, check, 'active', Gio.SettingsBindFlags.DEFAULT);