Vlastný vyhľadávací nástroj
 

GNOME Shell hacks

0 days and 6.97 hours since someone reset this sign. Record is 21 days and 18.88 hours.
P7044188 (Developed in UFRaw)

P7044188 (Developed in UFRaw)

Date: 07/04/2009

Zaujímavé linky:
KSP
FMFI UK
GJH

------BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+: a-- C++ UL+++ P+ L++ E--- W++ N? o? K? w-- O? M? V? PS+ PE+(-) Y+ PGP+ t>+ 5++ X+ R+ tv-- b+ DI+ D G++ e>+++ h-- r++ y?
------END GEEK CODE BLOCK------

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:

  1. diff --git a/src/core/screen.c b/src/core/screen.c
  2. index 329035c..b55c521 100644
  3. --- a/src/core/screen.c
  4. +++ b/src/core/screen.c
  5. @@ -2331,6 +2331,26 @@ meta_screen_calc_workspace_layout (MetaScreen          *screen,
  6.    if (cols <= 0)
  7.      cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
  8.  
  9. +  /* begin of mic's hack */
  10. +
  11. +  if (num_workspaces == 1)
  12. +    rows = cols = 1;
  13. +  else
  14. +    {
  15. +      int square_size = 1;
  16. +      while ( (square_size + 1) * (square_size + 1) < num_workspaces)
  17. +        square_size++;      /* can be done by ceil(sqrt) */
  18. +
  19. +      rows = square_size;
  20. +      cols = square_size + 1;
  21. +
  22. +      if (num_workspaces - square_size * square_size > square_size)
  23. +        rows++;
  24. +
  25. +    }
  26. +
  27. +  /* end of mic's hack */
  28. +
  29.    /* paranoia */
  30.    if (rows < 1)
  31.      rows = 1;
  32. @@ -2385,7 +2405,37 @@ meta_screen_calc_workspace_layout (MetaScreen          *screen,
  33.    current_row = -1;
  34.    current_col = -1;
  35.    i = 0;
  36. -  
  37. +  c = 0;
  38. +  r = 0;
  39. +  int horiz = 1, span = 1;
  40. +
  41. +  for (i = 0; i < grid_area; i++)
  42. +    {
  43. +
  44. +      grid[r*cols+c]=i;
  45. +
  46. +      if (horiz)
  47. +        {
  48. +          c++;
  49. +          if (c == span)
  50. +            {
  51. +              r = 0;
  52. +              horiz = 0;
  53. +            }
  54. +        } else
  55. +          {
  56. +            r++;
  57. +            if (r == span)
  58. +              {
  59. +                c = 0;
  60. +                horiz = 1;
  61. +                span++;
  62. +              }
  63. +
  64. +          }
  65. +    }
  66. +
  67. +  if(0)
  68.    switch (screen->starting_corner)
  69.      {
  70.      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.

  1. diff --git a/js/ui/panel.js b/js/ui/panel.js
  2. index 24e9704..e4e8c53 100644
  3. --- a/js/ui/panel.js
  4. +++ b/js/ui/panel.js
  5. @@ -13,6 +13,8 @@ const Signals = imports.signals;
  6.  const Gettext = imports.gettext.domain('gnome-shell');
  7.  const _ = Gettext.gettext;
  8.  
  9. +const DBus = imports.dbus;
  10. +
  11.  const AppDisplay = imports.ui.appDisplay;
  12.  const Calendar = imports.ui.calendar;
  13.  const Main = imports.ui.main;
  14. @@ -36,8 +38,18 @@ const TRAY_BORDER_COLOR = new Clutter.Color();
  15.  TRAY_BORDER_COLOR.from_pixel(0x00000033);
  16.  const TRAY_CORNER_RADIUS = 5;
  17.  const TRAY_BORDER_WIDTH = 0;
  18. +const TEXT_COLOR = new Clutter.Color();
  19. +TEXT_COLOR.from_pixel(0x5f5f5fff);
  20. +
  21. +const BRIGHTER_TEXT_COLOR = new Clutter.Color();
  22. +BRIGHTER_TEXT_COLOR.from_pixel(0xbbbbbbff);
  23. +const BRIGHT_TEXT_COLOR = new Clutter.Color();
  24. +BRIGHT_TEXT_COLOR.from_pixel(0xffffffff);
  25.  
  26. +const SEARCH_TEXT_COLOR = new Clutter.Color();
  27. +SEARCH_TEXT_COLOR.from_pixel(0x333333ff);
  28.  const HOT_CORNER_ACTIVATION_TIMEOUT = 0.5;
  29. +const SEARCH_CURSOR_COLOR = BRIGHT_TEXT_COLOR;
  30.  
  31.  const STANDARD_TRAY_ICON_ORDER = ['keyboard', 'volume', 'bluetooth', 'network', 'battery']
  32.  const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
  33. @@ -242,6 +254,112 @@ AppPanelMenu.prototype = {
  34.  
  35.  Signals.addSignalMethods(AppPanelMenu.prototype);
  36.  
  37. +
  38. +/* BEGIN OF MIC'S HACK */
  39. +
  40. +function HamsterDBus(){
  41. +       this._init();
  42. +}
  43. +
  44. +HamsterDBus.prototype = {
  45. +       _init: function(){
  46. +               DBus.session.proxifyObject(this,'org.gnome.Hamster','/org/gnome/Hamster');
  47. +       }
  48. +};
  49. +
  50. +var HamsterDBusIface = {
  51. +       name: 'org.gnome.Hamster',
  52. +       methods: [ {name:'ShowOverview'},
  53. +                  {name:'ShowPreferences'},
  54. +                  {name:'AddActivity', inSignature:'ss'},
  55. +                  {name:'AddFact',inSignature:'suu'}]
  56. +};
  57. +
  58. +DBus.proxifyPrototype(HamsterDBus.prototype,HamsterDBusIface);
  59. +
  60. +function HamsterApplet(){
  61. +    this._init();
  62. +}
  63. +
  64. +HamsterApplet.prototype ={
  65. +    _init : function(){
  66. +        let entryProperties = { editable: true,
  67. +                    activatable: true,
  68. +                    single_line_mode: true,
  69. +                    reactive: true,
  70. +                       color: BRIGHT_TEXT_COLOR,
  71. +                    cursor_color: SEARCH_CURSOR_COLOR };
  72. +
  73. +        this._entry = new Clutter.Text(entryProperties);
  74. +        this._entry_active=false;
  75. +        this._entry.connect('button-press-event', Lang.bind(this, function () {
  76. +            if(!this._entry_active){
  77. +                if (!Main.pushModal(this._entry))
  78. +                    return;
  79. +                global.stage.set_key_focus(this._entry);
  80. +                this._entry_active=true;
  81. +            }}));
  82. +        this._entry.connect('key-press-event', Lang.bind(this, function(o, e) {
  83. +            let symbol = e.get_key_symbol();
  84. +            if (symbol == Clutter.Escape || symbol == Clutter.KP_Enter) {
  85. +                Main.popModal(this._entry);
  86. +                if (symbol == Clutter.KP_Enter)
  87. +                    this._updateText();
  88. +                else
  89. +                    this._revertText();
  90. +                this._entry_active^=true;
  91. +                return true;
  92. +            }
  93. +            return false;
  94. +        }));
  95. +        this._entry.connect('activate', Lang.bind(this, function (o, e) {
  96. +            Main.popModal(this._entry);
  97. +            this._updateText();
  98. +            this._entry_active=false;
  99. +        }));
  100. +
  101. +        this._workspaces=[];
  102. +
  103. +
  104. +    },
  105. +
  106. +    _updateActivity : function (activity){
  107. +       proxy = new HamsterDBus();
  108. +       proxy.AddFactRemote(activity,0,0);
  109. +    },
  110. +
  111. +    _updateText : function (){
  112. +        let workspace=global.screen.get_active_workspace_index();
  113. +        this._workspaces[workspace]=this._entry.get_text();
  114. +       this._updateActivity(this._entry.get_text());
  115. +        this._entry.set_editable(true);
  116. +        this._entry.set_activatable(true);
  117. +    },
  118. +
  119. +    _revertText : function(){
  120. +        let workspace=global.screen.get_active_workspace_index();
  121. +        if(this._workspaces[workspace]==null)
  122. +            this._workspaces[workspace]='';
  123. +        this._entry.set_text(this._workspaces[workspace])
  124. +       this._updateActivity(this._entry.get_text());
  125. +        this._entry.set_editable(true);
  126. +        this._entry.set_activatable(true);
  127. +    },
  128. +
  129. +    _switchedToWorkspace : function(workspace){
  130. +        if(this._workspaces[workspace]==null){
  131. +            this._workspaces[workspace]='';
  132. +        }
  133. +        this._entry.set_text(this._workspaces[workspace]);
  134. +       this._updateActivity(this._entry.get_text());
  135. +        this._entry.set_editable(true);
  136. +        this._entry.set_activatable(true);
  137. +    }
  138. +}
  139. +
  140. +Signals.addSignalMethods(HamsterApplet.prototype);
  141. +/* END OF MIC'S HACK*/
  142. +
  143.  function Panel() {
  144.      this._init();
  145.  }
  146. @@ -402,6 +520,15 @@ Panel.prototype = {
  147.  
  148.          this._calendarPopup = null;
  149.  
  150. +/* BEGIN OF MIC'S HACKS*/
  151. +
  152. +        this._hamsterApplet = new HamsterApplet();
  153. +
  154. +        this._centerBox.add(this._hamsterApplet._entry,{y_fill:false});
  155. +
  156. +
  157. +/* END OF MIC'S HACKS*/
  158. +
  159.          /* right */
  160.  
  161.          // The tray icons live in trayBox within trayContainer.
  162. @@ -609,6 +736,7 @@ Panel.prototype = {
  163.              Main.overview.toggle();
  164.          this._hotCornerActivationTime = 0;
  165.      }
  166. +
  167.  };
  168.  
  169.  function CalendarPopup() {
  170. diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
  171. index 46e5964..122b0ab 100644
  172. --- a/js/ui/windowManager.js
  173. +++ b/js/ui/windowManager.js
  174. @@ -170,6 +170,9 @@ WindowManager.prototype = {
  175.      },
  176.  
  177.      _switchWorkspace : function(shellwm, from, to, direction) {
  178. +
  179. +           Main.panel._hamsterApplet._switchedToWorkspace(to);
  180. +
  181.          if (!this._shouldAnimate()) {
  182.              shellwm.completed_switch_workspace();
  183.              return;
Dátum poslednej zmeny: 17 január, 2011, 13:25 CET
Created by Mic ( mic(at)ksp(dot)sk, ICQ: 281832795, jabber: mic47@jabber.sk) Tato stranka vyzera najlepsie na mojom monitore:-) A v prehliadacoch Chromium, Firefox, Opera, Epiphany. Odporúčaná šírka monitora je aspoň 1280 pixelov. Pri menších šírkach sa nemusia niektoré fotky v galérii zobraziť korektne. Použitý software: PmWiki, Gallery 2.