This hacks now probably do not work.
Hack #1
The mutter workspace layout is not same as the overlay layout in gnome shell. Here is patch for mutter:
- diff --git a/src/core/screen.c b/src/core/screen.c
- index 329035c..b55c521 100644
- --- a/src/core/screen.c
- +++ b/src/core/screen.c
- @@ -2331,6 +2331,26 @@ meta_screen_calc_workspace_layout (MetaScreen *screen,
- if (cols <= 0)
- cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
- + /* begin of mic's hack */
- +
- + if (num_workspaces == 1)
- + rows = cols = 1;
- + else
- + {
- + int square_size = 1;
- + while ( (square_size + 1) * (square_size + 1) < num_workspaces)
- + square_size++; /* can be done by ceil(sqrt) */
- +
- + rows = square_size;
- + cols = square_size + 1;
- +
- + if (num_workspaces - square_size * square_size > square_size)
- + rows++;
- +
- + }
- +
- + /* end of mic's hack */
- +
- /* paranoia */
- if (rows < 1)
- rows = 1;
- @@ -2385,7 +2405,37 @@ meta_screen_calc_workspace_layout (MetaScreen *screen,
- current_row = -1;
- current_col = -1;
- i = 0;
- -
- + c = 0;
- + r = 0;
- + int horiz = 1, span = 1;
- +
- + for (i = 0; i < grid_area; i++)
- + {
- +
- + grid[r*cols+c]=i;
- +
- + if (horiz)
- + {
- + c++;
- + if (c == span)
- + {
- + r = 0;
- + horiz = 0;
- + }
- + } else
- + {
- + r++;
- + if (r == span)
- + {
- + c = 0;
- + horiz = 1;
- + span++;
- + }
- +
- + }
- + }
- +
- + if(0)
- switch (screen->starting_corner)
- {
- case META_SCREEN_TOPLEFT:
Hack #2
Added hamster-applet into gnome shell. Not really. I just added editbox into pannel, which sends dbus messages to hamster-applet (had to be run in window mode, not as applet run "/usr/lib/hamster-applet/hamster-applet -w"). Each desktop has it's own activity.
- diff --git a/js/ui/panel.js b/js/ui/panel.js
- index 24e9704..e4e8c53 100644
- --- a/js/ui/panel.js
- +++ b/js/ui/panel.js
- @@ -13,6 +13,8 @@ const Signals = imports.signals;
- const Gettext = imports.gettext.domain('gnome-shell');
- const _ = Gettext.gettext;
- +const DBus = imports.dbus;
- +
- const AppDisplay = imports.ui.appDisplay;
- const Calendar = imports.ui.calendar;
- const Main = imports.ui.main;
- @@ -36,8 +38,18 @@ const TRAY_BORDER_COLOR = new Clutter.Color();
- TRAY_BORDER_COLOR.from_pixel(0x00000033);
- const TRAY_CORNER_RADIUS = 5;
- const TRAY_BORDER_WIDTH = 0;
- +const TEXT_COLOR = new Clutter.Color();
- +TEXT_COLOR.from_pixel(0x5f5f5fff);
- +
- +const BRIGHTER_TEXT_COLOR = new Clutter.Color();
- +BRIGHTER_TEXT_COLOR.from_pixel(0xbbbbbbff);
- +const BRIGHT_TEXT_COLOR = new Clutter.Color();
- +BRIGHT_TEXT_COLOR.from_pixel(0xffffffff);
- +const SEARCH_TEXT_COLOR = new Clutter.Color();
- +SEARCH_TEXT_COLOR.from_pixel(0x333333ff);
- const HOT_CORNER_ACTIVATION_TIMEOUT = 0.5;
- +const SEARCH_CURSOR_COLOR = BRIGHT_TEXT_COLOR;
- const STANDARD_TRAY_ICON_ORDER = ['keyboard', 'volume', 'bluetooth', 'network', 'battery']
- const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
- @@ -242,6 +254,112 @@ AppPanelMenu.prototype = {
- Signals.addSignalMethods(AppPanelMenu.prototype);
- +
- +/* BEGIN OF MIC'S HACK */
- +
- +function HamsterDBus(){
- + this._init();
- +}
- +
- +HamsterDBus.prototype = {
- + _init: function(){
- + DBus.session.proxifyObject(this,'org.gnome.Hamster','/org/gnome/Hamster');
- + }
- +};
- +
- +var HamsterDBusIface = {
- + name: 'org.gnome.Hamster',
- + methods: [ {name:'ShowOverview'},
- + {name:'ShowPreferences'},
- + {name:'AddActivity', inSignature:'ss'},
- + {name:'AddFact',inSignature:'suu'}]
- +};
- +
- +DBus.proxifyPrototype(HamsterDBus.prototype,HamsterDBusIface);
- +
- +function HamsterApplet(){
- + this._init();
- +}
- +
- +HamsterApplet.prototype ={
- + _init : function(){
- + let entryProperties = { editable: true,
- + activatable: true,
- + single_line_mode: true,
- + reactive: true,
- + color: BRIGHT_TEXT_COLOR,
- + cursor_color: SEARCH_CURSOR_COLOR };
- +
- + this._entry = new Clutter.Text(entryProperties);
- + this._entry_active=false;
- + this._entry.connect('button-press-event', Lang.bind(this, function () {
- + if(!this._entry_active){
- + if (!Main.pushModal(this._entry))
- + return;
- + global.stage.set_key_focus(this._entry);
- + this._entry_active=true;
- + }}));
- + this._entry.connect('key-press-event', Lang.bind(this, function(o, e) {
- + let symbol = e.get_key_symbol();
- + if (symbol == Clutter.Escape || symbol == Clutter.KP_Enter) {
- + Main.popModal(this._entry);
- + if (symbol == Clutter.KP_Enter)
- + this._updateText();
- + else
- + this._revertText();
- + this._entry_active^=true;
- + return true;
- + }
- + return false;
- + }));
- + this._entry.connect('activate', Lang.bind(this, function (o, e) {
- + Main.popModal(this._entry);
- + this._updateText();
- + this._entry_active=false;
- + }));
- +
- + this._workspaces=[];
- +
- +
- + },
- +
- + _updateActivity : function (activity){
- + proxy = new HamsterDBus();
- + proxy.AddFactRemote(activity,0,0);
- + },
- +
- + _updateText : function (){
- + let workspace=global.screen.get_active_workspace_index();
- + this._workspaces[workspace]=this._entry.get_text();
- + this._updateActivity(this._entry.get_text());
- + this._entry.set_editable(true);
- + this._entry.set_activatable(true);
- + },
- +
- + _revertText : function(){
- + let workspace=global.screen.get_active_workspace_index();
- + if(this._workspaces[workspace]==null)
- + this._workspaces[workspace]='';
- + this._entry.set_text(this._workspaces[workspace])
- + this._updateActivity(this._entry.get_text());
- + this._entry.set_editable(true);
- + this._entry.set_activatable(true);
- + },
- +
- + _switchedToWorkspace : function(workspace){
- + if(this._workspaces[workspace]==null){
- + this._workspaces[workspace]='';
- + }
- + this._entry.set_text(this._workspaces[workspace]);
- + this._updateActivity(this._entry.get_text());
- + this._entry.set_editable(true);
- + this._entry.set_activatable(true);
- + }
- +}
- +
- +Signals.addSignalMethods(HamsterApplet.prototype);
- +/* END OF MIC'S HACK*/
- +
- function Panel() {
- this._init();
- }
- @@ -402,6 +520,15 @@ Panel.prototype = {
- this._calendarPopup = null;
- +/* BEGIN OF MIC'S HACKS*/
- +
- + this._hamsterApplet = new HamsterApplet();
- +
- + this._centerBox.add(this._hamsterApplet._entry,{y_fill:false});
- +
- +
- +/* END OF MIC'S HACKS*/
- +
- /* right */
- // The tray icons live in trayBox within trayContainer.
- @@ -609,6 +736,7 @@ Panel.prototype = {
- Main.overview.toggle();
- this._hotCornerActivationTime = 0;
- }
- +
- };
- function CalendarPopup() {
- diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
- index 46e5964..122b0ab 100644
- --- a/js/ui/windowManager.js
- +++ b/js/ui/windowManager.js
- @@ -170,6 +170,9 @@ WindowManager.prototype = {
- },
- _switchWorkspace : function(shellwm, from, to, direction) {
- +
- + Main.panel._hamsterApplet._switchedToWorkspace(to);
- +
- if (!this._shouldAnimate()) {
- shellwm.completed_switch_workspace();
- return;
