Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelKimmig committed Apr 27, 2011
0 parents commit 2e9f2ef
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Have you been annoyed by gnome 3 turning off your display while you were
trying to watch eg Youtube videos? No worries, you shall be helped :-)

Gnome-Presentation-Mode is a tiny gnome-shell extension that adds a new
entry to the power menu. While presentation mode is on the screensaver
and the automatic suspend will not kick in, allowing you to sit back and
enjoy whatever you are doing without having to wiggle the mouse every
few minutes.


Installation instructions: Just clone the repo, copy the extension in
your gnome-shell extensions directory and restart gnome-shell (default:
alt+f2, type r, press enter).

git clone [email protected]:RaphaelKimmig/Gnome-Presentation-Mode.git

cd Gnome-Presentation-Mode

mkdir -p ~/.local/share/gnome-shell/extensions/

cp -r [email protected] ~/.local/share/gnome-shell/extensions/
50 changes: 50 additions & 0 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const DBus = imports.dbus;
const Main = imports.ui.main;
const Lang = imports.lang;
const PopupMenu = imports.ui.popupMenu;

const Gettext = imports.gettext.domain('gnome-shell');
const _ = Gettext.gettext;

const SessionIface = {
name: "org.gnome.SessionManager",
methods: [
{ name: "Inhibit", inSignature: "susu", outSignature: "u" },
{ name: "Uninhibit", inSignature: "u", outSignature: "" }
]
};
let SessionProxy = DBus.makeProxyClass(SessionIface);

function main(extensionMeta) {
let Power = Main.Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['battery'];

Power.prototype.__init = Power.prototype._init;
Power.prototype._init = function () {
this.__init.apply(this, arguments);
this._inhibit = undefined;
this._sessionProxy = new SessionProxy(DBus.session, 'org.gnome.SessionManager', '/org/gnome/SessionManager');
this._presentationswitch = new PopupMenu.PopupSwitchMenuItem(_("Presentation mode"), false);
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this._presentationswitch);
this._presentationswitch.connect('toggled', Lang.bind(this, function() {
if(this._inhibit) {
this._sessionProxy.UninhibitRemote(this._inhibit);
this._inhibit = undefined;
} else {
try {
this._sessionProxy.InhibitRemote("presentor",
0,
"Presentation mode",
9,
Lang.bind(this, this._onInhibit));
} catch(e) {
//
}
}

}));
};
Power.prototype._onInhibit = function(cookie) {
this._inhibit = cookie;
};
};
7 changes: 7 additions & 0 deletions [email protected]/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"shell-version": ["3.0.1"],
"uuid": "[email protected]",
"name": "Presentation mode",
"description": "Add a presentation mode toggle to the power menu.",
"url": "https://github.com/RaphaelKimmig/Gnome-Presentation-Mode"
}
1 change: 1 addition & 0 deletions [email protected]/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Example stylesheet */

0 comments on commit 2e9f2ef

Please sign in to comment.