gnome-shell-extensions

Create a dynamic rescheduling GSource in JavaScript

会有一股神秘感。 提交于 2019-12-11 04:24:37
问题 GLib's main loop supports scheduling callback functions for periodic intervals, using g_timemout_source_new and related functions. The callback will repeatedly be called after the scheduled interval, until it returns false . I now want to modify this process with a dynamic interval. Instead of just true or false , the callback should be able to return a time value that should pass until its next invocation. Doing this in C is quite straightforward: A new GSource Type can be created, that only

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");

Including binary components in a GNOME Shell extension

早过忘川 提交于 2019-12-08 08:36:29
Developing extensions for the GNOME Shell mostly involves the use of C APIs through GObject Introspection. This means that most things achievable with C can be done in JavaScript, too. But there are some cases, where features of the C APIs cannot (yet) be reproduced through the introspection bindings. It would be useful to be able to bridge these gaps with native C code. Can a GNOME Shell extension include binary components created from C code? If so, how are they integrated? I'm having the very same question. Haven't found a good way to do so yet. Currently I'm trying 2 non ideal approaches

Including binary components in a GNOME Shell extension

≯℡__Kan透↙ 提交于 2019-12-08 03:33:25
问题 Developing extensions for the GNOME Shell mostly involves the use of C APIs through GObject Introspection. This means that most things achievable with C can be done in JavaScript, too. But there are some cases, where features of the C APIs cannot (yet) be reproduced through the introspection bindings. It would be useful to be able to bridge these gaps with native C code. Can a GNOME Shell extension include binary components created from C code? If so, how are they integrated? 回答1: I'm having

Gnome shell extensions: how to run a command with pipes

回眸只為那壹抹淺笑 提交于 2019-12-07 05:15:26
问题 So I'm making a Gnome Shell extension. And I want to be able to run some command with a pipe. (The command is actually "xrandr --query | awk 'something'" , but that is off topic) So, what I have done so far is GLib.spawn_async_with_pipes(null, ['/usr/bin/xrandr', '--query', '|', 'awk...'], null, GLib.SpawnFlags.DO_NOT_REAP_CHILD, null); But it doesn't work! I can't find any example of running a command in a gnome extensions with a pipe. Do I have to write "|" in the command like I did ? 回答1:

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

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

Documentation for writing GNOME Shell extensions

☆樱花仙子☆ 提交于 2019-12-03 01:32:53
问题 I've been asked to customise the layout of the GNOME 3 desktop. Apparently the way to do that is by writing an "extension". I've managed to do some of the things I wanted to do, but I feel utterly starved of information. I cannot find any useful documentation anywhere . I've wasted entire days of my life frantically googling every imaginable search term in a desperate attempt to find useful information. The GNOME website has hundreds of extensions for download. These are not trivial 3-liners;

How to test / debug GNOME Shell extensions? Is there any tool for that?

余生颓废 提交于 2019-11-29 22:02:52
I would like to develop GNOME Shell extensions and found it's really easy to step into the development process but I still can't figure out how to debug / test my extensions effectively. Are there any tools for that purpose? Is there any kind of real time console like we have on modern browsers or javascript servers environments? Yes, the real-time console is called "Looking Glass" and can be started by pressing Alt + F2 and typing lg at the prompt. More info: https://live.gnome.org/GnomeShell/LookingGlass On Fedora 20 (and probably any new linux distro) you can use that command: journalctl