Commit d731534d authored by Florian Müllner's avatar Florian Müllner

extensions: Remove alternate-tab

Ever since GNOME 3.8 when gnome-shell started to provide the window
switcher functionality itself, the extension has only existed to
change the default behavior of the alt-tab shortcut in the classic
session. Now that we achieve this behavior with a per-desktop override,
there's no longer a need for the extension, so remove it altogether.

Users who prefer the window switcher over the default app switcher
can use the regular keyboard settings to assign a shortcut to the
"Switch windows" action.

https://bugzilla.gnome.org/show_bug.cgi?id=786496
parent 94eba473
......@@ -15,10 +15,6 @@ Bugs should be reported to the GNOME [bug tracking system][bug-tracker].
## Extensions
* alternate-tab
Lets you use classic Alt+Tab (window-based instead of app-based) in GNOME Shell.
* apps-menu
Lets you reach an application using gnome 2.x style menu on the panel.
......
/* -*- mode: js; js-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const AltTab = imports.ui.altTab;
const Main = imports.ui.main;
const WindowManager = imports.ui.windowManager;
let injections = {};
function init(metadata) {
}
function setKeybinding(name, func) {
Main.wm.setCustomKeybindingHandler(name, Shell.ActionMode.NORMAL, func);
}
function enable() {
injections['_keyPressHandler'] = AltTab.WindowSwitcherPopup.prototype._keyPressHandler;
AltTab.WindowSwitcherPopup.prototype._keyPressHandler = function(keysym, action) {
switch(action) {
case Meta.KeyBindingAction.SWITCH_APPLICATIONS:
action = Meta.KeyBindingAction.SWITCH_WINDOWS;
break;
case Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD:
action = Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD;
break;
}
return injections['_keyPressHandler'].call(this, keysym, action);
};
Main.wm._forcedWindowSwitcher = function(display, window, binding) {
/* prevent a corner case where both popups show up at once */
if (this._workspaceSwitcherPopup != null)
this._workspaceSwitcherPopup.destroy();
let tabPopup = new AltTab.WindowSwitcherPopup();
if (!tabPopup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
tabPopup.destroy();
};
setKeybinding('switch-applications',
Main.wm._forcedWindowSwitcher.bind(Main.wm));
setKeybinding('switch-applications-backward',
Main.wm._forcedWindowSwitcher.bind(Main.wm));
}
function disable() {
var prop;
setKeybinding('switch-applications',
Main.wm._startSwitcher.bind(Main.wm));
setKeybinding('switch-applications-backward',
Main.wm._startSwitcher.bind(Main.wm));
for (prop in injections)
AltTab.WindowSwitcherPopup.prototype[prop] = injections[prop];
delete Main.wm._forcedWindowSwitcher;
}
{
"extension-id": "@extension_id@",
"uuid": "@uuid@",
"settings-schema": "@gschemaname@",
"gettext-domain": "@gettext_domain@",
"name": "AlternateTab",
"description": "Substitute Alt-Tab with a window based switcher that does not group by application.\nThis extension is part of Classic Mode and is officially supported by GNOME. Please do not report bugs using the form below, use GNOME's GitLab instance instead.",
"original-authors": [ "jw@bargsten.org", "thomas.bouffon@gmail.com" ],
"shell-version": [ "@shell_current@" ],
"url": "@url@"
}
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const GObject = imports.gi.GObject;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
const N_ = e => e;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
const SETTINGS_APP_ICON_MODE = 'app-icon-mode';
const SETTINGS_CURRENT_WORKSPACE_ONLY = 'current-workspace-only';
const MODES = {
'thumbnail-only': N_("Thumbnail only"),
'app-icon-only': N_("Application icon only"),
'both': N_("Thumbnail and application icon"),
};
const AltTabSettingsWidget = GObject.registerClass(
class AltTabSettingsWidget extends Gtk.Grid {
_init(params) {
super._init(params);
this.margin = 24;
this.row_spacing = 6;
this.orientation = Gtk.Orientation.VERTICAL;
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
let presentLabel = '<b>' + _("Present windows as") + '</b>';
this.add(new Gtk.Label({ label: presentLabel, use_markup: true,
halign: Gtk.Align.START }));
let align = new Gtk.Alignment({ left_padding: 12 });
this.add(align);
let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
row_spacing: 6,
column_spacing: 6 });
align.add(grid);
let radio = null;
let currentMode = this._settings.get_string(SETTINGS_APP_ICON_MODE);
for (let mode in MODES) {
// copy the mode variable because it has function scope, not block scope
// so cannot be used in a closure
let modeCapture = mode;
let name = Gettext.gettext(MODES[mode]);
radio = new Gtk.RadioButton({ group: radio, label: name, valign: Gtk.Align.START });
radio.connect('toggled', widget => {
if (widget.active)
this._settings.set_string(SETTINGS_APP_ICON_MODE, modeCapture);
});
grid.add(radio);
if (mode == currentMode)
radio.active = true;
}
let check = new Gtk.CheckButton({ label: _("Show only windows in the current workspace"),
margin_top: 6 });
this._settings.bind(SETTINGS_CURRENT_WORKSPACE_ONLY, check, 'active', Gio.SettingsBindFlags.DEFAULT);
this.add(check);
}
});
function init() {
Convenience.initTranslations();
}
function buildPrefsWidget() {
let widget = new AltTabSettingsWidget();
widget.show_all();
return widget;
}
/* This extensions requires no special styling */
......@@ -42,7 +42,6 @@ classic_extensions = [
default_extensions = classic_extensions
default_extensions += [
'alternate-tab',
'drive-menu',
'screenshot-window-sizer',
'windowsNavigator',
......
data/gnome-classic.desktop.in
data/gnome-classic.session.desktop.in
extensions/alternate-tab/prefs.js
extensions/apps-menu/extension.js
extensions/auto-move-windows/extension.js
extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment