gnome-shell

Is it possible to import the Gvc typelib outside of the Gnome Shell environment?

允我心安 提交于 2019-12-11 00:45:18
问题 I'd like to use Gvc (libgnome-volume-control) as used in Gnome Shell GIR in GJS, but can't find a way to access it except within the Gnome Shell environment (eg. a Gnome Shell extension). Actually, I can't even figure out where it is. Is this possible? UPDATE In line with Philip Withnall's comment (about a hacky workaround), I have found it's possible to import like so: const GIRepository = imports.gi.GIRepository; GIRepository.Repository.prepend_search_path("/usr/lib/gnome-shell");

Python program with Notification in Gnome Shell doesn't work

独自空忆成欢 提交于 2019-12-09 01:43:46
问题 I'm writing a python program that takes info from a webpage and show it on Notification in Gnome Shell. I'm using Arch, so I want to start this program at startup and if there is any change on the webpage, it will notify me. Here is my code: import time import webbrowser import requests from bs4 import BeautifulSoup from gi.repository import Notify, GLib IPS = {'Mobifone': True, 'Viettel': False, 'Vinaphone': False} LINK = "https://id.vtc.vn/tin-tuc/chuyen-muc-49/tin-khuyen-mai.html" def set

How do I call out to a command-line program from a gnome shell extension?

不羁的心 提交于 2019-12-05 21:36:47
问题 I have written a simple shell script to accomplish a common task, and I want to be able to run it whenever a button is clicked. I've used gnome-shell-extension-tool to create the Hello World example already, but now I need to know how to simply have it run an arbitrary command when clicked. There is no input or output to be concerned with; it just needs to run. 回答1: After some more creative googling, I've found the solution: const Util = imports.misc.util; Util.spawn(['/path/to/program',

How to handle keyboard events in gnome shell extensions?

前提是你 提交于 2019-12-05 09:22:00
问题 How can I add an event or other method to listen to keypresses on a gnome shell extension? e.g. show a dialog with each key press showing the pressed key? I can not find any example. The documentation mentions a keyboard module, but with that common name searching is hard. Class explanation ... - General utils - Keyboard: Manage and define the keyboard events, etc. for gnome shell. (read above as a quote from the docs linked above. it is styled as code because the quote styling for some

Use of Shell object in Gjs

天大地大妈咪最大 提交于 2019-12-04 17:45:50
问题 I am writing a gtk+ app using Gjs ( Gnome JavaScript bindings ) As there are no documents available i am reading the sources of gnome-shell JavaScript's . In my app i need to get access to global.userdatadir . I am trying to add the Shell object to my script : const Shell = imports.gi.Shell; and run it with #gjs myscript.js but when i do this it throws me an error saying : JS ERROR: !!! Exception was: Error: Requiring Shell, version none: Typelib file for namespace 'Shell' (any version) not

How to handle keyboard events in gnome shell extensions?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 22:17:36
How can I add an event or other method to listen to keypresses on a gnome shell extension? e.g. show a dialog with each key press showing the pressed key? I can not find any example. The documentation mentions a keyboard module, but with that common name searching is hard. Class explanation ... - General utils - Keyboard: Manage and define the keyboard events, etc. for gnome shell. (read above as a quote from the docs linked above. it is styled as code because the quote styling for some reason do not preserve line breaks in this site) I found some extensions using the bellow code for results

Use of Shell object in Gjs

落爺英雄遲暮 提交于 2019-12-03 12:33:01
I am writing a gtk+ app using Gjs ( Gnome JavaScript bindings ) As there are no documents available i am reading the sources of gnome-shell JavaScript's . In my app i need to get access to global.userdatadir . I am trying to add the Shell object to my script : const Shell = imports.gi.Shell; and run it with #gjs myscript.js but when i do this it throws me an error saying : JS ERROR: !!! Exception was: Error: Requiring Shell, version none: Typelib file for namespace 'Shell' (any version) not found JS ERROR: !!! lineNumber = '0' JS ERROR: !!! fileName = '"gjs_throw"' JS ERROR: !!! stack = '"(

How to start writing Gnome Shell extensions

…衆ロ難τιáo~ 提交于 2019-12-03 03:37:55
问题 I have found it's very hard to find documentation about Gnome Shell Extensions. I found some bits on Gnome Wiki (and it's first-level links), but it's not much: http://live.gnome.org/GnomeShell/Extensions The problem here is GJS and it's bindings. Absolutely no documentation, got lot's of SIGSEGVs, binding is just not ready (GLib, Gio and others). The only working one is unofficial documentation generated from GIR for Seed JavaScript implementation: http://roojs.org/seed/gir-1.2-gtk-2.0/seed/

How to start writing Gnome Shell extensions

社会主义新天地 提交于 2019-12-02 17:06:58
I have found it's very hard to find documentation about Gnome Shell Extensions. I found some bits on Gnome Wiki (and it's first-level links), but it's not much: http://live.gnome.org/GnomeShell/Extensions The problem here is GJS and it's bindings. Absolutely no documentation, got lot's of SIGSEGVs, binding is just not ready (GLib, Gio and others). The only working one is unofficial documentation generated from GIR for Seed JavaScript implementation: http://roojs.org/seed/gir-1.2-gtk-2.0/seed/ Where to get more examples? I want read directories, files, spawn processes, open network sockets and

Python program with Notification in Gnome Shell doesn't work

帅比萌擦擦* 提交于 2019-12-01 01:12:54
I'm writing a python program that takes info from a webpage and show it on Notification in Gnome Shell. I'm using Arch, so I want to start this program at startup and if there is any change on the webpage, it will notify me. Here is my code: import time import webbrowser import requests from bs4 import BeautifulSoup from gi.repository import Notify, GLib IPS = {'Mobifone': True, 'Viettel': False, 'Vinaphone': False} LINK = "https://id.vtc.vn/tin-tuc/chuyen-muc-49/tin-khuyen-mai.html" def set_ips_state(ips_name, state): global IPS for key in IPS.iterkeys(): if key == ips_name: IPS[key] = state