Thursday, February 21, 2013

Resize Gnome Panel

Gnome 3.8/Fedora 19


1. Create the folder: ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com
    $ mkdir .local/share/gnome-shell/extensions
    $ mkdir ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com
    $ cd ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com/

2. Create three files in this newly created folder:

/*************** extension.js *******************/
const St = imports.gi.St;
const Shell = imports.gi.Shell;
const Main = imports.ui.main;

let  defaultStylesheet, patchStylesheet;

function init(extensionMeta)
{
  defaultStylesheet = Main.getThemeStylesheet();
  patchStylesheet = extensionMeta.path + '/stylesheet.css';
}

function enable()
{
  //imports.ui.main.panel.statusArea.appMenu.actor.hide();
  imports.ui.main.panel.statusArea.activities.actor.hide();
  imports.ui.main.panel.statusArea.a11y.actor.hide();
  imports.ui.main.panel.statusArea.userMenu.actor.hide();
  imports.ui.main.panel.statusArea.dateMenu.actor.hide();
  let themeContext = St.ThemeContext.get_for_stage(global.stage);
  let theme = new St.Theme ({ application_stylesheet: patchStylesheet,
  theme_stylesheet: "/usr/share/gnome-shell/theme/gnome-shell.css" });
  try { themeContext.set_theme(theme); }
  catch (e) { global.logError('Stylesheet parse error: ' + e); }
}

function disable()
{
  let themeContext = St.ThemeContext.get_for_stage(global.stage);
  let theme = new St.Theme ({ theme_stylesheet: defaultStylesheet });
  try { themeContext.set_theme(theme); }
  catch (e) { global.logError('Stylesheet parse error: ' + e); }
}


/*************** metadata.json *******************/
{
    "shell-version": [
        "3.2",
        "3.4",
        "3.6",
        "3.7",
        "3.8"
    ],
    "uuid": "panelsize@gnomepanelsize.com",
    "name": "Panel Size",
    "description": "Panel Size for Gnome",
    "url" : "http://gnomepanelsize.com"
}

/*************** stylesheet.css *******************/
#panel { height: 1px; font-size: 1px; }
.panel-button { transition-duration: 100; height: 16px; font-size: 16px; color:black; }
/*.panel-button:hover { height:28px; font-size:28px; color:black; }*/


3. Issue the command
  $ gsettings set org.gnome.shell enabled-extensions "[ 'panelsize@gnomepanelsize.com' ]"

4. Restart gnome:
  Press Alt-F2
  Enter single letter 'r' as command 

Gnome 3.6.2/Fedora 18

1. Create the folder: ~/.local/share/gnome-shell/extensions/panelsize@gnomepanelsize.com

2. Create following three files in this newly created folder:
  
/*************** extension.js *******************/
const St = imports.gi.St; const Shell = imports.gi.Shell; const Main = imports.ui.main; let defaultStylesheet, patchStylesheet; 

function init(extensionMeta) { defaultStylesheet = Main.defaultCssStylesheet; patchStylesheet = extensionMeta.path + '/stylesheet.css'; } 

function enable() { let themeContext = St.ThemeContext.get_for_stage(global.stage); let theme = new St.Theme ({ application_stylesheet: patchStylesheet, theme_stylesheet: defaultStylesheet }); try { themeContext.set_theme(theme); } catch (e) { global.logError('Stylesheet parse error: ' + e); } } 

function disable() { let themeContext = St.ThemeContext.get_for_stage(global.stage); let theme = new St.Theme ({ theme_stylesheet: defaultStylesheet }); try { themeContext.set_theme(theme); } catch (e) { global.logError('Stylesheet parse error: ' + e); } } 

 

/*************** metadata.json *******************/ 
{ "shell-version": [ "3.2", "3.4", "3.6", "3.7" ], "uuid": "panelsize@gnomepanelsize.com", "name": "Panel Size", "description": "Panel Size for Gnome", "url" : "http://gnomepanelsize.com" } 


/*************** stylesheet.css *******************/ 
#panel { height: 1px; font-size: 1px; } 
.panel-button { transition-duration: 100; height: 1px; font-size: 1px; color:white; } 
.panel-button:hover { height:28px; font-size:28px; color:black; } 


3. Issue the command:
 gsettings set org.gnome.shell enabled-extensions "[ 'panelsize@gnomepanelsize.com' ]" 

4. Restart gnome: 
Press Alt-F2
Enter single letter 'r' as command


IMPORTANT: Panel has vanished but you can access individual panel items by moving pointer along the top edge of the screen. In case you don't like it you can do any of the following to get back the original panel:

1. Delete the files and folders that you created and restart gnome

2. Execute the following command and restart gnome:
gsettings set org.gnome.shell enabled-extensions "[ ]"

3. Do you love adventure? Play around with the file "stylesheet.css" and restart gnome.

No comments:

Post a Comment