Created
May 28, 2011 13:45
-
-
Save yurenju/996870 to your computer and use it in GitHub Desktop.
default gnome-shell extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample extension code, makes clicking on the panel show a message | |
const St = imports.gi.St; | |
const Mainloop = imports.mainloop; | |
const Main = imports.ui.main; | |
function _showHello() { | |
let text = new St.Label({ style_class: 'helloworld-label', | |
text: "Hello, world!" }); | |
let monitor = global.get_primary_monitor(); | |
global.stage.add_actor(text); | |
text.set_position(Math.floor (monitor.width / 2 - text.width / 2), | |
Math.floor(monitor.height / 2 - text.height / 2)); | |
Mainloop.timeout_add(3000, function () { text.destroy(); }); | |
} | |
// Put your extension initialization code here | |
function main() { | |
Main.panel.actor.reactive = true; | |
Main.panel.actor.connect('button-release-event', _showHello); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment