Compare commits

...

19 Commits

Author SHA1 Message Date
Giovanni Campagna 41ec4150e5 Release 2.91.91
To go with GNOME Shell 2.91.91.
2011-03-08 15:46:10 +01:00
Giovanni Campagna 984e755ee6 Dock: lower the actor to the bottom
Unless overridden manually, Clutter places actors at the top, which
means the dock is painted above both the status menu and summary
notifications.
2011-02-26 16:43:15 +01:00
Giovanni Campagna fbbe5ba764 Add url property in the metadata
GNOME Shell emits a warning when "url" is absent in metadata.json,
adding it costs nothing. Links to the GIT repository because I
found no better page to reference.
2011-02-26 16:41:52 +01:00
Giovanni Campagna a7d59970cb Bump version to 2.91.90
Tracking current version of GNOME Shell, released yesteday.
Also, build fix to ensure that metadata.json is rebuilt correctly.
2011-02-23 19:01:02 +01:00
Giovanni Campagna 4e12738df2 AutoMoveWindows: override Main._checkWorkspace
Modify workspace management to only remove empty workspaces at end,
which is more consistent with a fixed workspace layout.
Also, some whitespace cleanup.

Patch provided by Thomas Bouffon <thomas.bouffon@gmail.com>
2011-02-23 19:00:39 +01:00
Giovanni Campagna 349d1f5e52 AlternateTab: make it work with the mouse.
Patch provided by Thomas Bouffon <thomas.bouffon@gmail.com>
2011-02-23 18:22:08 +01:00
Giovanni Campagna b289b0fdee Dock: more fixes for 2.91.6
Fix the behavior of the PopupMenu after the conversion of
St.Clickable to St.Button, and fix the invocation of ShellApp.open_new_window(),
which now accepts a workspace index as a number (as a side effect,
"New window" means one the current workspace now).
2011-02-20 18:42:30 +01:00
Giovanni Campagna e7c2d2c277 auto-move-windows: fix off-by-one error
The internal workspace index starts from 0, but the one in the
settings starts from 1.
2011-02-20 18:41:47 +01:00
Giovanni Campagna f62424e9bb [i18n] Updated italian translation 2011-02-20 18:06:02 +01:00
Giovanni Campagna f92addbbf6 Minor fixes
Fix the translation of xrandr-indicator, make the dock translatable
and correct the original author of auto-move-windows.
2011-02-20 17:50:40 +01:00
Giovanni Campagna 53384f9eaf AutoMoveWindows: try harder to get an application for a window
First of all, remove windows that are not interesting (like popup
menus and tooltips). Then, queue once an idle if the app is null,
in the hope that ShellWindowTracker picks up the window.
2011-02-19 20:33:51 +01:00
Giovanni Campagna e12ff1b6f9 Dock: remove commented out code
It is all in GIT history now.
2011-02-19 20:33:22 +01:00
Giovanni Campagna 586d72f1fe Add dock extension
Add an extension which shows a dock on the right, contributed by
Tor-björn Claesson.
2011-02-19 20:31:03 +01:00
Giovanni Campagna 7a4e22feec Build system: fix, and make quieter
Fix for make distcheck.
At the same time, use silent rules when expanding metadata.json.
2011-02-19 18:54:57 +01:00
Giovanni Campagna b730d7f97e XrandrIndicator: update for API change in GnomeRR
The API in GnomeRR was changed when it was merged, and noone ever
noticed in this extension.
2011-02-19 18:49:46 +01:00
Giovanni Campagna ecd7c1754d AutoMoveWindows: new extension
Introduce a new extensions that allows to manage your workspaces
more easily, assigning a specific workspace to each application,
as soon as it creates a windows, in manner configurable with a
GSettings key.
2011-02-19 18:39:38 +01:00
Giovanni Campagna 951d59ba15 Force the existance of config/ and m4/ when cloning from git.
intltoolize requires a m4/ folder, and automake requires config/
for its scripts, so when need to make sure they're present even
when building from git.
2011-02-19 14:43:30 +01:00
Giovanni Campagna 2962768a6f Make extensions translatable
Introduce a translation domain, gnome-shell-extensions, and use it
in extensions that have user-facing strings, instead of abusing
of translations provided by gnome-shell.
Also includes an example translation for italian, and bump the
required version for xrandr-indicator.

Depends on GNOME bug 621017.
2011-02-07 23:06:33 +01:00
Giovanni Campagna aaf2057725 Build system: generate metadata.json
Instead of hardcoding metadata.json, generate it from .in files,
adding installation prefixes, current target version and configured
uuid.
2011-02-07 22:52:42 +01:00
26 changed files with 829 additions and 40 deletions
+7 -2
View File
@@ -4,10 +4,15 @@ Makefile.in.in
configure configure
config.log config.log
config.status config.status
config/
aclocal.m4 aclocal.m4
autom4te.cache/ autom4te.cache/
m4/ po/gnome-shell-extensions.pot
po/POTFILES po/POTFILES
po/stamp-it po/stamp-it
staging/ staging/
*~
*.gmo
metadata.json
*.gschema.xml
*.gschema.valid
+3
View File
@@ -0,0 +1,3 @@
install-sh
mkinstalldirs
missing
+12 -7
View File
@@ -1,10 +1,10 @@
AC_PREREQ(2.63) AC_PREREQ(2.63)
AC_INIT([gnome-shell-extensions],[2.91.6],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&component=extensions]) AC_INIT([gnome-shell-extensions],[2.91.91],[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])
AM_INIT_AUTOMAKE([1.10 dist-bzip2 no-dist-gzip foreign]) AM_INIT_AUTOMAKE([1.10 dist-bzip2 no-dist-gzip foreign tar-ustar])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
@@ -16,10 +16,12 @@ IT_PROG_INTLTOOL(0.26)
PKG_PROG_PKG_CONFIG([0.22]) PKG_PROG_PKG_CONFIG([0.22])
GLIB_GSETTINGS
ADDITIONAL_PACKAGES= ADDITIONAL_PACKAGES=
dnl keep this in sync with extensions/Makefile.am dnl keep this in sync with extensions/Makefile.am
ALL_EXTENSIONS="example alternate-tab xrandr-indicator windowsNavigator" ALL_EXTENSIONS="example alternate-tab xrandr-indicator windowsNavigator auto-move-windows dock"
AC_ARG_ENABLE([extensions], AC_ARG_ENABLE([extensions],
[AS_HELP_STRING([--enable-extensions],[Space separated list of extensions to enable. Default is that all extensions are built.])], [AS_HELP_STRING([--enable-extensions],[Space separated list of extensions to enable. Default is that all extensions are built.])],
[], [],
@@ -32,7 +34,7 @@ for e in $enable_extensions; do
ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e" ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e"
ADDITIONAL_PACKAGES="gnome-desktop-3.0 >= 2.91.6" ADDITIONAL_PACKAGES="gnome-desktop-3.0 >= 2.91.6"
;; ;;
alternate-tab|example|windowsNavigator) alternate-tab|example|windowsNavigator|auto-move-windows|dock)
ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e" ENABLED_EXTENSIONS="$ENABLED_EXTENSIONS $e"
;; ;;
*) *)
@@ -49,13 +51,16 @@ if test "x$ADDITIONAL_PACKAGES" != x; then
PKG_CHECK_MODULES(ADDITIONAL, [$ADDITIONAL_PACKAGES]) PKG_CHECK_MODULES(ADDITIONAL, [$ADDITIONAL_PACKAGES])
fi fi
dnl Please keep this sorted alphabetically
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile
extensions/Makefile
extensions/example/Makefile
extensions/alternate-tab/Makefile extensions/alternate-tab/Makefile
extensions/auto-move-windows/Makefile
extensions/dock/Makefile
extensions/example/Makefile
extensions/windowsNavigator/Makefile extensions/windowsNavigator/Makefile
extensions/xrandr-indicator/Makefile extensions/xrandr-indicator/Makefile
extensions/Makefile
Makefile
po/Makefile.in po/Makefile.in
]) ])
AC_OUTPUT AC_OUTPUT
+17 -5
View File
@@ -1,10 +1,22 @@
extensionurl = http://git.gnome.org/gnome-shell-extensions
# Change these to modify how installation is performed # Change these to modify how installation is performed
# If you modify extensionbase, you also need to modify
# metadata.json of each extension
topextensiondir = $(datadir)/gnome-shell/extensions topextensiondir = $(datadir)/gnome-shell/extensions
extensionbase = @gnome-shell-extensions.gnome.org extensionbase = @gnome-shell-extensions.gnome.org
extensiondir = $(topextensiondir)/$(EXTENSION_ID)$(extensionbase) uuid = $(EXTENSION_ID)$(extensionbase)
dist_extension_DATA = metadata.json extension.js stylesheet.css extensiondir = $(topextensiondir)/$(uuid)
nodist_extension_DATA = $(EXTRA_EXTENSION)
dist_extension_DATA = extension.js stylesheet.css
nodist_extension_DATA = metadata.json $(EXTRA_EXTENSION)
EXTRA_DIST = metadata.json.in
metadata.json: metadata.json.in $(top_builddir)/config.status
$(AM_V_GEN) sed -e "s|[@]LOCALEDIR@|$(datadir)/locale|" \
-e "s|[@]uuid@|$(uuid)|" \
-e "s|[@]shell_current@|$(PACKAGE_VERSION)|" \
-e "s|[@]url@|$(extensionurl)|" $< > $@
CLEANFILES = metadata.json
+1 -1
View File
@@ -1,3 +1,3 @@
DIST_SUBDIRS = example alternate-tab xrandr-indicator windowsNavigator DIST_SUBDIRS = example alternate-tab xrandr-indicator windowsNavigator auto-move-windows dock
SUBDIRS = $(ENABLED_EXTENSIONS) SUBDIRS = $(ENABLED_EXTENSIONS)
+1
View File
@@ -92,6 +92,7 @@ AltTabPopup2.prototype = {
this.actor.connect('scroll-event', Lang.bind(this, this._onScroll)); this.actor.connect('scroll-event', Lang.bind(this, this._onScroll));
this._appSwitcher = new WindowList(windows); this._appSwitcher = new WindowList(windows);
this._appSwitcher._altTabPopup=this;
this._appSwitcher.highlight(0,false); this._appSwitcher.highlight(0,false);
this.actor.add_actor(this._appSwitcher.actor); this.actor.add_actor(this._appSwitcher.actor);
this._appSwitcher.connect('item-activated', Lang.bind(this, this._appActivated)); this._appSwitcher.connect('item-activated', Lang.bind(this, this._appActivated));
@@ -1,7 +1,9 @@
{ {
"uuid": "alternate-tab@gnome-shell-extensions.gnome.org", "uuid": "@uuid@",
"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-author": "thomas.bouffon@gmail.com", "original-author": "thomas.bouffon@gmail.com",
"shell-version": [ "2.91.5", "2.91.6" ] "shell-version": [ "2.91.5", "@shell_current@" ],
"localedir": "@LOCALEDIR@",
"url": "@url@"
} }
+14
View File
@@ -0,0 +1,14 @@
EXTENSION_ID = auto-move-windows
include ../../extension.mk
gschemas_in = org.gnome.shell.extensions.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)
+109
View File
@@ -0,0 +1,109 @@
// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*-
// Start apps on custom workspaces
const Glib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Main = imports.ui.main;
const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.auto-move-windows';
const SETTINGS_KEY = 'application-list';
function WindowMover() {
this._init();
}
WindowMover.prototype = {
_init: function() {
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
this._windowTracker = Shell.WindowTracker.get_default();
let display = global.screen.get_display();
// Connect after so the handler from ShellWindowTracker has already run
display.connect_after('window-created', Lang.bind(this, this._findAndMove));
},
_ensureAtLeastWorkspaces: function(num, window) {
for (let j = global.screen.n_workspaces; j <= num; j++) {
window.change_workspace_by_index(j-1, false, global.get_current_time());
global.screen.append_new_workspace(false, 0);
}
},
_findAndMove: function(display, window, noRecurse) {
if (!this._windowTracker.is_window_interesting(window))
return;
let spaces = this._settings.get_strv(SETTINGS_KEY);
let app = this._windowTracker.get_window_app(window);
if (!app) {
if (!noRecurse) {
// window is not tracked yet
Mainloop.idle_add(Lang.bind(this, function() {
this._findAndMove(display, window, true);
return false;
}));
} else
log ('Cannot find application for window');
return;
}
let app_id = app.get_id();
for ( let j = 0 ; j < spaces.length; j++ ) {
let apps_to_space = spaces[j].split(":");
// Match application id
if (apps_to_space[0] == app_id) {
let workspace_num = parseInt(apps_to_space[1]) - 1;
if (workspace_num >= global.screen.n_workspaces)
this._ensureAtLeastWorkspaces(workspace_num, window);
window.change_workspace_by_index(workspace_num, false, global.get_current_time());
}
}
}
}
function main(extensionMeta) {
Main._checkWorkspaces = function() {
let i;
let emptyWorkspaces = new Array(Main._workspaces.length);
for (i = 0; i < Main._workspaces.length; i++)
emptyWorkspaces[i] = true;
let windows = global.get_window_actors();
for (i = 0; i < windows.length; i++) {
let win = windows[i];
if (win.get_meta_window().is_on_all_workspaces())
continue;
let workspaceIndex = win.get_workspace();
emptyWorkspaces[workspaceIndex] = false;
}
// If we don't have an empty workspace at the end, add one
if (!emptyWorkspaces[emptyWorkspaces.length -1]) {
global.screen.append_new_workspace(false, global.get_current_time());
emptyWorkspaces.push(false);
}
// Delete other empty workspaces; do it from the end to avoid index changes
for (i = emptyWorkspaces.length - 2; i >= 0; i--) {
if (emptyWorkspaces[i])
global.screen.remove_workspace(Main._workspaces[i], global.get_current_time());
else
break;
}
Main._checkWorkspacesId = 0;
return false;
};
new WindowMover();
}
@@ -0,0 +1,9 @@
{
"uuid": "@uuid@",
"name": "Auto Move Windows",
"description": "Move applications to specific workspaces when they create windows",
"shell-version": [ "@shell_current@" ],
"localedir": "@LOCALEDIR@",
"original-authors": [ "alessandro.crismani@gmail.com", "thomas.bouffon@gmail.com" ],
"url": "@url@"
}
@@ -0,0 +1,10 @@
<schemalist gettext-domain="gnome-shell-extensions">
<schema id="org.gnome.shell.extensions.auto-move-windows" path="/org/gnome/shell/extensions/auto-move-windows/">
<key name="application-list" type="as">
<!-- FIXME: should be a(su), when JS supports more of GVariant -->
<default>[ ]</default>
<_summary>Application and workspace list</_summary>
<_description>A list of strings, each containing an application id (desktop file name), followed by a colon and the workspace number</_description>
</key>
</schema>
</schemalist>
@@ -0,0 +1 @@
/* This extensions requires no special styling */
+3
View File
@@ -0,0 +1,3 @@
EXTENSION_ID = dock
include ../../extension.mk
+456
View File
@@ -0,0 +1,456 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
const Pango = imports.gi.Pango;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Shell = imports.gi.Shell;
const Lang = imports.lang;
const Signals = imports.signals;
const St = imports.gi.St;
const Mainloop = imports.mainloop;
const AppFavorites = imports.ui.appFavorites;
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const Overview = imports.ui.overview;
const PopupMenu = imports.ui.popupMenu;
const Search = imports.ui.search;
const Tweener = imports.ui.tweener;
const Workspace = imports.ui.workspace;
const AppDisplay = imports.ui.appDisplay;
const AltTab = imports.ui.altTab;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
const DOCKICON_SIZE = 48;
const DND_RAISE_APP_TIMEOUT = 500;
function Dock() {
this._init();
}
Dock.prototype = {
_init : function() {
this._placeholderText = null;
this._menus = [];
this._menuDisplays = [];
this._favorites = [];
this._spacing = 4;
this._item_size = DOCKICON_SIZE;
this.actor = new St.BoxLayout({ name: 'dock', vertical: true, reactive: true });
this._grid = new Shell.GenericContainer();
this.actor.add(this._grid, { expand: true, y_align: St.Align.START });
this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged));
this._grid.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this._grid.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
this._grid.connect('allocate', Lang.bind(this, this._allocate));
this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
this._tracker = Shell.WindowTracker.get_default();
this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', Lang.bind(this, this._queueRedisplay));
AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay));
this._tracker.connect('app-state-changed', Lang.bind(this, this._queueRedisplay));
Main.chrome.addActor(this.actor, { visibleInOverview: false });
this.actor.lower_bottom();
},
_appIdListToHash: function(apps) {
let ids = {};
for (let i = 0; i < apps.length; i++)
ids[apps[i].get_id()] = apps[i];
return ids;
},
_queueRedisplay: function () {
Main.queueDeferredWork(this._workId);
},
_redisplay: function () {
this.removeAll();
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
/* hardcode here pending some design about how exactly desktop contexts behave */
let contextId = '';
let running = this._tracker.get_running_apps(contextId);
let runningIds = this._appIdListToHash(running);
let icons = 0;
let nFavorites = 0;
for (let id in favorites) {
let app = favorites[id];
let display = new DockIcon(app);
this.addItem(display.actor);
nFavorites++;
icons++;
}
for (let i = 0; i < running.length; i++) {
let app = running[i];
if (app.get_id() in favorites)
continue;
let display = new DockIcon(app);
icons++;
this.addItem(display.actor);
}
if (this._placeholderText) {
this._placeholderText.destroy();
this._placeholderText = null;
}
if (running.length == 0 && nFavorites == 0) {
this._placeholderText = new St.Label({ text: _("Drag here to add favorites") });
this.actor.add_actor(this._placeholderText);
}
let primary = global.get_primary_monitor();
let height = (icons)*(this._item_size + this._spacing) + 2*this._spacing;
this.actor.set_size(this._item_size + 4*this._spacing, height);
this.actor.set_position(primary.width-this._item_size-this._spacing-2, (primary.height-height)/2);
},
_getPreferredWidth: function (grid, forHeight, alloc) {
alloc.min_size = this._item_size;
alloc.natural_size = this._item_size + this._spacing;
},
_getPreferredHeight: function (grid, forWidth, alloc) {
let children = this._grid.get_children();
let nRows = children.length;
let totalSpacing = Math.max(0, nRows - 1) * this._spacing;
let height = nRows * this._item_size + totalSpacing;
alloc.min_size = height;
alloc.natural_size = height;
},
_allocate: function (grid, box, flags) {
let children = this._grid.get_children();
let x = box.x1 + this._spacing;
let y = box.y1 + this._spacing;
for (let i = 0; i < children.length; i++) {
let childBox = new Clutter.ActorBox();
childBox.x1 = x;
childBox.y1 = y;
childBox.x2 = childBox.x1 + this._item_size;
childBox.y2 = childBox.y1 + this._item_size;
children[i].allocate(childBox, flags);
y += this._item_size + this._spacing;
}
},
_onStyleChanged: function() {
let themeNode = this.actor.get_theme_node();
let [success, len] = themeNode.get_length('spacing', false);
if (success)
this._spacing = len;
[success, len] = themeNode.get_length('-shell-grid-item-size', false);
if (success)
this._item_size = len;
this._grid.queue_relayout();
},
removeAll: function () {
this._grid.get_children().forEach(Lang.bind(this, function (child) {
child.destroy();
}));
},
addItem: function(actor) {
this._grid.add_actor(actor);
}
};
Signals.addSignalMethods(Dock.prototype);
function DockIcon(app) {
this._init(app);
}
DockIcon.prototype = {
_init : function(app) {
this.app = app;
this.actor = new St.Button({ style_class: 'dock-app',
button_mask: St.ButtonMask.ONE | St.ButtonMask.TWO,
reactive: true,
x_fill: true,
y_fill: true });
this.actor._delegate = this;
this.actor.set_size(DOCKICON_SIZE, DOCKICON_SIZE);
this._icon = this.app.create_icon_texture(DOCKICON_SIZE);
this.actor.set_child(this._icon);
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
this._menu = null;
this._menuManager = new PopupMenu.PopupMenuManager(this);
this._has_focus = false;
let tracker = Shell.WindowTracker.get_default();
tracker.connect('notify::focus-app', Lang.bind(this, this._onStateChanged));
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.connect('notify::hover', Lang.bind(this, this._hoverChanged));
this._menuTimeoutId = 0;
this._stateChangedId = this.app.connect('notify::state',
Lang.bind(this, this._onStateChanged));
this._onStateChanged();
},
_onDestroy: function() {
if (this._stateChangedId > 0)
this.app.disconnect(this._stateChangedId);
this._stateChangedId = 0;
this._removeMenuTimeout();
},
_removeMenuTimeout: function() {
if (this._menuTimeoutId > 0) {
Mainloop.source_remove(this._menuTimeoutId);
this._menuTimeoutId = 0;
}
},
_hoverChanged: function(actor) {
if (actor != this.actor)
this._has_focus = false;
else
this._has_focus = true;
return false;
},
_onStateChanged: function() {
let tracker = Shell.WindowTracker.get_default();
let focusedApp = tracker.focus_app;
if (this.app.state != Shell.AppState.STOPPED) {
this.actor.add_style_class_name('running');
if (this.app == focusedApp) {
this.actor.add_style_class_name('focused');
} else {
this.actor.remove_style_class_name('focused');
}
} else {
this.actor.remove_style_class_name('focused');
this.actor.remove_style_class_name('running');
}
},
_onButtonPress: function(actor, event) {
let button = event.get_button();
if (button == 1) {
this._removeMenuTimeout();
this._menuTimeoutId = Mainloop.timeout_add(AppDisplay.MENU_POPUP_TIMEOUT, Lang.bind(this, function() {
this.popupMenu();
}));
} else if (button == 3) {
this.popupMenu();
}
},
_onClicked: function(actor, button) {
this._removeMenuTimeout();
if (button == 1) {
this._onActivate(Clutter.get_current_event());
} else if (button == 2) {
// Last workspace is always empty
let launchWorkspace = global.screen.get_workspace_by_index(global.screen.n_workspaces - 1);
launchWorkspace.activate(global.get_current_time());
this.emit('launching');
this.app.open_new_window(-1);
}
return false;
},
getId: function() {
return this.app.get_id();
},
popupMenu: function() {
this._removeMenuTimeout();
this.actor.fake_release();
if (!this._menu) {
this._menu = new DockIconMenu(this);
this._menu.connect('activate-window', Lang.bind(this, function (menu, window) {
this.activateWindow(window);
}));
this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) {
if (!isPoppedUp)
this._onMenuPoppedDown();
}));
this._menuManager.addMenu(this._menu, true);
}
this._menu.popup();
return false;
},
activateWindow: function(metaWindow) {
if (metaWindow) {
this._didActivateWindow = true;
Main.activateWindow(metaWindow);
}
},
setSelected: function (isSelected) {
this._selected = isSelected;
if (this._selected)
this.actor.add_style_class_name('selected');
else
this.actor.remove_style_class_name('selected');
},
_onMenuPoppedDown: function() {
this.actor.sync_hover();
},
_getRunning: function() {
return this.app.state != Shell.AppState.STOPPED;
},
_onActivate: function (event) {
this.emit('launching');
let modifiers = Shell.get_event_state(event);
if (modifiers & Clutter.ModifierType.CONTROL_MASK
&& this.app.state == Shell.AppState.RUNNING) {
let current_workspace = global.screen.get_active_workspace().index();
this.app.open_new_window(current_workspace);
} else {
let tracker = Shell.WindowTracker.get_default();
let focusedApp = tracker.focus_app;
if (this.app == focusedApp) {
let windows = this.app.get_windows();
let current_workspace = global.screen.get_active_workspace();
for (let i = 0; i < windows.length; i++) {
let w = windows[i];
if (w.get_workspace() == current_workspace)
w.minimize();
}
} else {
this.app.activate(-1);
}
}
Main.overview.hide();
},
shellWorkspaceLaunch : function() {
this.app.open_new_window();
}
};
Signals.addSignalMethods(DockIcon.prototype);
function DockIconMenu(source) {
this._init(source);
}
DockIconMenu.prototype = {
__proto__: AppDisplay.AppIconMenu.prototype,
_init: function(source) {
PopupMenu.PopupMenu.prototype._init.call(this, source.actor, St.Align.MIDDLE, St.Side.RIGHT, 0);
this._source = source;
this.connect('activate', Lang.bind(this, this._onActivate));
this.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
this.actor.add_style_class_name('dock-menu');
// Chain our visibility and lifecycle to that of the source
source.actor.connect('notify::mapped', Lang.bind(this, function () {
if (!source.actor.mapped)
this.close();
}));
source.actor.connect('destroy', Lang.bind(this, function () { this.actor.destroy(); }));
Main.chrome.addActor(this.actor);
},
_redisplay: function() {
this.removeAll();
let windows = this._source.app.get_windows();
// Display the app windows menu items and the separator between windows
// of the current desktop and other windows.
let activeWorkspace = global.screen.get_active_workspace();
let separatorShown = windows.length > 0 && windows[0].get_workspace() != activeWorkspace;
for (let i = 0; i < windows.length; i++) {
if (!separatorShown && windows[i].get_workspace() != activeWorkspace) {
this._appendSeparator();
separatorShown = true;
}
let item = this._appendMenuItem(windows[i].title);
item._window = windows[i];
}
if (windows.length > 0)
this._appendSeparator();
let isFavorite = AppFavorites.getAppFavorites().isFavorite(this._source.app.get_id());
this._newWindowMenuItem = windows.length > 0 ? this._appendMenuItem(_("New Window")) : null;
this._quitAppMenuItem = windows.length >0 ? this._appendMenuItem(_("Quit Application")) : null;
if (windows.length > 0)
this._appendSeparator();
this._toggleFavoriteMenuItem = this._appendMenuItem(isFavorite ?
_("Remove from Favorites")
: _("Add to Favorites"));
this._highlightedItem = null;
},
_onActivate: function (actor, child) {
if (child._window) {
let metaWindow = child._window;
this.emit('activate-window', metaWindow);
} else if (child == this._newWindowMenuItem) {
let current_workspace = global.screen.get_active_workspace().index();
this._source.app.open_new_window(current_workspace);
this.emit('activate-window', null);
} else if (child == this._quitAppMenuItem) {
this._source.app.request_quit();
} else if (child == this._toggleFavoriteMenuItem) {
let favs = AppFavorites.getAppFavorites();
let isFavorite = favs.isFavorite(this._source.app.get_id());
if (isFavorite)
favs.removeFavorite(this._source.app.get_id());
else
favs.addFavorite(this._source.app.get_id());
}
this.close();
}
}
function main(extensionMeta) {
imports.gettext.bindtextdomain('gnome-shell-extensions', extensionMeta.localedir);
let dock = new Dock();
}
+9
View File
@@ -0,0 +1,9 @@
{
"uuid": "@uuid@",
"name": "Dock",
"description": "A dock for the GNOME Shell -- displays favorite and running applications",
"original-author": "tclaesson@gmail.com",
"shell-version": [ "@shell_current@" ],
"localedir": "@LOCALEDIR@",
"url": "@url@"
}
+54
View File
@@ -0,0 +1,54 @@
#dock {
border-radius: 9px;
background-color: rgba(0,0,0,0.9);
border-width: 2px;
border-color: #5f5f5f;
}
/* Panel */
.dock-app {
padding: 4px;
width: 70px;
height: 70px;
border-radius: 4px;
transition-duration: 100;
}
.dock-app.running {
padding: 3px;
border: 1px solid #181818;
background-gradient-direction: vertical;
background-gradient-start: #3d3d3d;
background-gradient-end: #181818;
}
.dock-app.selected {
padding: 3px;
border: 1px solid #666666;
}
.dock-app.focused {
padding: 3px;
border: 1px solid #5f5f5f;
background-gradient-direction: vertical;
background-gradient-start: rgba(61,61,61,0.8);
background-gradient-end: rgba(24,24,24,0.2);
}
.dock-app:hover {
padding: 3px;
border: 1px solid #666666;
background-gradient-direction: vertical;
background-gradient-start: rgba(61,61,61,0.8);
background-gradient-end: rgba(24,24,24,0.2);
transition-duration: 100;
}
.dock-app:active {
padding: 3px;
background-color: #1e1e1e;
border: 1px solid #5f5f5f;
}
.dock-menu {
font-size: 12px
}
+7 -2
View File
@@ -2,10 +2,13 @@
const St = imports.gi.St; const St = imports.gi.St;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext;
const Main = imports.ui.main; const Main = imports.ui.main;
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 = global.get_primary_monitor(); let monitor = global.get_primary_monitor();
global.stage.add_actor(text); global.stage.add_actor(text);
text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2)); text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2));
@@ -13,7 +16,9 @@ function _showHello() {
} }
// Put your extension initialization code here // Put your extension initialization code here
function main() { function main(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
Main.panel.actor.reactive = true; Main.panel.actor.reactive = true;
Main.panel.actor.connect('button-release-event', _showHello); Main.panel.actor.connect('button-release-event', _showHello);
} }
@@ -1,6 +1,8 @@
{ {
"uuid": "example@gnome-shell-extensions.gnome.org", "uuid": "@uuid@",
"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": [ "2.91.6" ] "shell-version": [ "@shell_current@" ],
"localedir": "@LOCALEDIR@",
"url": "@url@"
} }
@@ -1,7 +0,0 @@
{
"shell-version": ["2.91.5", "2.91.6"],
"uuid": "windowsNavigator@gnome-shell-extensions.gnome.org",
"original-author": "zaspire@rambler.ru",
"name": "windowNavigator",
"description": "Allow keyboard selection of windows and workspaces in overlay mode"
}
@@ -0,0 +1,9 @@
{
"shell-version": ["2.91.5", "@shell_current@"],
"uuid": "@uuid@",
"localedir": "@LOCALEDIR@",
"original-author": "zaspire@rambler.ru",
"name": "windowNavigator",
"description": "Allow keyboard selection of windows and workspaces in overlay mode",
"url": "@url@"
}
+18 -10
View File
@@ -13,8 +13,9 @@ 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'); const Gettext = imports.gettext.domain('gnome-shell-extensions');
const _ = Gettext.gettext; const _ = Gettext.gettext;
const N_ = function(e) { return e };
const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0, const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0,
GnomeDesktop.RRRotation.ROTATION_90, GnomeDesktop.RRRotation.ROTATION_90,
@@ -22,10 +23,10 @@ const possibleRotations = [ GnomeDesktop.RRRotation.ROTATION_0,
GnomeDesktop.RRRotation.ROTATION_270 GnomeDesktop.RRRotation.ROTATION_270
]; ];
let rotations = [ [ GnomeDesktop.RRRotation.ROTATION_0, _("Normal") ], let rotations = [ [ GnomeDesktop.RRRotation.ROTATION_0, N_("Normal") ],
[ GnomeDesktop.RRRotation.ROTATION_90, _("Left") ], [ GnomeDesktop.RRRotation.ROTATION_90, N_("Left") ],
[ GnomeDesktop.RRRotation.ROTATION_270, _("Right") ], [ GnomeDesktop.RRRotation.ROTATION_270, N_("Right") ],
[ GnomeDesktop.RRRotation.ROTATION_180, _("Upside-down") ] [ GnomeDesktop.RRRotation.ROTATION_180, N_("Upside-down") ]
]; ];
const XRandr2Iface = { const XRandr2Iface = {
@@ -58,7 +59,7 @@ Indicator.prototype = {
} }
this._createMenu(); this._createMenu();
this._screen.connect('screen-changed', Lang.bind(this, this._randrEvent)); this._screen.connect('changed', Lang.bind(this, this._randrEvent));
}, },
_randrEvent: function() { _randrEvent: function() {
@@ -70,7 +71,7 @@ Indicator.prototype = {
let config = GnomeDesktop.RRConfig.new_current(this._screen); let config = GnomeDesktop.RRConfig.new_current(this._screen);
let outputs = config.get_outputs(); let outputs = config.get_outputs();
for (let i = 0; i < outputs.length; i++) { for (let i = 0; i < outputs.length; i++) {
if (outputs[i].get_connected()) if (outputs[i].is_connected())
this._addOutputItem(config, outputs[i]); this._addOutputItem(config, outputs[i]);
} }
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
@@ -87,10 +88,14 @@ Indicator.prototype = {
this.menu.addMenuItem(item); this.menu.addMenuItem(item);
let allowedRotations = this._getAllowedRotations(config, output); let allowedRotations = this._getAllowedRotations(config, output);
let currentRotation = output.get_rotation();
for (let i = 0; i < rotations.length; i++) { for (let i = 0; i < rotations.length; i++) {
let [bitmask, name] = rotations[i]; let [bitmask, name] = rotations[i];
if (bitmask & allowedRotations) { if (bitmask & allowedRotations) {
this.menu.addAction(name, Lang.bind(this, function(event) { let item = new PopupMenu.PopupMenuItem(Gettext.gettext(name));
if (bitmask & currentRotation)
item.setShowDot(true);
item.connect('activate', Lang.bind(this, function(item, event) {
/* ensure config is saved so we get a backup if anything goes wrong */ /* ensure config is saved so we get a backup if anything goes wrong */
config.save(); config.save();
@@ -99,9 +104,10 @@ Indicator.prototype = {
config.save(); config.save();
this._proxy.ApplyConfigurationRemote(global.stage_xwindow, event.get_time()); this._proxy.ApplyConfigurationRemote(global.stage_xwindow, event.get_time());
} catch (e) { } catch (e) {
logError ('Could not save monitor configuration: ' + e); log ('Could not save monitor configuration: ' + e);
} }
})); }));
this.menu.addMenuItem(item);
} }
} }
}, },
@@ -130,6 +136,8 @@ Indicator.prototype = {
} }
function main() { function main(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['display'] = Indicator; Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['display'] = Indicator;
} }
@@ -1,6 +1,8 @@
{ {
"uuid": "xrandr-indicator@gnome-shell-extensions.gnome.org", "uuid": "@uuid@",
"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": [ "2.91.5", "2.91.6" ] "shell-version": [ "@shell_current@" ],
"localedir": "@LOCALEDIR@",
"url": "@url@"
} }
+1
View File
@@ -0,0 +1 @@
intltool.m4
+1
View File
@@ -0,0 +1 @@
it
+3
View File
@@ -2,3 +2,6 @@ extensions/example/extension.js
extensions/windowsNavigator/extension.js extensions/windowsNavigator/extension.js
extensions/xrandr-indicator/extension.js extensions/xrandr-indicator/extension.js
extensions/alternate-tab/extension.js extensions/alternate-tab/extension.js
extensions/auto-move-windows/extension.js
extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml.in
extensions/dock/extension.js
+72
View File
@@ -0,0 +1,72 @@
# Italian translations for GNOME Shell extensions
# Copyright (C) 2011 Giovanni Campagna et al.
# This file is distributed under the same license as the gnome-shell-extensions package.
# Giovanni Campagna <scampa.giovanni@gmail.com>, 2011
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: gnome-shell-extensions 2.91.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-02-19 20:39+0100\n"
"PO-Revision-Date: 2011-02-20 18:04+0100\n"
"Last-Translator: Giovanni Campagna <scampa.giovanni@gmail.com>\n"
"Language-Team: none <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../extensions/example/extension.js:11
msgid "Hello, world!"
msgstr "Ciao, mondo!"
#: ../extensions/xrandr-indicator/extension.js:25
msgid "Normal"
msgstr "Normale"
#: ../extensions/xrandr-indicator/extension.js:26
msgid "Left"
msgstr "Sinistra"
#: ../extensions/xrandr-indicator/extension.js:27
msgid "Right"
msgstr "Destra"
#: ../extensions/xrandr-indicator/extension.js:28
msgid "Upside-down"
msgstr "Rovesciato"
#: ../extensions/xrandr-indicator/extension.js:77
msgid "Configure display settings..."
msgstr "Configura impostazioni display..."
#: ../extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml.in.h:1
msgid ""
"A list of strings, each containing an application id (desktop file name), "
"followed by a colon and the workspace number"
msgstr "Una lista di stringhe, ognuna contenente un id applicazione (nome del file .desktop), seguito da due punti e il numero dello spazio di lavoro"
#: ../extensions/auto-move-windows/org.gnome.shell.extensions.auto-move-windows.gschema.xml.in.h:2
msgid "Application and workspace list"
msgstr "Lista applicazioni e spazi di lavoro"
#: ../extensions/dock/extension.js:115
msgid "Drag here to add favorites"
msgstr "Trascina qui per aggiungere ai preferiti"
#: ../extensions/dock/extension.js:415
msgid "New Window"
msgstr "Nuova finestra"
#: ../extensions/dock/extension.js:417
msgid "Quit Application"
msgstr "Chiudi applicazione"
#: ../extensions/dock/extension.js:422
msgid "Remove from Favorites"
msgstr "Rimuovi dai preferiti"
#: ../extensions/dock/extension.js:423
msgid "Add to Favorites"
msgstr "Aggiungi ai preferiti"