Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6f4ed7013 | |||
| 9b6374881d | |||
| 2388b8738f | |||
| 775bd5a86a | |||
| 3630228cac | |||
| 7517d8ab6a | |||
| 9ebfd1f495 | |||
| dfca68062c |
@@ -1,3 +1,13 @@
|
|||||||
|
3.3.5
|
||||||
|
=====
|
||||||
|
* improvements to the build system and convenience module,
|
||||||
|
making it easier for other extensions to use, and bringing
|
||||||
|
it up to date with gnome-shell changes
|
||||||
|
* all extensions were ported to the Lang.Class framework
|
||||||
|
(except xrandr-indicator, which is pending GDBus merge)
|
||||||
|
* alternate-tab and dock were slightly refactored to clean up
|
||||||
|
some old code
|
||||||
|
|
||||||
3.3.4
|
3.3.4
|
||||||
=====
|
=====
|
||||||
* improved styling of windowsNavigator tooltips
|
* improved styling of windowsNavigator tooltips
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
AC_PREREQ(2.63)
|
AC_PREREQ(2.63)
|
||||||
AC_INIT([gnome-shell-extensions],[3.3.4],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&component=extensions])
|
AC_INIT([gnome-shell-extensions],[3.3.5],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&component=extensions])
|
||||||
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_AUX_DIR([config])
|
AC_CONFIG_AUX_DIR([config])
|
||||||
|
|||||||
+8
-3
@@ -1,13 +1,18 @@
|
|||||||
include $(top_srcdir)/include.mk
|
include $(top_srcdir)/include.mk
|
||||||
|
|
||||||
dist_extension_DATA = extension.js stylesheet.css
|
dist_extension_DATA = extension.js stylesheet.css $(EXTRA_MODULES)
|
||||||
nodist_extension_DATA = metadata.json $(top_srcdir)/lib/convenience.js $(EXTRA_EXTENSION)
|
nodist_extension_DATA = metadata.json $(top_srcdir)/lib/convenience.js $(EXTRA_EXTENSION)
|
||||||
|
|
||||||
EXTRA_DIST = metadata.json.in
|
EXTRA_DIST = metadata.json.in
|
||||||
|
|
||||||
metadata.json: metadata.json.in $(top_builddir)/config.status
|
metadata.json: metadata.json.in $(top_builddir)/config.status
|
||||||
$(AM_V_GEN) sed -e "s|[@]uuid@|$(uuid)|" \
|
$(AM_V_GEN) sed \
|
||||||
|
-e "s|[@]extension_id@|$(EXTENSION_ID)|" \
|
||||||
|
-e "s|[@]uuid@|$(uuid)|" \
|
||||||
|
-e "s|[@]gschemaname@|$(gschemaname)|" \
|
||||||
|
-e "s|[@]gettext_domain@|$(GETTEXT_PACKAGE)|" \
|
||||||
-e "s|[@]shell_current@|$(PACKAGE_VERSION)|" \
|
-e "s|[@]shell_current@|$(PACKAGE_VERSION)|" \
|
||||||
-e "s|[@]url@|$(extensionurl)|" $< > $@
|
-e "s|[@]url@|$(extensionurl)|" \
|
||||||
|
$< > $@
|
||||||
|
|
||||||
CLEANFILES = metadata.json
|
CLEANFILES = metadata.json
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
EXTENSION_ID = alternate-tab
|
EXTENSION_ID = alternate-tab
|
||||||
|
|
||||||
|
EXTRA_MODULES = settings.js
|
||||||
|
|
||||||
include ../../extension.mk
|
include ../../extension.mk
|
||||||
|
include ../../settings.mk
|
||||||
gschemas_in = $(gschemabase).alternate-tab.gschema.xml.in
|
|
||||||
|
|
||||||
@INTLTOOL_XML_NOMERGE_RULE@
|
|
||||||
|
|
||||||
gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
|
|
||||||
|
|
||||||
@GSETTINGS_RULES@
|
|
||||||
|
|
||||||
CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
|
|
||||||
EXTRA_DIST += $(gschemas_in)
|
|
||||||
|
|||||||
@@ -25,57 +25,21 @@ const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
const N_ = function(e) { return e };
|
const N_ = function(e) { return e };
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
const Settings = Me.imports.settings;
|
||||||
|
|
||||||
let settings;
|
let settings;
|
||||||
|
|
||||||
const POPUP_DELAY_TIMEOUT = 150; // milliseconds
|
const POPUP_DELAY_TIMEOUT = 150; // milliseconds
|
||||||
|
|
||||||
const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.alternate-tab';
|
|
||||||
const SETTINGS_BEHAVIOUR_KEY = 'behaviour';
|
const SETTINGS_BEHAVIOUR_KEY = 'behaviour';
|
||||||
const SETTINGS_FIRST_TIME_KEY = 'first-time';
|
const SETTINGS_FIRST_TIME_KEY = 'first-time';
|
||||||
|
|
||||||
const MODES = {
|
const AltTabPopupWorkspaceIcons = new Lang.Class({
|
||||||
all_thumbnails: function(display, binding, mask, window, backwards) {
|
Name: 'AlternateTab.AltTabPopupWorkspaceIcons',
|
||||||
let tabPopup = new AltTabPopup2();
|
Extends: AltTab.AltTabPopup,
|
||||||
|
|
||||||
if (!tabPopup.show(backwards, binding, mask))
|
|
||||||
tabPopup.destroy();
|
|
||||||
},
|
|
||||||
|
|
||||||
workspace_icons: function(display, binding, mask, window, backwards) {
|
|
||||||
if (Main.wm._workspaceSwitcherPopup)
|
|
||||||
Main.wm._workspaceSwitcherPopup.actor.hide();
|
|
||||||
|
|
||||||
let tabPopup = new AltTabPopupW();
|
|
||||||
if (!tabPopup.show(backwards, binding, mask))
|
|
||||||
tabPopup.destroy();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const MESSAGE = N_("This is the first time you use the Alternate Tab extension. \n\
|
|
||||||
Please choose your preferred behaviour:\n\
|
|
||||||
\n\
|
|
||||||
All & Thumbnails:\n\
|
|
||||||
This mode presents all applications from all workspaces in one selection \n\
|
|
||||||
list. Instead of using the application icon of every window, it uses small \n\
|
|
||||||
thumbnails resembling the window itself. \n\
|
|
||||||
\n\
|
|
||||||
Workspace & Icons:\n\
|
|
||||||
This mode let's you switch between the applications of your current \n\
|
|
||||||
workspace and gives you additionally the option to switch to the last used \n\
|
|
||||||
application of your previous workspace. This is always the last symbol in \n\
|
|
||||||
the list and is segregated by a separator/vertical line if available. \n\
|
|
||||||
Every window is represented by its application icon. \n\
|
|
||||||
\n\
|
|
||||||
If you whish to revert to the default behavior for the Alt-Tab switcher, just\n\
|
|
||||||
disable the extension from extensions.gnome.org or the Advanced Settings application.\
|
|
||||||
");
|
|
||||||
|
|
||||||
function AltTabPopupW() {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
AltTabPopupW.prototype = {
|
|
||||||
__proto__ : AltTab.AltTabPopup.prototype,
|
|
||||||
|
|
||||||
_windowActivated : function(thumbnailList, n) { },
|
_windowActivated : function(thumbnailList, n) { },
|
||||||
|
|
||||||
@@ -165,14 +129,11 @@ AltTabPopupW.prototype = {
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
});
|
||||||
|
|
||||||
function AppIcon(app, window) {
|
const AppIcon = new Lang.Class({
|
||||||
this._init(app, window);
|
Name: 'AlternateTab.AppIcon',
|
||||||
}
|
Extends: AltTab.AppIcon,
|
||||||
|
|
||||||
AppIcon.prototype = {
|
|
||||||
__proto__ : AltTab.AppIcon.prototype,
|
|
||||||
|
|
||||||
_init: function(app, window) {
|
_init: function(app, window) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
@@ -199,16 +160,16 @@ AppIcon.prototype = {
|
|||||||
this.actor.add(this.label, { x_fill: false });
|
this.actor.add(this.label, { x_fill: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function WindowSwitcher(apps, altTabPopup) {
|
const WindowSwitcher = new Lang.Class({
|
||||||
this._init(apps, altTabPopup);
|
Name: 'AlternateTab.WindowSwitcher',
|
||||||
}
|
Extends: AltTab.AppSwitcher,
|
||||||
|
|
||||||
WindowSwitcher.prototype = {
|
|
||||||
__proto__ : AltTab.AppSwitcher.prototype,
|
|
||||||
|
|
||||||
_init : function(apps, altTabPopup) {
|
_init : function(apps, altTabPopup) {
|
||||||
|
// Horrible HACK!
|
||||||
|
// We inherit from AltTab.AppSwitcher, but only chain up to
|
||||||
|
// AltTab.SwitcherList._init, to bypass AltTab.AppSwitcher._init
|
||||||
AltTab.SwitcherList.prototype._init.call(this, true);
|
AltTab.SwitcherList.prototype._init.call(this, true);
|
||||||
|
|
||||||
// Construct the AppIcons, sort by time, add to the popup
|
// Construct the AppIcons, sort by time, add to the popup
|
||||||
@@ -268,81 +229,11 @@ WindowSwitcher.prototype = {
|
|||||||
if (t2 > t1) return 1;
|
if (t2 > t1) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function AltTabSettingsDialog() {
|
const AltTabPopupAllThumbnails = new Lang.Class({
|
||||||
this._init();
|
Name: 'AlternateTab.AltTabPopup.AllThumbnails',
|
||||||
}
|
Extends: AltTab.AltTabPopup,
|
||||||
|
|
||||||
AltTabSettingsDialog.prototype = {
|
|
||||||
__proto__: ModalDialog.ModalDialog.prototype,
|
|
||||||
|
|
||||||
_init : function() {
|
|
||||||
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: null });
|
|
||||||
|
|
||||||
let mainContentBox = new St.BoxLayout({ style_class: 'polkit-dialog-main-layout',
|
|
||||||
vertical: false });
|
|
||||||
this.contentLayout.add(mainContentBox,
|
|
||||||
{ x_fill: true,
|
|
||||||
y_fill: true });
|
|
||||||
|
|
||||||
let messageBox = new St.BoxLayout({ style_class: 'polkit-dialog-message-layout',
|
|
||||||
vertical: true });
|
|
||||||
mainContentBox.add(messageBox,
|
|
||||||
{ y_align: St.Align.START });
|
|
||||||
|
|
||||||
this._subjectLabel = new St.Label({ style_class: 'polkit-dialog-headline',
|
|
||||||
text: _("Alt Tab Behaviour") });
|
|
||||||
|
|
||||||
messageBox.add(this._subjectLabel,
|
|
||||||
{ y_fill: false,
|
|
||||||
y_align: St.Align.START });
|
|
||||||
|
|
||||||
this._descriptionLabel = new St.Label({ style_class: 'polkit-dialog-description',
|
|
||||||
text: Gettext.gettext(MESSAGE) });
|
|
||||||
|
|
||||||
messageBox.add(this._descriptionLabel,
|
|
||||||
{ y_fill: true,
|
|
||||||
y_align: St.Align.START });
|
|
||||||
|
|
||||||
|
|
||||||
this.setButtons([
|
|
||||||
{
|
|
||||||
label: _("All & Thumbnails"),
|
|
||||||
action: Lang.bind(this, function() {
|
|
||||||
this.setBehaviour('all_thumbnails');
|
|
||||||
this.close();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: _("Workspace & Icons"),
|
|
||||||
action: Lang.bind(this, function() {
|
|
||||||
this.setBehaviour('workspace_icons');
|
|
||||||
this.close();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: _("Cancel"),
|
|
||||||
action: Lang.bind(this, function() {
|
|
||||||
this.close();
|
|
||||||
}),
|
|
||||||
key: Clutter.Escape
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
|
|
||||||
setBehaviour: function(behaviour) {
|
|
||||||
settings.set_string(SETTINGS_BEHAVIOUR_KEY, behaviour);
|
|
||||||
settings.set_boolean(SETTINGS_FIRST_TIME_KEY, false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function AltTabPopup2() {
|
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
AltTabPopup2.prototype = {
|
|
||||||
__proto__ : AltTab.AltTabPopup.prototype,
|
|
||||||
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
|
this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
|
||||||
@@ -465,54 +356,6 @@ AltTabPopup2.prototype = {
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
|
||||||
_keyPressEvent : function(actor, event) {
|
|
||||||
let keysym = event.get_key_symbol();
|
|
||||||
let shift = (Shell.get_event_state(event) & Clutter.ModifierType.SHIFT_MASK);
|
|
||||||
// X allows servers to represent Shift+Tab in two different ways
|
|
||||||
if (shift && keysym == Clutter.Tab)
|
|
||||||
keysym = Clutter.ISO_Left_Tab;
|
|
||||||
|
|
||||||
this._disableHover();
|
|
||||||
|
|
||||||
if (keysym == Clutter.grave)
|
|
||||||
this._select(this._currentApp, this._nextWindow());
|
|
||||||
else if (keysym == Clutter.asciitilde)
|
|
||||||
this._select(this._currentApp, this._previousWindow());
|
|
||||||
else if (keysym == Clutter.Escape)
|
|
||||||
this.destroy();
|
|
||||||
else if (this._thumbnailsFocused) {
|
|
||||||
if (keysym == Clutter.Tab) {
|
|
||||||
if (this._currentWindow == this._appIcons[this._currentApp].cachedWindows.length - 1)
|
|
||||||
this._select(this._nextApp());
|
|
||||||
else
|
|
||||||
this._select(this._currentApp, this._nextWindow());
|
|
||||||
} else if (keysym == Clutter.ISO_Left_Tab) {
|
|
||||||
if (this._currentWindow == 0 || this._currentWindow == -1)
|
|
||||||
this._select(this._previousApp());
|
|
||||||
else
|
|
||||||
this._select(this._currentApp, this._previousWindow());
|
|
||||||
} else if (keysym == Clutter.Left)
|
|
||||||
this._select(this._currentApp, this._previousWindow());
|
|
||||||
else if (keysym == Clutter.Right)
|
|
||||||
this._select(this._currentApp, this._nextWindow());
|
|
||||||
else if (keysym == Clutter.Up)
|
|
||||||
this._select(this._currentApp, null, true);
|
|
||||||
} else {
|
|
||||||
if (keysym == Clutter.Tab)
|
|
||||||
this._select(this._nextApp());
|
|
||||||
else if (keysym == Clutter.ISO_Left_Tab)
|
|
||||||
this._select(this._previousApp());
|
|
||||||
else if (keysym == Clutter.Left)
|
|
||||||
this._select(this._previousApp());
|
|
||||||
else if (keysym == Clutter.Right)
|
|
||||||
this._select(this._nextApp());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
_sortWindows : function(win1,win2) {
|
_sortWindows : function(win1,win2) {
|
||||||
let t1 = win1.get_user_time();
|
let t1 = win1.get_user_time();
|
||||||
let t2 = win2.get_user_time();
|
let t2 = win2.get_user_time();
|
||||||
@@ -531,17 +374,14 @@ AltTabPopup2.prototype = {
|
|||||||
Main.activateWindow(app.cachedWindows[0]);
|
Main.activateWindow(app.cachedWindows[0]);
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
function WindowList(windows) {
|
const WindowList = new Lang.Class({
|
||||||
this._init(windows);
|
Name: 'AlternateTab.WindowList',
|
||||||
}
|
Extends: AltTab.SwitcherList,
|
||||||
|
|
||||||
WindowList.prototype = {
|
|
||||||
__proto__ : AltTab.SwitcherList.prototype,
|
|
||||||
|
|
||||||
_init : function(windows) {
|
_init : function(windows) {
|
||||||
AltTab.SwitcherList.prototype._init.call(this, true);
|
this.parent(true);
|
||||||
|
|
||||||
let activeWorkspace = global.screen.get_active_workspace();
|
let activeWorkspace = global.screen.get_active_workspace();
|
||||||
this._labels = new Array();
|
this._labels = new Array();
|
||||||
@@ -595,25 +435,41 @@ WindowList.prototype = {
|
|||||||
addSeparator: function () {
|
addSeparator: function () {
|
||||||
this._separator=null;
|
this._separator=null;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function init(metadata) {
|
const MODES = {
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
all_thumbnails: AltTabPopupAllThumbnails,
|
||||||
me.convenience.initTranslations(metadata);
|
workspace_icons: AltTabPopupWorkspaceIcons,
|
||||||
settings = me.convenience.getSettings(metadata, 'alternate-tab');
|
};
|
||||||
}
|
|
||||||
|
|
||||||
function doAltTab(display, screen, window, binding) {
|
function doAltTab(display, screen, window, binding) {
|
||||||
if(settings.get_boolean(SETTINGS_FIRST_TIME_KEY)) {
|
if(settings.get_boolean(SETTINGS_FIRST_TIME_KEY)) {
|
||||||
new AltTabSettingsDialog().open();
|
let dialog = new Settings.AltTabSettingsDialog(settings);
|
||||||
} else {
|
dialog.open();
|
||||||
let behaviour = settings.get_string(SETTINGS_BEHAVIOUR_KEY);
|
return;
|
||||||
if(behaviour in MODES) {
|
|
||||||
let modifiers = binding.get_modifiers()
|
|
||||||
let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK;
|
|
||||||
MODES[behaviour](display, binding.get_name(), binding.get_mask(), window, backwards);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let behaviour = settings.get_string(SETTINGS_BEHAVIOUR_KEY);
|
||||||
|
|
||||||
|
// alt-tab having no effect is unexpected, even with wrong settings
|
||||||
|
if (!(behaviour in MODES))
|
||||||
|
behaviour = 'all_thumbnails';
|
||||||
|
|
||||||
|
if (Main.wm._workspaceSwitcherPopup)
|
||||||
|
Main.wm._workspaceSwitcherPopup.actor.hide();
|
||||||
|
|
||||||
|
let modifiers = binding.get_modifiers()
|
||||||
|
let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK;
|
||||||
|
|
||||||
|
let constructor = MODES[behaviour];
|
||||||
|
let popup = new constructor();
|
||||||
|
if (!popup.show(backwards, binding.get_name(), binding.get_mask()))
|
||||||
|
popup.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
function init(metadata) {
|
||||||
|
Convenience.initTranslations();
|
||||||
|
settings = Convenience.getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable() {
|
function enable() {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "AlternateTab",
|
"name": "AlternateTab",
|
||||||
"description": "A replacement for Alt-Tab, allows to cycle between windows and does not group by application",
|
"description": "A replacement for Alt-Tab, allows to cycle between windows and does not group by application",
|
||||||
"original-authors": [ "jw@bargsten.org", "thomas.bouffon@gmail.com" ],
|
"original-authors": [ "jw@bargsten.org", "thomas.bouffon@gmail.com" ],
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||||
|
|
||||||
|
/* most of the code is borrowed from
|
||||||
|
* > js/ui/altTab.js <
|
||||||
|
* of the gnome-shell source code
|
||||||
|
*/
|
||||||
|
|
||||||
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const Gdk = imports.gi.Gdk;
|
||||||
|
const Gio = imports.gi.Gio;
|
||||||
|
const Gtk = imports.gi.Gtk;
|
||||||
|
const Lang = imports.lang;
|
||||||
|
const Mainloop = imports.mainloop;
|
||||||
|
const Meta = imports.gi.Meta;
|
||||||
|
const Shell = imports.gi.Shell;
|
||||||
|
const St = imports.gi.St;
|
||||||
|
|
||||||
|
const AltTab = imports.ui.altTab;
|
||||||
|
const Main = imports.ui.main;
|
||||||
|
const ModalDialog = imports.ui.modalDialog;
|
||||||
|
const Tweener = imports.ui.tweener;
|
||||||
|
const WindowManager = imports.ui.windowManager;
|
||||||
|
|
||||||
|
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
||||||
|
const _ = Gettext.gettext;
|
||||||
|
const N_ = function(e) { return e };
|
||||||
|
|
||||||
|
const SETTINGS_BEHAVIOUR_KEY = 'behaviour';
|
||||||
|
const SETTINGS_FIRST_TIME_KEY = 'first-time';
|
||||||
|
|
||||||
|
const MESSAGE = N_("This is the first time you use the Alternate Tab extension. \n\
|
||||||
|
Please choose your preferred behaviour:\n\
|
||||||
|
\n\
|
||||||
|
All & Thumbnails:\n\
|
||||||
|
This mode presents all applications from all workspaces in one selection \n\
|
||||||
|
list. Instead of using the application icon of every window, it uses small \n\
|
||||||
|
thumbnails resembling the window itself. \n\
|
||||||
|
\n\
|
||||||
|
Workspace & Icons:\n\
|
||||||
|
This mode let's you switch between the applications of your current \n\
|
||||||
|
workspace and gives you additionally the option to switch to the last used \n\
|
||||||
|
application of your previous workspace. This is always the last symbol in \n\
|
||||||
|
the list and is segregated by a separator/vertical line if available. \n\
|
||||||
|
Every window is represented by its application icon. \n\
|
||||||
|
\n\
|
||||||
|
If you whish to revert to the default behavior for the Alt-Tab switcher, just\n\
|
||||||
|
disable the extension from extensions.gnome.org or the Advanced Settings application.\
|
||||||
|
");
|
||||||
|
|
||||||
|
const AltTabSettingsDialog = new Lang.Class({
|
||||||
|
Name: 'AlternateTab.Settings.AltTabSettingsDialog',
|
||||||
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
|
_init : function(settings) {
|
||||||
|
this.settings = settings;
|
||||||
|
this.parent({ styleClass: null });
|
||||||
|
|
||||||
|
let mainContentBox = new St.BoxLayout({ style_class: 'polkit-dialog-main-layout',
|
||||||
|
vertical: false });
|
||||||
|
this.contentLayout.add(mainContentBox,
|
||||||
|
{ x_fill: true,
|
||||||
|
y_fill: true });
|
||||||
|
|
||||||
|
let messageBox = new St.BoxLayout({ style_class: 'polkit-dialog-message-layout',
|
||||||
|
vertical: true });
|
||||||
|
mainContentBox.add(messageBox,
|
||||||
|
{ y_align: St.Align.START });
|
||||||
|
|
||||||
|
this._subjectLabel = new St.Label({ style_class: 'polkit-dialog-headline',
|
||||||
|
text: _("Alt Tab Behaviour") });
|
||||||
|
|
||||||
|
messageBox.add(this._subjectLabel,
|
||||||
|
{ y_fill: false,
|
||||||
|
y_align: St.Align.START });
|
||||||
|
|
||||||
|
this._descriptionLabel = new St.Label({ style_class: 'polkit-dialog-description',
|
||||||
|
text: Gettext.gettext(MESSAGE) });
|
||||||
|
|
||||||
|
messageBox.add(this._descriptionLabel,
|
||||||
|
{ y_fill: true,
|
||||||
|
y_align: St.Align.START });
|
||||||
|
|
||||||
|
|
||||||
|
this.setButtons([
|
||||||
|
{
|
||||||
|
label: _("All & Thumbnails"),
|
||||||
|
action: Lang.bind(this, function() {
|
||||||
|
this.setBehaviour('all_thumbnails');
|
||||||
|
this.close();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: _("Workspace & Icons"),
|
||||||
|
action: Lang.bind(this, function() {
|
||||||
|
this.setBehaviour('workspace_icons');
|
||||||
|
this.close();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: _("Cancel"),
|
||||||
|
action: Lang.bind(this, function() {
|
||||||
|
this.close();
|
||||||
|
}),
|
||||||
|
key: Clutter.Escape
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
setBehaviour: function(behaviour) {
|
||||||
|
this.settings.set_string(SETTINGS_BEHAVIOUR_KEY, behaviour);
|
||||||
|
this.settings.set_boolean(SETTINGS_FIRST_TIME_KEY, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -7,6 +7,10 @@ const PopupMenu = imports.ui.popupMenu;
|
|||||||
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
let suspend_item = null;
|
let suspend_item = null;
|
||||||
let hibernate_item = null;
|
let hibernate_item = null;
|
||||||
let poweroff_item = null;
|
let poweroff_item = null;
|
||||||
@@ -36,17 +40,9 @@ function onHibernateActivate(item) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSubMenu() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put your extension initialization code here
|
// Put your extension initialization code here
|
||||||
function init(metadata) {
|
function init(metadata) {
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
Convenience.initTranslations();
|
||||||
me.convenience.initTranslations(metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetMenu() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable() {
|
function enable() {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Alternative Status Menu",
|
"name": "Alternative Status Menu",
|
||||||
"description": "Replaces GNOME Shell Status Menu with one showing Suspend/Hibernate and Power Off as separate items",
|
"description": "Replaces GNOME Shell Status Menu with one showing Suspend/Hibernate and Power Off as separate items",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -10,17 +10,13 @@ const PanelMenu = imports.ui.panelMenu;
|
|||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
|
|
||||||
const ICON_SIZE = 28;
|
const ICON_SIZE = 28;
|
||||||
let appsys = Shell.AppSystem.get_default();
|
|
||||||
|
|
||||||
function AppMenuItem() {
|
const AppMenuItem = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'AppsMenu.AppMenuItem',
|
||||||
}
|
Extends: PopupMenu.PopupBaseMenuItem,
|
||||||
|
|
||||||
AppMenuItem.prototype = {
|
|
||||||
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
|
|
||||||
|
|
||||||
_init: function (app, params) {
|
_init: function (app, params) {
|
||||||
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params);
|
this.parent(params);
|
||||||
|
|
||||||
this._app = app;
|
this._app = app;
|
||||||
this.label = new St.Label({ text: app.get_name() });
|
this.label = new St.Label({ text: app.get_name() });
|
||||||
@@ -32,30 +28,36 @@ AppMenuItem.prototype = {
|
|||||||
activate: function (event) {
|
activate: function (event) {
|
||||||
this._app.activate_full(-1, event.get_time());
|
this._app.activate_full(-1, event.get_time());
|
||||||
|
|
||||||
PopupMenu.PopupBaseMenuItem.prototype.activate.call(this, event);
|
this.parent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
});
|
||||||
|
|
||||||
function ApplicationsButton() {
|
const ApplicationsButton = new Lang.Class({
|
||||||
this._init();
|
Name: 'AppsMenu.ApplicationsButton',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
|
|
||||||
ApplicationsButton.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'start-here');
|
this.parent('start-here');
|
||||||
|
|
||||||
|
this._appSys = Shell.AppSystem.get_default();
|
||||||
|
this._installedChangedId = this._appSys.connect('installed-changed', Lang.bind(this, this._refresh));
|
||||||
|
|
||||||
this._display();
|
this._display();
|
||||||
appsys.connect('installed-changed', Lang.bind(this, this.reDisplay));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
reDisplay : function() {
|
destroy: function() {
|
||||||
|
this._appSys.disconnect(this._installedChangedId);
|
||||||
|
|
||||||
|
this.parent();
|
||||||
|
},
|
||||||
|
|
||||||
|
_refresh: function() {
|
||||||
this._clearAll();
|
this._clearAll();
|
||||||
this._display();
|
this._display();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearAll : function() {
|
_clearAll: function() {
|
||||||
this.menu.removeAll();
|
this.menu.removeAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ ApplicationsButton.prototype = {
|
|||||||
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
|
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
|
||||||
if (nextType == GMenu.TreeItemType.ENTRY) {
|
if (nextType == GMenu.TreeItemType.ENTRY) {
|
||||||
var entry = iter.get_entry();
|
var entry = iter.get_entry();
|
||||||
var app = appsys.lookup_app_by_tree_entry(entry);
|
var app = this._appSys.lookup_app_by_tree_entry(entry);
|
||||||
if (!entry.get_app_info().get_nodisplay())
|
if (!entry.get_app_info().get_nodisplay())
|
||||||
menu.addMenuItem(new AppMenuItem(app));
|
menu.addMenuItem(new AppMenuItem(app));
|
||||||
} else if (nextType == GMenu.TreeItemType.DIRECTORY) {
|
} else if (nextType == GMenu.TreeItemType.DIRECTORY) {
|
||||||
@@ -77,7 +79,7 @@ ApplicationsButton.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_display : function() {
|
_display : function() {
|
||||||
let tree = appsys.get_tree();
|
let tree = this._appSys.get_tree();
|
||||||
let root = tree.get_root_directory();
|
let root = tree.get_root_directory();
|
||||||
|
|
||||||
let iter = root.iter();
|
let iter = root.iter();
|
||||||
@@ -91,7 +93,7 @@ ApplicationsButton.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
let appsMenuButton;
|
let appsMenuButton;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Applications Menu",
|
"name": "Applications Menu",
|
||||||
"description": "Add a gnome 2.x style menu for applications",
|
"description": "Add a gnome 2.x style menu for applications",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
EXTENSION_ID = auto-move-windows
|
EXTENSION_ID = auto-move-windows
|
||||||
|
|
||||||
include ../../extension.mk
|
include ../../extension.mk
|
||||||
|
include ../../settings.mk
|
||||||
|
|
||||||
gschemas_in = $(gschemabase).auto-move-windows.gschema.xml.in
|
|
||||||
|
|
||||||
@INTLTOOL_XML_NOMERGE_RULE@
|
|
||||||
|
|
||||||
gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
|
|
||||||
|
|
||||||
@GSETTINGS_RULES@
|
|
||||||
|
|
||||||
CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
|
|
||||||
EXTRA_DIST += $(gschemas_in)
|
|
||||||
|
|||||||
@@ -11,16 +11,17 @@ const St = imports.gi.St;
|
|||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.auto-move-windows';
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
const SETTINGS_KEY = 'application-list';
|
const SETTINGS_KEY = 'application-list';
|
||||||
|
|
||||||
let settings;
|
let settings;
|
||||||
|
|
||||||
function WindowMover() {
|
const WindowMover = new Lang.Class({
|
||||||
this._init();
|
Name: 'AutoMoveWindows.WindowMover',
|
||||||
}
|
|
||||||
|
|
||||||
WindowMover.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._settings = settings;
|
this._settings = settings;
|
||||||
this._windowTracker = Shell.WindowTracker.get_default();
|
this._windowTracker = Shell.WindowTracker.get_default();
|
||||||
@@ -76,15 +77,14 @@ WindowMover.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
let prevCheckWorkspaces;
|
let prevCheckWorkspaces;
|
||||||
let winMover;
|
let winMover;
|
||||||
|
|
||||||
function init(metadata) {
|
function init() {
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
Convenience.initTranslations();
|
||||||
me.convenience.initTranslations(metadata);
|
settings = Convenience.getSettings();
|
||||||
settings = me.convenience.getSettings(metadata, 'auto-move-windows');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable() {
|
function enable() {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Auto Move Windows",
|
"name": "Auto Move Windows",
|
||||||
"description": "Move applications to specific workspaces when they create windows",
|
"description": "Move applications to specific workspaces when they create windows",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
EXTENSION_ID = dock
|
EXTENSION_ID = dock
|
||||||
|
|
||||||
include ../../extension.mk
|
include ../../extension.mk
|
||||||
|
include ../../settings.mk
|
||||||
|
|
||||||
gschemas_in = $(gschemabase).dock.gschema.xml.in
|
|
||||||
|
|
||||||
@INTLTOOL_XML_NOMERGE_RULE@
|
|
||||||
|
|
||||||
gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
|
|
||||||
|
|
||||||
@GSETTINGS_RULES@
|
|
||||||
|
|
||||||
CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
|
|
||||||
EXTRA_DIST += $(gschemas_in)
|
|
||||||
|
|||||||
+267
-333
@@ -25,19 +25,17 @@ const AltTab = imports.ui.altTab;
|
|||||||
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
const DOCK_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.dock';
|
|
||||||
const DOCK_POSITION_KEY = 'position';
|
const DOCK_POSITION_KEY = 'position';
|
||||||
const DOCK_SIZE_KEY = 'size';
|
const DOCK_SIZE_KEY = 'size';
|
||||||
const DOCK_HIDE_KEY = 'autohide';
|
const DOCK_HIDE_KEY = 'autohide';
|
||||||
const DOCK_EFFECTHIDE_KEY = 'hide-effect';
|
const DOCK_EFFECTHIDE_KEY = 'hide-effect';
|
||||||
const DOCK_AUTOHIDE_ANIMATION_TIME_KEY = 'hide-effect-duration';
|
const DOCK_AUTOHIDE_ANIMATION_TIME_KEY = 'hide-effect-duration';
|
||||||
|
|
||||||
let _me, _metadata;
|
|
||||||
|
|
||||||
//hide
|
|
||||||
//const autohide_animation_time = 0.3;
|
|
||||||
|
|
||||||
// Keep enums in sync with GSettings schemas
|
// Keep enums in sync with GSettings schemas
|
||||||
const PositionMode = {
|
const PositionMode = {
|
||||||
LEFT: 0,
|
LEFT: 0,
|
||||||
@@ -50,268 +48,222 @@ const AutoHideEffect = {
|
|||||||
MOVE: 2
|
MOVE: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
let position = PositionMode.RIGHT;
|
|
||||||
let dockicon_size = 48;
|
|
||||||
let hideable = true;
|
|
||||||
let hideDock = true;
|
|
||||||
let hideEffect = AutoHideEffect.RESIZE;
|
|
||||||
let autohide_animation_time = 0.3;
|
|
||||||
const DND_RAISE_APP_TIMEOUT = 500;
|
const DND_RAISE_APP_TIMEOUT = 500;
|
||||||
|
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
/**** start resize's Dock functions *****************/
|
/**** start resize's Dock functions *****************/
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
function hideDock_size () {
|
function hideDock_size () {
|
||||||
if (hideable){
|
if (!this._hideable)
|
||||||
let monitor = Main.layoutManager.primaryMonitor
|
return;
|
||||||
let position_x = monitor.x;
|
|
||||||
let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
|
||||||
let width = this._item_size + 4*this._spacing;
|
|
||||||
|
|
||||||
Tweener.addTween(this,{
|
let monitor = Main.layoutManager.primaryMonitor
|
||||||
_item_size: 1,
|
let position_x = monitor.x;
|
||||||
time: autohide_animation_time,
|
let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
transition: 'easeOutQuad',
|
let width = this._item_size + 4*this._spacing;
|
||||||
onUpdate: function () {
|
|
||||||
height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
Tweener.addTween(this, {
|
||||||
width = this._item_size + 4*this._spacing;
|
_item_size: 1,
|
||||||
switch (position) {
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
case PositionMode.LEFT:
|
transition: 'easeOutQuad',
|
||||||
position_x=monitor.x-2*this._spacing;
|
onUpdate: function () {
|
||||||
break;
|
height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
case PositionMode.RIGHT:
|
width = this._item_size + 4*this._spacing;
|
||||||
default:
|
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
position_x = monitor.x + (monitor.width-1-this._item_size-2*this._spacing);
|
case PositionMode.LEFT:
|
||||||
}
|
position_x=monitor.x-2*this._spacing;
|
||||||
this.actor.set_position (position_x,monitor.y+(monitor.height-height)/2);
|
break;
|
||||||
this.actor.set_size(width,height);
|
case PositionMode.RIGHT:
|
||||||
},
|
default:
|
||||||
});
|
position_x = monitor.x + (monitor.width-1-this._item_size-2*this._spacing);
|
||||||
hideDock=true;
|
}
|
||||||
}
|
this.actor.set_position (position_x,monitor.y+(monitor.height-height)/2);
|
||||||
|
this.actor.set_size(width,height);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this._hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDock_size () {
|
function showDock_size () {
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
let width = this._item_size + 4*this._spacing;
|
let width = this._item_size + 4*this._spacing;
|
||||||
let position_x = monitor.x;
|
let position_x = monitor.x;
|
||||||
|
|
||||||
Tweener.addTween(this,{
|
Tweener.addTween(this, {
|
||||||
_item_size: dockicon_size,
|
_item_size: this._settings.get_int(DOCK_SIZE_KEY),
|
||||||
time: autohide_animation_time,
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onUpdate: function () {
|
onUpdate: function () {
|
||||||
height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
width = this._item_size + 4*this._spacing;
|
width = this._item_size + 4*this._spacing;
|
||||||
switch (position) {
|
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
case PositionMode.LEFT:
|
case PositionMode.LEFT:
|
||||||
position_x=monitor.x-2*this._spacing;
|
position_x=monitor.x-2*this._spacing;
|
||||||
break;
|
break;
|
||||||
case PositionMode.RIGHT:
|
case PositionMode.RIGHT:
|
||||||
default:
|
default:
|
||||||
position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
|
position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
|
||||||
}
|
}
|
||||||
this.actor.set_position (position_x, monitor.y+(monitor.height-height)/2);
|
this.actor.set_position (position_x, monitor.y+(monitor.height-height)/2);
|
||||||
this.actor.set_size(width,height);
|
this.actor.set_size(width,height);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hideDock=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initShowDock_size () {
|
this._hidden = false;
|
||||||
this._item_size=1;
|
|
||||||
this._showDock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEffectAddItem_size () {
|
function showEffectAddItem_size () {
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
let primary = Main.layoutManager.primaryMonitor;
|
||||||
let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
let height = (this._nicons)*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
let width = this._item_size + 4*this._spacing;
|
let width = this._item_size + 4*this._spacing;
|
||||||
|
|
||||||
Tweener.addTween(this.actor, {
|
Tweener.addTween(this.actor, {
|
||||||
y: primary.y + (primary.height-height)/2,
|
y: primary.y + (primary.height-height)/2,
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
time: autohide_animation_time,
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
/**** start rescale's Dock functions *****************/
|
/**** start rescale's Dock functions *****************/
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
function hideDock_scale () {
|
function hideDock_scale () {
|
||||||
this._item_size = dockicon_size;
|
if (!this._hideable)
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
return;
|
||||||
let cornerX = 0;
|
|
||||||
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
|
||||||
let width = this._item_size + 4*this._spacing;
|
|
||||||
|
|
||||||
switch (position) {
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
case PositionMode.LEFT:
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
cornerX=monitor.x;
|
let cornerX = 0;
|
||||||
break;
|
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
case PositionMode.RIGHT:
|
let width = this._item_size + 4*this._spacing;
|
||||||
default:
|
|
||||||
cornerX = monitor.x + monitor.width-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hideable) {
|
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
Tweener.addTween(this.actor,{
|
case PositionMode.LEFT:
|
||||||
y: monitor.y + (monitor.height-height)/2,
|
cornerX=monitor.x;
|
||||||
x: cornerX,
|
break;
|
||||||
height:height,
|
case PositionMode.RIGHT:
|
||||||
width: width,
|
default:
|
||||||
scale_x: 0.025,
|
cornerX = monitor.x + monitor.width-1;
|
||||||
time: autohide_animation_time,
|
}
|
||||||
transition: 'easeOutQuad'
|
|
||||||
});
|
Tweener.addTween(this.actor,{
|
||||||
hideDock=true;
|
y: monitor.y + (monitor.height-height)/2,
|
||||||
}
|
x: cornerX,
|
||||||
|
height:height,
|
||||||
|
width: width,
|
||||||
|
scale_x: 0.025,
|
||||||
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
|
transition: 'easeOutQuad'
|
||||||
|
});
|
||||||
|
|
||||||
|
this._hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDock_scale () {
|
function showDock_scale () {
|
||||||
this._item_size = dockicon_size;
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
let position_x = monitor.x;
|
let position_x = monitor.x;
|
||||||
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
let width = this._item_size + 4*this._spacing;
|
let width = this._item_size + 4*this._spacing;
|
||||||
|
|
||||||
switch (position) {
|
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
case PositionMode.LEFT:
|
case PositionMode.LEFT:
|
||||||
position_x=monitor.x-2*this._spacing;
|
position_x=monitor.x-2*this._spacing;
|
||||||
break;
|
break;
|
||||||
case PositionMode.RIGHT:
|
case PositionMode.RIGHT:
|
||||||
default:
|
default:
|
||||||
position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
|
position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
|
||||||
}
|
}
|
||||||
Tweener.addTween(this.actor, {
|
Tweener.addTween(this.actor, {
|
||||||
y: monitor.y + (monitor.height-height)/2,
|
y: monitor.y + (monitor.height-height)/2,
|
||||||
x: monitor.x + position_x,
|
x: monitor.x + position_x,
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
scale_x: 1,
|
scale_x: 1,
|
||||||
time: autohide_animation_time,
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
hideDock=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initShowDock_scale () {
|
this._hidden = false;
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
|
||||||
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
|
||||||
let width = this._item_size + 4*this._spacing;
|
|
||||||
|
|
||||||
this.actor.set_scale (0,0);
|
|
||||||
this.actor.set_size (width,height);
|
|
||||||
|
|
||||||
// set the position of the dock
|
|
||||||
switch (position) {
|
|
||||||
case PositionMode.LEFT:
|
|
||||||
this.actor.x = 0;
|
|
||||||
// effect of creation of the dock
|
|
||||||
Tweener.addTween(this.actor, {
|
|
||||||
x: primary.x-2*this._spacing,
|
|
||||||
y: primary.y + (primary.height-height)/2,
|
|
||||||
time: autohide_animation_time * 3,
|
|
||||||
transition: 'easeOutQuad'
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case PositionMode.RIGHT:
|
|
||||||
default:
|
|
||||||
this.actor.x = primary.width-1;
|
|
||||||
// effect of creation of the dock
|
|
||||||
Tweener.addTween(this.actor, {
|
|
||||||
x: primary.x + primary.width-this._item_size- 2*this._spacing,
|
|
||||||
y: primary.y + (primary.height-height)/2,
|
|
||||||
time: autohide_animation_time * 3,
|
|
||||||
transition: 'easeOutQuad'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Tweener.addTween(this.actor,{
|
|
||||||
scale_x: 1,
|
|
||||||
scale_y: 1,
|
|
||||||
time: autohide_animation_time * 3,
|
|
||||||
transition: 'easeOutQuad'
|
|
||||||
});
|
|
||||||
hideDock=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEffectAddItem_scale () {
|
function showEffectAddItem_scale () {
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
let width = this._item_size + 4*this._spacing;
|
let width = this._item_size + 4*this._spacing;
|
||||||
|
|
||||||
Tweener.addTween(this.actor, {
|
Tweener.addTween(this.actor, {
|
||||||
y: monitor.y + (monitor.height-height)/2,
|
y: monitor.y + (monitor.height-height)/2,
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
time: autohide_animation_time,
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
/**** start move Dock functions *****************/
|
/**** start move Dock functions *****************/
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
function hideDock_move () {
|
function hideDock_move () {
|
||||||
this._item_size = dockicon_size;
|
if (!this._hideable)
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
return;
|
||||||
let cornerX = 0;
|
|
||||||
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
|
||||||
let width = this._item_size + 4*this._spacing;
|
|
||||||
|
|
||||||
switch (position) {
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
case PositionMode.LEFT:
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
cornerX= monitor.x - width + this._spacing;
|
let cornerX = 0;
|
||||||
break;
|
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
case PositionMode.RIGHT:
|
let width = this._item_size + 4*this._spacing;
|
||||||
default:
|
|
||||||
cornerX = monitor.x + monitor.width - this._spacing;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hideable) {
|
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
Tweener.addTween(this.actor,{
|
case PositionMode.LEFT:
|
||||||
x: cornerX,
|
cornerX= monitor.x - width + this._spacing;
|
||||||
y: monitor.y + (monitor.height - height)/2,
|
break;
|
||||||
width: width,
|
case PositionMode.RIGHT:
|
||||||
height: height,
|
default:
|
||||||
time: autohide_animation_time,
|
cornerX = monitor.x + monitor.width - this._spacing;
|
||||||
transition: 'easeOutQuad'
|
}
|
||||||
});
|
|
||||||
hideDock=true;
|
Tweener.addTween(this.actor,{
|
||||||
}
|
x: cornerX,
|
||||||
|
y: monitor.y + (monitor.height - height)/2,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
|
transition: 'easeOutQuad'
|
||||||
|
});
|
||||||
|
|
||||||
|
this._hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDock_move () {
|
function showDock_move () {
|
||||||
this._item_size = dockicon_size;
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
let position_x = monitor.x;
|
let position_x = monitor.x;
|
||||||
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
let width = this._item_size + 4*this._spacing;
|
let width = this._item_size + 4*this._spacing;
|
||||||
|
|
||||||
switch (position) {
|
switch (this._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
case PositionMode.LEFT:
|
case PositionMode.LEFT:
|
||||||
position_x=monitor.x - 2*this._spacing;
|
position_x=monitor.x - 2*this._spacing;
|
||||||
break;
|
break;
|
||||||
case PositionMode.RIGHT:
|
case PositionMode.RIGHT:
|
||||||
default:
|
default:
|
||||||
position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
|
position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
|
||||||
}
|
}
|
||||||
Tweener.addTween(this.actor, {
|
Tweener.addTween(this.actor, {
|
||||||
x: position_x,
|
x: position_x,
|
||||||
y: monitor.y + (monitor.height - height)/2,
|
y: monitor.y + (monitor.height - height)/2,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
time: autohide_animation_time,
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
hideDock=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initShowDock_move () {
|
this._hidden = false;
|
||||||
this._showDock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEffectAddItem_move () {
|
function showEffectAddItem_move () {
|
||||||
@@ -323,16 +275,14 @@ function showEffectAddItem_move () {
|
|||||||
y: monitor.y + (monitor.height-height)/2,
|
y: monitor.y + (monitor.height-height)/2,
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
time: autohide_animation_time,
|
time: this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY),
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function Dock() {
|
const Dock = new Lang.Class({
|
||||||
this._init();
|
Name: 'Dock.Dock',
|
||||||
}
|
|
||||||
|
|
||||||
Dock.prototype = {
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
this._placeholderText = null;
|
this._placeholderText = null;
|
||||||
this._menus = [];
|
this._menus = [];
|
||||||
@@ -341,20 +291,14 @@ Dock.prototype = {
|
|||||||
this._favorites = [];
|
this._favorites = [];
|
||||||
|
|
||||||
// Load Settings
|
// Load Settings
|
||||||
this._settings = _me.convenience.getSettings(_metadata, 'dock');
|
this._settings = Convenience.getSettings();
|
||||||
position = this._settings.get_enum(DOCK_POSITION_KEY);
|
this._hidden = false;
|
||||||
dockicon_size = this._settings.get_int(DOCK_SIZE_KEY);
|
this._hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
|
||||||
hideDock = hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
|
|
||||||
hideEffect = this._settings.get_enum(DOCK_EFFECTHIDE_KEY);
|
|
||||||
autohide_animation_time = this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY);
|
|
||||||
//global.log("POSITION: " + position);
|
|
||||||
//global.log("dockicon_size: " + dockicon_size);
|
|
||||||
|
|
||||||
|
|
||||||
this._spacing = 4;
|
this._spacing = 4;
|
||||||
this._item_size = dockicon_size;
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
this._nicons = 0;
|
this._nicons = 0;
|
||||||
this._selectFunctionsHide ();
|
this._selectEffectFunctions(this._settings.get_enum(DOCK_EFFECTHIDE_KEY));
|
||||||
|
|
||||||
this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true });
|
this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true });
|
||||||
|
|
||||||
@@ -385,58 +329,45 @@ Dock.prototype = {
|
|||||||
{ affectsStruts: !this._settings.get_boolean(DOCK_HIDE_KEY) });
|
{ affectsStruts: !this._settings.get_boolean(DOCK_HIDE_KEY) });
|
||||||
|
|
||||||
//hidden
|
//hidden
|
||||||
this._settings.connect('changed::'+DOCK_POSITION_KEY, Lang.bind(this, function (){
|
this._settings.connect('changed::'+DOCK_POSITION_KEY, Lang.bind(this, this._redisplay));
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
this._settings.connect('changed::'+DOCK_SIZE_KEY, Lang.bind(this, this._redisplay));
|
||||||
position = this._settings.get_enum(DOCK_POSITION_KEY);
|
|
||||||
this.actor.y=primary.y;
|
|
||||||
this._redisplay();
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._settings.connect('changed::'+DOCK_SIZE_KEY, Lang.bind(this, function (){
|
|
||||||
dockicon_size = this._settings.get_int(DOCK_SIZE_KEY);
|
|
||||||
this._redisplay();
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._settings.connect('changed::'+DOCK_HIDE_KEY, Lang.bind(this, function (){
|
this._settings.connect('changed::'+DOCK_HIDE_KEY, Lang.bind(this, function (){
|
||||||
Main.layoutManager.removeChrome(this.actor);
|
Main.layoutManager.removeChrome(this.actor);
|
||||||
Main.layoutManager.addChrome(this.actor,
|
Main.layoutManager.addChrome(this.actor,
|
||||||
{ affectsStruts: !this._settings.get_boolean(DOCK_HIDE_KEY) });
|
{ affectsStruts: !this._settings.get_boolean(DOCK_HIDE_KEY) });
|
||||||
|
|
||||||
hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
|
this._hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
|
||||||
if (hideable){
|
if (this._hideable)
|
||||||
hideDock=false;
|
|
||||||
this._hideDock();
|
this._hideDock();
|
||||||
} else {
|
else
|
||||||
hideDock=true;
|
|
||||||
this._showDock();
|
this._showDock();
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._settings.connect('changed::'+DOCK_EFFECTHIDE_KEY, Lang.bind(this, function () {
|
this._settings.connect('changed::' + DOCK_EFFECTHIDE_KEY, Lang.bind(this, function () {
|
||||||
hideEffect = this._settings.get_enum(DOCK_EFFECTHIDE_KEY);
|
let hideEffect = this._settings.get_enum(DOCK_EFFECTHIDE_KEY);
|
||||||
|
|
||||||
switch (hideEffect) {
|
// restore the effects of the other functions
|
||||||
case AutoHideEffect.RESCALE:
|
switch (hideEffect) {
|
||||||
this._item_size=dockicon_size;
|
case AutoHideEffect.RESCALE:
|
||||||
break;
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
case AutoHideEffect.RESIZE:
|
break;
|
||||||
this.actor.set_scale (1,1);
|
case AutoHideEffect.RESIZE:
|
||||||
break;
|
this.actor.set_scale(1, 1);
|
||||||
case AutoHideEffect.MOVE:
|
break;
|
||||||
;
|
case AutoHideEffect.MOVE:
|
||||||
}
|
this.actor.set_scale(1, 1);
|
||||||
this.actor.disconnect(this._leave_event);
|
this._item_size = this._settings.get_int(DOCK_SIZE_KEY);
|
||||||
this.actor.disconnect(this._enter_event);
|
}
|
||||||
|
|
||||||
this._selectFunctionsHide ();
|
this.actor.disconnect(this._leave_event);
|
||||||
|
this.actor.disconnect(this._enter_event);
|
||||||
|
|
||||||
this._leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
|
this._selectEffectFunctions(hideEffect);
|
||||||
this._enter_event = this.actor.connect('enter-event', Lang.bind(this, this._showDock));
|
|
||||||
this._redisplay();
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._settings.connect('changed::'+DOCK_AUTOHIDE_ANIMATION_TIME_KEY, Lang.bind(this,function (){
|
this._leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
|
||||||
autohide_animation_time = this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY);
|
this._enter_event = this.actor.connect('enter-event', Lang.bind(this, this._showDock));
|
||||||
|
this._redisplay();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
|
this._leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
|
||||||
@@ -481,33 +412,30 @@ Dock.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// fuctions hide
|
// fuctions hide
|
||||||
_restoreHideDock: function(){
|
_restoreHideDock: function() {
|
||||||
hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
|
this._hideable = this._settings.get_boolean(DOCK_HIDE_KEY);
|
||||||
},
|
},
|
||||||
|
|
||||||
_disableHideDock: function (){
|
_disableHideDock: function() {
|
||||||
hideable = false;
|
this._hideable = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectFunctionsHide: function () {
|
_selectEffectFunctions: function(hideEffect) {
|
||||||
switch (hideEffect) {
|
switch (hideEffect) {
|
||||||
case AutoHideEffect.RESCALE:
|
case AutoHideEffect.RESCALE:
|
||||||
this._hideDock = hideDock_scale;
|
this._hideDock = hideDock_scale;
|
||||||
this._showDock = showDock_scale;
|
this._showDock = showDock_scale;
|
||||||
this._initShowDock = initShowDock_scale;
|
|
||||||
this._showEffectAddItem = showEffectAddItem_scale;
|
this._showEffectAddItem = showEffectAddItem_scale;
|
||||||
break;
|
break;
|
||||||
case AutoHideEffect.MOVE:
|
case AutoHideEffect.MOVE:
|
||||||
this._hideDock = hideDock_move;
|
this._hideDock = hideDock_move;
|
||||||
this._showDock = showDock_move;
|
this._showDock = showDock_move;
|
||||||
this._initShowDock = initShowDock_move;
|
|
||||||
this._showEffectAddItem = showEffectAddItem_move;
|
this._showEffectAddItem = showEffectAddItem_move;
|
||||||
break;
|
break;
|
||||||
case AutoHideEffect.RESIZE:
|
case AutoHideEffect.RESIZE:
|
||||||
default:
|
default:
|
||||||
this._hideDock = hideDock_size;
|
this._hideDock = hideDock_size;
|
||||||
this._showDock = showDock_size;
|
this._showDock = showDock_size;
|
||||||
this._initShowDock = initShowDock_size;
|
|
||||||
this._showEffectAddItem = showEffectAddItem_size;
|
this._showEffectAddItem = showEffectAddItem_size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -566,21 +494,16 @@ Dock.prototype = {
|
|||||||
let height = (icons)*(this._item_size + this._spacing) + 2*this._spacing;
|
let height = (icons)*(this._item_size + this._spacing) + 2*this._spacing;
|
||||||
let width = this._item_size + 4*this._spacing;
|
let width = this._item_size + 4*this._spacing;
|
||||||
|
|
||||||
if (this.actor.y != primary.y) {
|
if (this._hideable && this._hidden) {
|
||||||
if (hideable && hideDock) {
|
this._hideDock();
|
||||||
this._hideDock();
|
|
||||||
} else {
|
|
||||||
if (dockicon_size == this._item_size) {
|
|
||||||
// only add/delete icon
|
|
||||||
this._showEffectAddItem ();
|
|
||||||
} else {
|
|
||||||
// change size icon
|
|
||||||
this._showDock ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// effect of creation
|
if (this._settings.get_int(DOCK_SIZE_KEY) == this._item_size) {
|
||||||
this._initShowDock ();
|
// only add/delete icon
|
||||||
|
this._showEffectAddItem ();
|
||||||
|
} else {
|
||||||
|
// change size icon
|
||||||
|
this._showDock ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -602,7 +525,7 @@ Dock.prototype = {
|
|||||||
let children = this._grid.get_children();
|
let children = this._grid.get_children();
|
||||||
|
|
||||||
let x = box.x1 + this._spacing;
|
let x = box.x1 + this._spacing;
|
||||||
if (position == PositionMode.LEFT)
|
if (this._settings.get_enum(DOCK_POSITION_KEY) == PositionMode.LEFT)
|
||||||
x = box.x1 + 2*this._spacing;
|
x = box.x1 + 2*this._spacing;
|
||||||
let y = box.y1 + this._spacing;
|
let y = box.y1 + this._spacing;
|
||||||
|
|
||||||
@@ -638,15 +561,17 @@ Dock.prototype = {
|
|||||||
addItem: function(actor) {
|
addItem: function(actor) {
|
||||||
this._grid.add_actor(actor);
|
this._grid.add_actor(actor);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(Dock.prototype);
|
Signals.addSignalMethods(Dock.prototype);
|
||||||
|
|
||||||
function DockIcon(app, dock) {
|
const DockIcon = new Lang.Class({
|
||||||
this._init(app, dock);
|
Name: 'Dock.DockIcon',
|
||||||
}
|
|
||||||
|
|
||||||
DockIcon.prototype = {
|
|
||||||
_init : function(app, dock) {
|
_init : function(app, dock) {
|
||||||
|
this._dock = dock;
|
||||||
|
this._settings = dock._settings;
|
||||||
|
|
||||||
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.actor = new St.Button({ style_class: 'app-well-app',
|
this.actor = new St.Button({ style_class: 'app-well-app',
|
||||||
button_mask: St.ButtonMask.ONE | St.ButtonMask.TWO,
|
button_mask: St.ButtonMask.ONE | St.ButtonMask.TWO,
|
||||||
@@ -654,12 +579,11 @@ DockIcon.prototype = {
|
|||||||
x_fill: true,
|
x_fill: true,
|
||||||
y_fill: true });
|
y_fill: true });
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
//this.actor.set_size(dockicon_size, dockicon_size);
|
|
||||||
|
|
||||||
this._icon = new AppDisplay.AppIcon(app, { setSizeManually: true,
|
this._icon = new AppDisplay.AppIcon(app, { setSizeManually: true,
|
||||||
showLabel: false });
|
showLabel: false });
|
||||||
this.actor.set_child(this._icon.actor);
|
this.actor.set_child(this._icon.actor);
|
||||||
this._icon.setIconSize(dockicon_size);
|
this._icon.setIconSize(this._settings.get_int(DOCK_SIZE_KEY));
|
||||||
|
|
||||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||||
|
|
||||||
@@ -679,7 +603,6 @@ DockIcon.prototype = {
|
|||||||
this._stateChangedId = this.app.connect('notify::state',
|
this._stateChangedId = this.app.connect('notify::state',
|
||||||
Lang.bind(this, this._onStateChanged));
|
Lang.bind(this, this._onStateChanged));
|
||||||
this._onStateChanged();
|
this._onStateChanged();
|
||||||
this._dock=dock;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy: function() {
|
||||||
@@ -775,7 +698,8 @@ DockIcon.prototype = {
|
|||||||
this._menuManager.addMenu(this._menu, true);
|
this._menuManager.addMenu(this._menu, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._menu.popup();
|
this._menu.redisplay();
|
||||||
|
this._menu.open();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
@@ -828,30 +752,25 @@ DockIcon.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
},
|
|
||||||
|
|
||||||
shellWorkspaceLaunch : function() {
|
|
||||||
this.app.open_new_window();
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
Signals.addSignalMethods(DockIcon.prototype);
|
Signals.addSignalMethods(DockIcon.prototype);
|
||||||
|
|
||||||
function DockIconMenu(source) {
|
const DockIconMenu = new Lang.Class({
|
||||||
this._init(source);
|
Name: 'Dock.DockIconMenu',
|
||||||
}
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
DockIconMenu.prototype = {
|
|
||||||
__proto__: AppDisplay.AppIconMenu.prototype,
|
|
||||||
|
|
||||||
_init: function(source) {
|
_init: function(source) {
|
||||||
switch (position) {
|
let side;
|
||||||
case PositionMode.LEFT:
|
switch (source._settings.get_enum(DOCK_POSITION_KEY)) {
|
||||||
PopupMenu.PopupMenu.prototype._init.call(this, source.actor, St.Align.MIDDLE, St.Side.LEFT, 0);
|
case PositionMode.LEFT:
|
||||||
break;
|
side = St.Side.LEFT;
|
||||||
case PositionMode.RIGHT:
|
break;
|
||||||
default:
|
case PositionMode.RIGHT:
|
||||||
PopupMenu.PopupMenu.prototype._init.call(this, source.actor, St.Align.MIDDLE, St.Side.RIGHT, 0);
|
default:
|
||||||
|
side = St.Side.RIGHT;
|
||||||
}
|
}
|
||||||
|
this.parent(source.actor, 0.5, side);
|
||||||
|
|
||||||
this._source = source;
|
this._source = source;
|
||||||
|
|
||||||
@@ -864,12 +783,12 @@ DockIconMenu.prototype = {
|
|||||||
if (!source.actor.mapped)
|
if (!source.actor.mapped)
|
||||||
this.close();
|
this.close();
|
||||||
}));
|
}));
|
||||||
source.actor.connect('destroy', Lang.bind(this, function () { this.actor.destroy(); }));
|
source.actor.connect('destroy', Lang.bind(this, function () { this.destroy(); }));
|
||||||
|
|
||||||
Main.layoutManager.addChrome(this.actor);
|
Main.layoutManager.addChrome(this.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_redisplay: function() {
|
redisplay: function() {
|
||||||
this.removeAll();
|
this.removeAll();
|
||||||
|
|
||||||
let windows = this._source.app.get_windows();
|
let windows = this._source.app.get_windows();
|
||||||
@@ -906,6 +825,23 @@ DockIconMenu.prototype = {
|
|||||||
this._highlightedItem = null;
|
this._highlightedItem = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_appendSeparator: function () {
|
||||||
|
let separator = new PopupMenu.PopupSeparatorMenuItem();
|
||||||
|
this.addMenuItem(separator);
|
||||||
|
},
|
||||||
|
|
||||||
|
_appendMenuItem: function(labelText) {
|
||||||
|
// FIXME: app-well-menu-item style
|
||||||
|
let item = new PopupMenu.PopupMenuItem(labelText);
|
||||||
|
this.addMenuItem(item);
|
||||||
|
return item;
|
||||||
|
},
|
||||||
|
|
||||||
|
popup: function(activatingButton) {
|
||||||
|
this._redisplay();
|
||||||
|
this.open();
|
||||||
|
},
|
||||||
|
|
||||||
_onActivate: function (actor, child) {
|
_onActivate: function (actor, child) {
|
||||||
if (child._window) {
|
if (child._window) {
|
||||||
let metaWindow = child._window;
|
let metaWindow = child._window;
|
||||||
@@ -926,12 +862,10 @@ DockIconMenu.prototype = {
|
|||||||
}
|
}
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
function init(metadata) {
|
function init() {
|
||||||
_metadata = metadata;
|
Convenience.initTranslations();
|
||||||
_me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
|
||||||
_me.convenience.initTranslations(metadata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let dock;
|
let dock;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Dock",
|
"name": "Dock",
|
||||||
"description": "A dock for the GNOME Shell -- displays favorite and running applications",
|
"description": "A dock for the GNOME Shell -- displays favorite and running applications",
|
||||||
"original-author": "tclaesson@gmail.com",
|
"original-author": "tclaesson@gmail.com",
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ const Panel = imports.ui.panel;
|
|||||||
const PanelMenu = imports.ui.panelMenu;
|
const PanelMenu = imports.ui.panelMenu;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
|
|
||||||
function DriveMenuItem(place) {
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
this._init(place);
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
}
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
DriveMenuItem.prototype = {
|
const DriveMenuItem = new Lang.Class({
|
||||||
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
|
Name: 'DriveMenu.DriveMenuItem',
|
||||||
|
Extends: PopupMenu.PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function(place) {
|
_init: function(place) {
|
||||||
PopupMenu.PopupBaseMenuItem.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this.place = place;
|
this.place = place;
|
||||||
|
|
||||||
@@ -42,23 +43,19 @@ DriveMenuItem.prototype = {
|
|||||||
activate: function(event) {
|
activate: function(event) {
|
||||||
this.place.launch({ timestamp: event.get_time() });
|
this.place.launch({ timestamp: event.get_time() });
|
||||||
|
|
||||||
PopupMenu.PopupBaseMenuItem.prototype.activate.call(this, event);
|
this.parent(event);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function DriveMenu() {
|
const DriveMenu = new Lang.Class({
|
||||||
this._init();
|
Name: 'DriveMenu.DriveMenu',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
|
|
||||||
DriveMenu.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
// is 'media-eject' better?
|
this.parent('media-eject');
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'media-eject');
|
|
||||||
|
|
||||||
this._manager = Main.placesManager;
|
this._manager = Main.placesManager;
|
||||||
this._manager.connect('mounts-updated', Lang.bind(this, this._update));
|
this._updatedId = this._manager.connect('mounts-updated', Lang.bind(this, this._update));
|
||||||
|
|
||||||
this._contentSection = new PopupMenu.PopupMenuSection();
|
this._contentSection = new PopupMenu.PopupMenuSection();
|
||||||
this.menu.addMenuItem(this._contentSection);
|
this.menu.addMenuItem(this._contentSection);
|
||||||
@@ -87,12 +84,16 @@ DriveMenu.prototype = {
|
|||||||
|
|
||||||
this.actor.visible = any;
|
this.actor.visible = any;
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
// Put your extension initialization code here
|
destroy: function() {
|
||||||
function init(metadata) {
|
this._manager.disconnect(this._updatedId);
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
|
||||||
me.convenience.initTranslations(metadata);
|
this.parent();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
Convenience.initTranslations();
|
||||||
}
|
}
|
||||||
|
|
||||||
let _indicator;
|
let _indicator;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Removable Drive Menu",
|
"name": "Removable Drive Menu",
|
||||||
"description": "A status menu for accessing and unmounting removable devices",
|
"description": "A status menu for accessing and unmounting removable devices",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ const _ = Gettext.gettext;
|
|||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
function _showHello() {
|
function _showHello() {
|
||||||
let text = new St.Label({ style_class: 'helloworld-label', text: _("Hello, world!") });
|
let text = new St.Label({ style_class: 'helloworld-label', text: _("Hello, world!") });
|
||||||
let monitor = Main.layoutManager.primaryMonitor;
|
let monitor = Main.layoutManager.primaryMonitor;
|
||||||
@@ -19,8 +23,7 @@ function _showHello() {
|
|||||||
function init(metadata) {
|
function init(metadata) {
|
||||||
log ('Example extension initalized');
|
log ('Example extension initalized');
|
||||||
|
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
Convenience.initTranslations();
|
||||||
me.convenience.initTranslations(metadata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let signalId;
|
let signalId;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Hello, World!",
|
"name": "Hello, World!",
|
||||||
"description": "An example extension to show how it works. Shows Hello, world when clicking on the top panel.",
|
"description": "An example extension to show how it works. Shows Hello, world when clicking on the top panel.",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Gajim IM integration",
|
"name": "Gajim IM integration",
|
||||||
"description": "Display Gajim incoming chats as notifications in the Shell message tray.",
|
"description": "Display Gajim incoming chats as notifications in the Shell message tray.",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
EXTENSION_ID = native-window-placement
|
EXTENSION_ID = native-window-placement
|
||||||
|
|
||||||
include ../../extension.mk
|
include ../../extension.mk
|
||||||
|
include ../../settings.mk
|
||||||
|
|
||||||
gschemas_in = $(gschemabase).native-window-placement.gschema.xml.in
|
|
||||||
|
|
||||||
@INTLTOOL_XML_NOMERGE_RULE@
|
|
||||||
|
|
||||||
gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
|
|
||||||
|
|
||||||
@GSETTINGS_RULES@
|
|
||||||
|
|
||||||
CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
|
|
||||||
EXTRA_DIST += $(gschemas_in)
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ const Tweener = imports.ui.tweener;
|
|||||||
const Workspace = imports.ui.workspace;
|
const Workspace = imports.ui.workspace;
|
||||||
const WindowPositionFlags = Workspace.WindowPositionFlags;
|
const WindowPositionFlags = Workspace.WindowPositionFlags;
|
||||||
|
|
||||||
let _me, _metadata;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
// testing settings for natural window placement strategy:
|
// testing settings for natural window placement strategy:
|
||||||
const WINDOW_PLACEMENT_NATURAL_FILLGAPS = true; // enlarge windows at the end to fill gaps // not implemented yet
|
const WINDOW_PLACEMENT_NATURAL_FILLGAPS = true; // enlarge windows at the end to fill gaps // not implemented yet
|
||||||
@@ -46,15 +48,16 @@ function injectToFunction(parent, name, func) {
|
|||||||
}
|
}
|
||||||
const WORKSPACE_BORDER_GAP = 10; // gap between the workspace area and the workspace selector
|
const WORKSPACE_BORDER_GAP = 10; // gap between the workspace area and the workspace selector
|
||||||
|
|
||||||
function Rect(x, y, width, height) {
|
const Rect = new Lang.Class({
|
||||||
[this.x, this.y, this.width, this.height] = arguments;
|
Name: 'NativeWindowPlacement.Rect',
|
||||||
}
|
|
||||||
|
_init: function(x, y, width, height) {
|
||||||
|
[this.x, this.y, this.width, this.height] = [x, y, width, height];
|
||||||
|
},
|
||||||
|
|
||||||
Rect.prototype = {
|
|
||||||
/**
|
/**
|
||||||
* used in _calculateWindowTransformationsNatural to replace Meta.Rectangle that is too slow.
|
* used in _calculateWindowTransformationsNatural to replace Meta.Rectangle that is too slow.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
copy: function() {
|
copy: function() {
|
||||||
return new Rect(this.x, this.y, this.width, this.height);
|
return new Rect(this.x, this.y, this.width, this.height);
|
||||||
},
|
},
|
||||||
@@ -103,7 +106,7 @@ Rect.prototype = {
|
|||||||
this.x += dx;
|
this.x += dx;
|
||||||
this.y += dy;
|
this.y += dy;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
let winInjections, workspaceInjections, connectedSignals;
|
let winInjections, workspaceInjections, connectedSignals;
|
||||||
|
|
||||||
@@ -116,7 +119,7 @@ function resetState() {
|
|||||||
function enable() {
|
function enable() {
|
||||||
resetState();
|
resetState();
|
||||||
|
|
||||||
let settings = _me.convenience.getSettings(_metadata, 'native-window-placement');
|
let settings = Convenience.getSettings();
|
||||||
let useMoreScreen = settings.get_boolean('use-more-screen');
|
let useMoreScreen = settings.get_boolean('use-more-screen');
|
||||||
signalId = settings.connect('changed::use-more-screen', function() {
|
signalId = settings.connect('changed::use-more-screen', function() {
|
||||||
useMoreScreen = settings.get_boolean('use-more-screen');
|
useMoreScreen = settings.get_boolean('use-more-screen');
|
||||||
@@ -501,7 +504,6 @@ function disable() {
|
|||||||
resetState();
|
resetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(metadata) {
|
function init() {
|
||||||
_metadata = metadata;
|
/* do nothing */
|
||||||
_me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Native Window Placement",
|
"name": "Native Window Placement",
|
||||||
"description": "Arrange windows in overview in a more native way",
|
"description": "Arrange windows in overview in a more native way",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -14,17 +14,18 @@ const Panel = imports.ui.panel;
|
|||||||
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
const PLACE_ICON_SIZE = 22;
|
const PLACE_ICON_SIZE = 22;
|
||||||
|
|
||||||
function PlacesMenu() {
|
const PlacesMenu = new Lang.Class({
|
||||||
this._init.apply(this, arguments);
|
Name: 'PlacesMenu.PlacesMenu',
|
||||||
}
|
Extends: PanelMenu.SystemStatusButton,
|
||||||
|
|
||||||
PlacesMenu.prototype = {
|
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'folder');
|
this.parent('folder');
|
||||||
|
|
||||||
this.defaultItems = [];
|
this.defaultItems = [];
|
||||||
this.bookmarkItems = [];
|
this.bookmarkItems = [];
|
||||||
@@ -36,8 +37,16 @@ PlacesMenu.prototype = {
|
|||||||
this._devicesMenuItem = new PopupMenu.PopupSubMenuMenuItem(_("Removable Devices"));
|
this._devicesMenuItem = new PopupMenu.PopupSubMenuMenuItem(_("Removable Devices"));
|
||||||
this.menu.addMenuItem(this._devicesMenuItem);
|
this.menu.addMenuItem(this._devicesMenuItem);
|
||||||
this._createDevices();
|
this._createDevices();
|
||||||
Main.placesManager.connect('bookmarks-updated',Lang.bind(this,this._redisplayBookmarks));
|
|
||||||
Main.placesManager.connect('mounts-updated',Lang.bind(this,this._redisplayDevices));
|
this._bookmarksId = Main.placesManager.connect('bookmarks-updated',Lang.bind(this,this._redisplayBookmarks));
|
||||||
|
this._mountsId = Main.placesManager.connect('mounts-updated',Lang.bind(this,this._redisplayDevices));
|
||||||
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
Main.placesManager.disconnect(this._bookmarksId);
|
||||||
|
Main.placesManager.disconnect(this._mountsId);
|
||||||
|
|
||||||
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_redisplayBookmarks: function(){
|
_redisplayBookmarks: function(){
|
||||||
@@ -108,14 +117,12 @@ PlacesMenu.prototype = {
|
|||||||
|
|
||||||
_clearDevices : function(){
|
_clearDevices : function(){
|
||||||
this._devicesMenuItem.menu.removeAll();
|
this._devicesMenuItem.menu.removeAll();
|
||||||
this.DeviceItems = [];
|
this.deviceItems = [];
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
|
function init() {
|
||||||
function init(metadata) {
|
Convenience.initTranslations();
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
|
||||||
me.convenience.initTranslations(metadata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let _indicator;
|
let _indicator;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Places Status Indicator",
|
"name": "Places Status Indicator",
|
||||||
"description": "Add a systems status menu for quickly navigating places in the system",
|
"description": "Add a systems status menu for quickly navigating places in the system",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -16,11 +16,9 @@ let _cpuIndicator;
|
|||||||
let _memIndicator;
|
let _memIndicator;
|
||||||
let _box;
|
let _box;
|
||||||
|
|
||||||
function Indicator() {
|
const Indicator = new Lang.Class({
|
||||||
this._init();
|
Name: 'SystemMonitor.Indicator',
|
||||||
}
|
|
||||||
|
|
||||||
Indicator.prototype = {
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._initValues();
|
this._initValues();
|
||||||
this.drawing_area = new St.DrawingArea({ reactive: true });
|
this.drawing_area = new St.DrawingArea({ reactive: true });
|
||||||
@@ -44,6 +42,7 @@ Indicator.prototype = {
|
|||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
Mainloop.source_remove(this._timeout);
|
Mainloop.source_remove(this._timeout);
|
||||||
|
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -131,20 +130,16 @@ Indicator.prototype = {
|
|||||||
cr.setDash([], 0);
|
cr.setDash([], 0);
|
||||||
cr.stroke();
|
cr.stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
};
|
const CpuIndicator = new Lang.Class({
|
||||||
|
Name: 'SystemMonitor.CpuIndicator',
|
||||||
function CpuIndicator() {
|
Extends: Indicator,
|
||||||
this._init();
|
|
||||||
}
|
|
||||||
|
|
||||||
CpuIndicator.prototype = {
|
|
||||||
__proto__: Indicator.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Indicator.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this.gridColor = '-grid-color';
|
this.gridColor = '-grid-color';
|
||||||
this.renderStats = [ 'cpu-user', 'cpu-sys', 'cpu-iowait' ];
|
this.renderStats = [ 'cpu-user', 'cpu-sys', 'cpu-iowait' ];
|
||||||
|
|
||||||
@@ -187,17 +182,15 @@ CpuIndicator.prototype = {
|
|||||||
|
|
||||||
this._prev = cpu;
|
this._prev = cpu;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function MemoryIndicator() {
|
const MemoryIndicator = new Lang.Class({
|
||||||
this._init();
|
Name: 'SystemMonitor.MemoryIndicator',
|
||||||
}
|
Extends: Indicator,
|
||||||
|
|
||||||
MemoryIndicator.prototype = {
|
|
||||||
__proto__: Indicator.prototype,
|
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
Indicator.prototype._init.call(this);
|
this.parent();
|
||||||
|
|
||||||
this.gridColor = '-grid-color';
|
this.gridColor = '-grid-color';
|
||||||
this.renderStats = [ 'mem-user', 'mem-other', 'mem-cached' ];
|
this.renderStats = [ 'mem-user', 'mem-other', 'mem-cached' ];
|
||||||
|
|
||||||
@@ -227,7 +220,7 @@ MemoryIndicator.prototype = {
|
|||||||
t += this.mem.cached / this.mem.total;
|
t += this.mem.cached / this.mem.total;
|
||||||
this.stats['mem-cached'].values.push(t);
|
this.stats['mem-cached'].values.push(t);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"shell-version": ["@shell_current@" ],
|
"shell-version": ["@shell_current@" ],
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"original-author": "zaspire@rambler.ru",
|
"original-author": "zaspire@rambler.ru",
|
||||||
"name": "SystemMonitor",
|
"name": "SystemMonitor",
|
||||||
"description": "System Monitor",
|
"description": "System Monitor",
|
||||||
|
|||||||
@@ -1,14 +1,5 @@
|
|||||||
EXTENSION_ID = user-theme
|
EXTENSION_ID = user-theme
|
||||||
|
|
||||||
include ../../extension.mk
|
include ../../extension.mk
|
||||||
|
include ../../settings.mk
|
||||||
|
|
||||||
gschemas_in = $(gschemabase).user-theme.gschema.xml.in
|
|
||||||
|
|
||||||
@INTLTOOL_XML_NOMERGE_RULE@
|
|
||||||
|
|
||||||
gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
|
|
||||||
|
|
||||||
@GSETTINGS_RULES@
|
|
||||||
|
|
||||||
CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
|
|
||||||
EXTRA_DIST += $(gschemas_in)
|
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ const Gio = imports.gi.Gio;
|
|||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.user-theme';
|
|
||||||
const SETTINGS_KEY = 'name';
|
const SETTINGS_KEY = 'name';
|
||||||
|
|
||||||
function ThemeManager() {
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
this._init.apply(this, arguments);
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
}
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
ThemeManager.prototype = {
|
const ThemeManager = new Lang.Class({
|
||||||
_init: function(metadata) {
|
Name: 'UserTheme.ThemeManager',
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
|
||||||
this._settings = me.convenience.getSettings(metadata, 'user-theme');
|
_init: function() {
|
||||||
|
this._settings = Convenience.getSettings();
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable: function() {
|
||||||
@@ -63,9 +63,8 @@ ThemeManager.prototype = {
|
|||||||
Main.setThemeStylesheet(_stylesheet);
|
Main.setThemeStylesheet(_stylesheet);
|
||||||
Main.loadTheme();
|
Main.loadTheme();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
function init() {
|
||||||
function init(metadata) {
|
return new ThemeManager();
|
||||||
return new ThemeManager(metadata);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "User Themes",
|
"name": "User Themes",
|
||||||
"description": "Load shell themes from user directory",
|
"description": "Load shell themes from user directory",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"shell-version": ["@shell_current@" ],
|
"shell-version": ["@shell_current@" ],
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"original-author": "zaspire@rambler.ru",
|
"original-author": "zaspire@rambler.ru",
|
||||||
"name": "windowNavigator",
|
"name": "windowNavigator",
|
||||||
"description": "Allow keyboard selection of windows and workspaces in overlay mode",
|
"description": "Allow keyboard selection of windows and workspaces in overlay mode",
|
||||||
|
|||||||
@@ -7,103 +7,115 @@ const PanelMenu = imports.ui.panelMenu;
|
|||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const Panel = imports.ui.panel;
|
const Panel = imports.ui.panel;
|
||||||
|
|
||||||
|
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
||||||
|
const _ = Gettext.gettext;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
|
|
||||||
function WorkspaceIndicator() {
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
this._init.apply(this, arguments);
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
}
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
WorkspaceIndicator.prototype = {
|
const WorkspaceIndicator = new Lang.Class({
|
||||||
__proto__: PanelMenu.SystemStatusButton.prototype,
|
Name: 'WorkspaceIndicator.WorkspaceIndicator',
|
||||||
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function(){
|
_init: function(){
|
||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'folder');
|
this.parent(0.0, _("Workspace Indicator"));
|
||||||
|
|
||||||
this._currentWorkspace = global.screen.get_active_workspace().index();
|
this._currentWorkspace = global.screen.get_active_workspace().index();
|
||||||
this.statusLabel = new St.Label({ text: this._labelText() });
|
this.statusLabel = new St.Label({ text: this._labelText() });
|
||||||
|
|
||||||
// destroy all previously created children, and add our statusLabel
|
this.actor.add_actor(this.statusLabel);
|
||||||
this.actor.get_children().forEach(function(c) { c.destroy() });
|
|
||||||
this.actor.add_actor(this.statusLabel);
|
|
||||||
|
|
||||||
this.workspacesItems = [];
|
this.workspacesItems = [];
|
||||||
this._workspaceSection = new PopupMenu.PopupMenuSection();
|
this._workspaceSection = new PopupMenu.PopupMenuSection();
|
||||||
this.menu.addMenuItem(this._workspaceSection);
|
this.menu.addMenuItem(this._workspaceSection);
|
||||||
global.screen.connect_after('workspace-added', Lang.bind(this,this._createWorkspacesSection));
|
|
||||||
global.screen.connect_after('workspace-removed', Lang.bind(this,this._createWorkspacesSection));
|
|
||||||
global.screen.connect_after('workspace-switched', Lang.bind(this,this._updateIndicator));
|
|
||||||
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
|
||||||
this._createWorkspacesSection();
|
|
||||||
|
|
||||||
//styling
|
this._screenSignals = [];
|
||||||
this.menu.actor.add_style_class_name('workspace-indicator-shorter');
|
this._screenSignals.push(global.screen.connect_after('workspace-added', Lang.bind(this,this._createWorkspacesSection)));
|
||||||
this.statusLabel.add_style_class_name('panel-workspace-indicator');
|
this._screenSignals.push(global.screen.connect_after('workspace-removed', Lang.bind(this,this._createWorkspacesSection)));
|
||||||
},
|
this._screenSignals.push(global.screen.connect_after('workspace-switched', Lang.bind(this,this._updateIndicator)));
|
||||||
|
|
||||||
_updateIndicator: function() {
|
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
|
||||||
this.workspacesItems[this._currentWorkspace].setShowDot(false);
|
this._createWorkspacesSection();
|
||||||
this._currentWorkspace = global.screen.get_active_workspace().index();
|
|
||||||
this.workspacesItems[this._currentWorkspace].setShowDot(true);
|
|
||||||
|
|
||||||
this.statusLabel.set_text(this._labelText());
|
//styling
|
||||||
},
|
this.menu.actor.add_style_class_name('workspace-indicator-shorter');
|
||||||
|
this.statusLabel.add_style_class_name('panel-workspace-indicator');
|
||||||
|
},
|
||||||
|
|
||||||
_labelText : function(workspaceIndex) {
|
destroy: function() {
|
||||||
if(workspaceIndex == undefined) {
|
for (let i = 0; i < this._screenSignals.length; i++)
|
||||||
workspaceIndex = this._currentWorkspace;
|
global.screen.disconnect(this._screenSignals[i]);
|
||||||
return (workspaceIndex + 1).toString();
|
|
||||||
}
|
|
||||||
return Meta.prefs_get_workspace_name(workspaceIndex);
|
|
||||||
},
|
|
||||||
|
|
||||||
_createWorkspacesSection : function() {
|
this.parent();
|
||||||
this._workspaceSection.removeAll();
|
},
|
||||||
this.workspacesItems = [];
|
|
||||||
this._currentWorkspace = global.screen.get_active_workspace().index();
|
|
||||||
|
|
||||||
let i = 0;
|
_updateIndicator: function() {
|
||||||
for(; i < global.screen.n_workspaces; i++) {
|
this.workspacesItems[this._currentWorkspace].setShowDot(false);
|
||||||
this.workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i));
|
this._currentWorkspace = global.screen.get_active_workspace().index();
|
||||||
this._workspaceSection.addMenuItem(this.workspacesItems[i]);
|
this.workspacesItems[this._currentWorkspace].setShowDot(true);
|
||||||
this.workspacesItems[i].workspaceId = i;
|
|
||||||
this.workspacesItems[i].label_actor = this.statusLabel;
|
|
||||||
let self = this;
|
|
||||||
this.workspacesItems[i].connect('activate', Lang.bind(this, function(actor, event) {
|
|
||||||
this._activate(actor.workspaceId);
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (i == this._currentWorkspace)
|
this.statusLabel.set_text(this._labelText());
|
||||||
this.workspacesItems[i].setShowDot(true);
|
},
|
||||||
}
|
|
||||||
|
|
||||||
this.statusLabel.set_text(this._labelText());
|
_labelText : function(workspaceIndex) {
|
||||||
},
|
if(workspaceIndex == undefined) {
|
||||||
|
workspaceIndex = this._currentWorkspace;
|
||||||
|
return (workspaceIndex + 1).toString();
|
||||||
|
}
|
||||||
|
return Meta.prefs_get_workspace_name(workspaceIndex);
|
||||||
|
},
|
||||||
|
|
||||||
_activate : function (index) {
|
_createWorkspacesSection : function() {
|
||||||
if(index >= 0 && index < global.screen.n_workspaces) {
|
this._workspaceSection.removeAll();
|
||||||
let metaWorkspace = global.screen.get_workspace_by_index(index);
|
this.workspacesItems = [];
|
||||||
metaWorkspace.activate(true);
|
this._currentWorkspace = global.screen.get_active_workspace().index();
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_onScrollEvent : function(actor, event) {
|
let i = 0;
|
||||||
let direction = event.get_scroll_direction();
|
for(; i < global.screen.n_workspaces; i++) {
|
||||||
let diff = 0;
|
this.workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i));
|
||||||
if (direction == Clutter.ScrollDirection.DOWN) {
|
this._workspaceSection.addMenuItem(this.workspacesItems[i]);
|
||||||
diff = 1;
|
this.workspacesItems[i].workspaceId = i;
|
||||||
} else if (direction == Clutter.ScrollDirection.UP) {
|
this.workspacesItems[i].label_actor = this.statusLabel;
|
||||||
diff = -1;
|
let self = this;
|
||||||
} else {
|
this.workspacesItems[i].connect('activate', Lang.bind(this, function(actor, event) {
|
||||||
return;
|
this._activate(actor.workspaceId);
|
||||||
}
|
}));
|
||||||
|
|
||||||
let newIndex = global.screen.get_active_workspace().index() + diff;
|
if (i == this._currentWorkspace)
|
||||||
this._activate(newIndex);
|
this.workspacesItems[i].setShowDot(true);
|
||||||
},
|
}
|
||||||
}
|
|
||||||
|
this.statusLabel.set_text(this._labelText());
|
||||||
|
},
|
||||||
|
|
||||||
|
_activate : function (index) {
|
||||||
|
if(index >= 0 && index < global.screen.n_workspaces) {
|
||||||
|
let metaWorkspace = global.screen.get_workspace_by_index(index);
|
||||||
|
metaWorkspace.activate(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_onScrollEvent : function(actor, event) {
|
||||||
|
let direction = event.get_scroll_direction();
|
||||||
|
let diff = 0;
|
||||||
|
if (direction == Clutter.ScrollDirection.DOWN) {
|
||||||
|
diff = 1;
|
||||||
|
} else if (direction == Clutter.ScrollDirection.UP) {
|
||||||
|
diff = -1;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let newIndex = global.screen.get_active_workspace().index() + diff;
|
||||||
|
this._activate(newIndex);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function init(meta) {
|
function init(meta) {
|
||||||
// empty
|
Convenience.initTranslations();
|
||||||
}
|
}
|
||||||
|
|
||||||
let _indicator;
|
let _indicator;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Workspace Indicator",
|
"name": "Workspace Indicator",
|
||||||
"description": "Put an indicator on the panel signaling in which workspace you are, and give you the possibility of switching to another one",
|
"description": "Put an indicator on the panel signaling in which workspace you are, and give you the possibility of switching to another one",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
|||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
const N_ = function(e) { return e };
|
const N_ = function(e) { return e };
|
||||||
|
|
||||||
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
|
const Me = ExtensionUtils.getCurrentExtension();
|
||||||
|
const Convenience = Me.imports.convenience;
|
||||||
|
|
||||||
const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0,
|
const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0,
|
||||||
GnomeDesktop.RRRotation.ROTATION_90,
|
GnomeDesktop.RRRotation.ROTATION_90,
|
||||||
GnomeDesktop.RRRotation.ROTATION_180,
|
GnomeDesktop.RRRotation.ROTATION_180,
|
||||||
@@ -137,8 +141,7 @@ Indicator.prototype = {
|
|||||||
|
|
||||||
|
|
||||||
function init(metadata) {
|
function init(metadata) {
|
||||||
let me = imports.ui.extensionSystem.extensions[metadata.uuid];
|
Convenience.initTranslations();
|
||||||
me.convenience.initTranslations(metadata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let _indicator;
|
let _indicator;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extension-id": "@extension_id@",
|
||||||
"uuid": "@uuid@",
|
"uuid": "@uuid@",
|
||||||
|
"settings-schema": "@gschemaname@",
|
||||||
|
"gettext-domain": "@gettext_domain@",
|
||||||
"name": "Monitor Status Indicator",
|
"name": "Monitor Status Indicator",
|
||||||
"description": "Add a systems status menu for rotating monitors (overrides what is currently provided by gnome-settings-daemon)",
|
"description": "Add a systems status menu for rotating monitors (overrides what is currently provided by gnome-settings-daemon)",
|
||||||
"shell-version": [ "@shell_current@" ],
|
"shell-version": [ "@shell_current@" ],
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ extensionbase = @gnome-shell-extensions.gcampax.github.com
|
|||||||
gschemabase = org.gnome.shell.extensions
|
gschemabase = org.gnome.shell.extensions
|
||||||
|
|
||||||
uuid = $(EXTENSION_ID)$(extensionbase)
|
uuid = $(EXTENSION_ID)$(extensionbase)
|
||||||
|
gschemaname = $(gschemabase).$(EXTENSION_ID)
|
||||||
|
|
||||||
extensiondir = $(topextensiondir)/$(uuid)
|
extensiondir = $(topextensiondir)/$(uuid)
|
||||||
|
|||||||
+37
-9
@@ -1,17 +1,45 @@
|
|||||||
|
/* -*- mode: js; js-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||||
|
|
||||||
const Gettext = imports.gettext;
|
const Gettext = imports.gettext;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
|
|
||||||
function initTranslations(metadata) {
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
let localeDir = metadata.dir.get_child('locale').get_path();
|
|
||||||
Gettext.bindtextdomain('gnome-shell-extensions', localeDir);
|
/**
|
||||||
|
* initTranslations:
|
||||||
|
* @domain: (optional): the gettext domain to use
|
||||||
|
*
|
||||||
|
* Initialize Gettext to load translations from extensionsdir/locale.
|
||||||
|
* If @domain is not provided, it will be taken from metadata['gettext-domain']
|
||||||
|
*/
|
||||||
|
function initTranslations(domain) {
|
||||||
|
let extension = ExtensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
domain = domain || extension.metadata['gettext-domain'];
|
||||||
|
|
||||||
|
let localeDir = extension.dir.get_child('locale').get_path();
|
||||||
|
Gettext.bindtextdomain(domain, localeDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSettings(metadata, extension_id) {
|
/**
|
||||||
let schemaDir = metadata.dir.get_child('schemas').get_path();
|
* getSettings:
|
||||||
|
* @schema: (optional): the GSettings schema id
|
||||||
|
*
|
||||||
|
* Builds and return a GSettings schema for @schema, using schema files
|
||||||
|
* in extensionsdir/schemas. If @schema is not provided, it is taken from
|
||||||
|
* metadata['settings-schema'].
|
||||||
|
*/
|
||||||
|
function getSettings(schema) {
|
||||||
|
let extension = ExtensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
schema = schema || extension.metadata['settings-schema'];
|
||||||
|
|
||||||
|
let schemaDir = extension.dir.get_child('schemas').get_path();
|
||||||
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(schemaDir,
|
let schemaSource = Gio.SettingsSchemaSource.new_from_directory(schemaDir,
|
||||||
Gio.SettingsSchemaSource.get_default(),
|
Gio.SettingsSchemaSource.get_default(),
|
||||||
false);
|
false);
|
||||||
let schema = schemaSource.lookup('org.gnome.shell.extensions.' + extension_id, false);
|
let schemaObj = schemaSource.lookup(schema, false);
|
||||||
return new Gio.Settings({ settings_schema: schema });
|
|
||||||
|
return new Gio.Settings({ settings_schema: schemaObj });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
gschemas_in = $(gschemaname).gschema.xml.in
|
||||||
|
|
||||||
|
@INTLTOOL_XML_NOMERGE_RULE@
|
||||||
|
|
||||||
|
gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
|
||||||
|
|
||||||
|
@GSETTINGS_RULES@
|
||||||
|
|
||||||
|
CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
|
||||||
|
EXTRA_DIST += $(gschemas_in)
|
||||||
Reference in New Issue
Block a user