mmm...i'm to much impatience... in the last code i have pasted the function enable and disable, don't work well because my extension if stopped remain in the panel.. sorry... i try to adjust...
2012/6/25 johnny cravatta <sitiwebxtu...@gmail.com> > Thank jasper now i have writed this code and work properly..no error in > console... > > > const St = imports.gi.St; >> const Main = imports.ui.main; >> const Tweener = imports.ui.tweener; >> >> let text; >> >> function _hideHello() { >> Main.uiGroup.remove_actor(text); >> text = null; >> } >> >> function _showHello() { >> if (!text) { >> >> text = new St.Label({ style_class: 'helloworld-label', text: >> "Hello, world!" }); >> Main.uiGroup.add_actor(text); >> } >> >> text.opacity = 255; >> >> let monitor = Main.layoutManager.primaryMonitor; >> >> text.set_position(Math.floor(monitor.width / 2 - text.width / 2), >> >> Math.floor(monitor.height / 2 - text.height / 2)); >> >> Tweener.addTween(text, >> { opacity: 0, >> time: 2, >> transition: 'easeOutQuad', >> onComplete: _hideHello }); >> } >> >> function init() { >> Main.panel.actor.reactive = true; >> Main.panel.actor.connect('button-press-event', _showHello); >> } >> //con 'button-release-event' funziona il tasto destro e basta >> > //with botton-release event work only the right click >> > > >> function enable() { >> Main.panel; >> } >> >> function disable() { >> Main.panel; >> } >> > > best regards. > johnny > > > 2012/6/25 Jasper St. Pierre <jstpie...@mecheye.net> > > global.get_primary_monitor() was replaced with >> Main.layoutManager.primaryMonitor >> >> On Mon, Jun 25, 2012 at 9:31 AM, johnny cravatta >> <sitiwebxtu...@gmail.com> wrote: >> > Sorry for my incompetence; >> > why this code it's not functional in gnome-shell 3.4.1? >> > >> >> 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); >> >> } >> >> >> >> Read more: >> >> >> http://blog.fpmurphy.com/2011/04/gnome-3-shell-extensions.html#ixzz1yoN4wkTh >> > >> > >> > I cannot be able to make the same results described in the fpmurphy >> blog.. >> > thanks for any suggestions. >> > >> > johnny >> > >> > >> > _______________________________________________ >> > gnome-shell-list mailing list >> > gnome-shell-list@gnome.org >> > https://mail.gnome.org/mailman/listinfo/gnome-shell-list >> > >> >> >> >> -- >> Jasper >> > >
_______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list