开发者的最佳 GNOME 扩展
开发 扩展 GNOME
![](/data/attachment/album/201804/22/224233k2111a91ad1p6w21.jpg)


扩展给予 GNOME3 桌面环境以非常大的灵活性，这种灵活性赋予了用户在定制化桌面上的优势，从而使他们的工作流程变得更加舒适和有效率。Fedora Magazine 已经介绍了一些很棒的桌面扩展，例如 [EasyScreenCast](https://fedoramagazine.org/screencast-gnome-extension/)、 [gTile](https://fedoramagazine.org/must-have-gnome-extension-gtile/) 和 [OpenWeather](https://fedoramagazine.org/weather-updates-openweather-gnome-shell-extension/) ，本文接下来会重点报道这些为开发者而改变的扩展。


如果你需要帮助来安装 GNOME 扩展，那么可以参考《[如何安装一个 GNOME Shell 扩展](/article-9447-1.html)》这篇文章。


### Docker 集成（Docker Integration）


![Docker Integration extension icon](/data/attachment/album/201804/22/224233s32hgf18rf28oh6z.png)


![Docker Integration extension status menu](/data/attachment/album/201804/22/224234twfmtf42l4lmrrff.png)


对于为自己的应用使用 Docker 的开发者而言，这个 [Docker 集成](https://extensions.gnome.org/extension/1065/docker-status/) 扩展是必不可少的。这个状态菜单提供了一个带着启动、停止、暂停、甚至删除它们的选项的 Docker 容器列表，这个列表会在新容器加入到这个系统时自动更新。


在安装完这个扩展后，Fedora 用户可能会收到这么一条消息：“Error occurred when fetching containers.（获取容器时发生错误）”。这是因为 Docker 命令默认需要 `sudo` 或 root 权限。要设置你的用户权限来运行 Docker，可以参考 [Fedora 开发者门户网站上的 Docker 安装这一页](https://developer.fedoraproject.org/tools/docker/docker-installation.html)。


你可以在该[扩展的站点](https://github.com/gpouilloux/gnome-shell-extension-docker)上找到更多的信息。


### Jenkins CI 服务器指示器（Jenkins CI Server Indicator）


![Jenkins CI Server Indicator icon](/data/attachment/album/201804/22/224234xf8mka8u932k9k3z.png)


![Jenkins CI Server Indicator extension status menu](/data/attachment/album/201804/22/224235rb6gxj8x3w00b8wq.png)


[Jenkins CI 服务器指示器](https://extensions.gnome.org/extension/399/jenkins-ci-server-indicator/)这个扩展可以使开发者在 Jenkins CI 服务器建立应用很简单，它展示了一个菜单，包含有任务列表及那些任务的状态。它也包括了一些如轻松访问 Jenkins 网页前端、任务完成提示、以及触发和过滤任务等特性。


如果想要更多的信息，请去浏览[开发者站点](https://www.philipphoffmann.de/gnome-3-shell-extension-jenkins-ci-server-indicator/)。


### 安卓工具（android-tool）


![android-tool extension icon](/data/attachment/album/201804/22/224235dstousw232esxeg2.png)


![android-tool extension status menu](/data/attachment/album/201804/22/224236eejo9ew33quecbw3.png)


[安卓工具](https://extensions.gnome.org/extension/1232/android-tool/)对于 Android 开发者来说会是一个非常有价值的扩展，它的特性包括捕获错误报告、设备截屏和屏幕录像。它可以通过 usb 和 tcp 连接两种方式来连接 Android 设备。


这个扩展需要 `adb` 的包，从 Fedora 官方仓库安装 `adb` 只需要[运行这条命令](https://fedoramagazine.org/howto-use-sudo/)：



```
sudo dnf install android-tools

```

你可以在这个[扩展的 GitHub 网页](https://github.com/naman14/gnome-android-tool)里找到更多信息。


### GnomeHub


![GnomeHub extension icon](/data/attachment/album/201804/22/224236vphxca2oee2epcp2.png)


![GnomeHub extension status menu](/data/attachment/album/201804/22/224237rmwdamas7wa97w9n.png)


对于自己的项目使用 GitHub 的 GNOME 用户来说，[GnomeHub](https://extensions.gnome.org/extension/1263/gnomehub/) 是一个非常好的扩展，它可以显示 GitHub 上的仓库，还可以通知用户有新提交的拉取请求。除此之外，用户可以把他们最喜欢的仓库加在这个扩展的设置里。


如果想要更多信息，可以参考一下这个[项目的 GitHub 页面](https://github.com/lagartoflojo/gnomehub)。


### gistnotes


![gistnotes extension icon](/data/attachment/album/201804/22/224237myghfognfz8gqtaf.png)


简单地说，[gistnotes](https://extensions.gnome.org/extension/917/gistnotes/) 为 gist 用户提供了一种创建、存储和管理注释和代码片段的简单方式。如果想要更多的信息，可以参考这个[项目的网站](https://github.com/mohan43u/gistnotes)。


![gistnotes window](/data/attachment/album/201804/22/224237nz021k1ferymm0zn.png)


### Arduino 控制器（Arduino Control）


![Arduino Control extension icon](/data/attachment/album/201804/22/224238nekuv7e5lb8c83dk.png)


这个 [Arduino 控制器](https://extensions.gnome.org/extension/894/arduino-control/)扩展允许用户去连接或者控制他们自己的 Arduino 电路板，它同样允许用户在状态菜单里增加滑块或者开关。除此之外，开发者放在扩展目录里的脚本可以通过以太网或者 usb 来连接 Arduino 电路板。


最重要的是，这个扩展可以被定制化来适合你的项目，在器 README 文件里的提供例子是，它能够“通过网络上任意的电脑来控制你房间里的灯”。


你可以从这个[项目的 GitHub 页面](https://github.com/simonthechipmunk/arduinocontrol)上得到更多的产品信息并安装这个扩展。


### Hotel Manager


![Hotel Manager extension icon](/data/attachment/album/201804/22/224238e62yh6to4y654789.png)


![Hotel Manager extension status menu](/data/attachment/album/201804/22/224239ubjqqbspsmq9pms2.png)


使用 Hotel 进程管理器开发网站的开发人员，应该尝试一下 [Hotel Manager](https://extensions.gnome.org/extension/1285/hotel-manager/) 这个扩展。它展示了一个增加到 Hotel 里的网页应用的列表，并给与了用户开始、停止和重启这些应用的能力。此外，还可以通过右边的电脑图标快速打开、浏览这些网页应用。这个扩展同样可以启动、停止或重启 Hotel 的后台程序。


本文发布时，GNOME 3.26 版本的 Hotel Manager 版本 4 没有在该扩展的下拉式菜单里列出网页应用。版本 4 还会在 Fedora 28 (GNOME 3.28) 上安装时报错。然而，版本 3 工作在 Fedora 27 和 Fedora 28。


如果想要更多细节，可以去看这个[项目在 GitHub 上的网页](https://github.com/hardpixel/hotel-manager)。


### VSCode 搜索插件（VSCode Search Provider）


[VSCode 搜索插件](https://extensions.gnome.org/extension/1207/vscode-search-provider/)是一个简单的扩展，它能够在 GNOME 综合搜索结果里展示 Visual Studio Code 项目。对于重度 VSCode 用户来说，这个扩展可以让用户快速连接到他们的项目，从而节省时间。你可以从这个[项目在 GitHub 上的页面](https://github.com/jomik/vscode-search-provider)来得到更多的信息。


![GNOME Overview search results showing VSCode projects.](/data/attachment/album/201804/22/224240h7kpgkf3d775x3gk.png)


在开发环境方面，你有没有一个最喜欢的扩展呢？发在评论区里，一起来讨论下吧。




---


via: <https://fedoramagazine.org/awesome-gnome-extensions-developers/>


作者：[Shaun Assam](https://fedoramagazine.org/author/sassam/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[hopefully2333](https://github.com/hopefully2333) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Extensions add immense flexibility to the GNOME 3 desktop environment. They give users the advantage of customizing their desktop while adding ease and efficiency to their workflow. The Fedora Magazine has already covered some great desktop extensions such as [EasyScreenCast](https://fedoramagazine.org/screencast-gnome-extension/), [gTile](https://fedoramagazine.org/must-have-gnome-extension-gtile/), and [OpenWeather](https://fedoramagazine.org/weather-updates-openweather-gnome-shell-extension/). This article continues that coverage by focusing on extensions tailored for developers.


If you need assistance installing GNOME extensions, refer to the article [How to install a GNOME Shell extension](https://fedoramagazine.org/install-gnome-shell-extension/).


Docker Integration

The [Docker Integration](https://extensions.gnome.org/extension/1065/docker-status/) extension is a must for developers using Docker for their apps. The status menu provides a list of Docker containers with the option to start, stop, pause and even remove them. The list updates automatically as new containers are added to the system.

After installing this extension, Fedora users may get the message: “Error occurred when fetching containers.” This is because Docker commands require sudo or root permissions by default. To configure your user account to run Docker, refer to the [Docker Installation page on the Fedora Developer Portal](https://developer.fedoraproject.org/tools/docker/docker-installation.html).

You can find more information on the [extension’s website](https://github.com/gpouilloux/gnome-shell-extension-docker).


Jenkins CI Server Indicator

The [Jenkins CI Server Indicator](https://extensions.gnome.org/extension/399/jenkins-ci-server-indicator/) extension makes it easy for developers to build their apps on a Jenkins CI Server. It displays a menu with a list of jobs and the state of those jobs. It also includes features such as easy access to the Jenkins web front-end, notifications for completed jobs, and the ability to trigger and filter jobs.

For more information, visit the [developer’s site](https://www.philipphoffmann.de/gnome-3-shell-extension-jenkins-ci-server-indicator/).


android-tool

[android-tool](https://extensions.gnome.org/extension/1232/android-tool/) can be a valuable extension for Android developers. Features include capturing bug reports, device screenshots and screen-recording. It can also connect to the Android device via USB or TCP.

This extension does require the *adb* package. To install *adb* from the official Fedora repository [run this command](https://fedoramagazine.org/howto-use-sudo/):

sudo dnf install android-tools

You can find more information at [the extension Github site](https://github.com/naman14/gnome-android-tool).


GnomeHub

[GnomeHub](https://extensions.gnome.org/extension/1263/gnomehub/) is a great extension for GNOME users using Github for their projects. It displays Github repositories and notifies the user of opened pull requests. In addition, users can add their favorite repositories in the extension’s settings.

For more information, refer to [the project’s Github page](https://github.com/lagartoflojo/gnomehub).


gistnotes

Quite simply, [gistnotes](https://extensions.gnome.org/extension/917/gistnotes/) provides easy access for gist users to create, store and manage notes or code snippets. For more information refer to [the project’s website](https://github.com/mohan43u/gistnotes).


Arduino Control


The [Arduino Control](https://extensions.gnome.org/extension/894/arduino-control/) extension allows users to connect to, and control, their Arduino boards. It also lets users add sliders and switches in the status menu. In addition, the developer includes scripts in the extension’s directory to connect to the board via Ethernet or USB.

Most importantly, this extension can be customized to fit your project. An example provided in the README file is the ability to “Control your Room Lights from any Computer on the Network.”

You can read more about the features and setup of this extension on [the project’s Github page](https://github.com/simonthechipmunk/arduinocontrol).


Hotel Manager

Developers using the Hotel process manager for their web apps should explore the [Hotel Manager](https://extensions.gnome.org/extension/1285/hotel-manager/) extension. It displays a list of web apps added to Hotel, and gives users the ability to start, stop and restart those apps. Furthermore, the *computers* icon to the right gives quick access to open, or view, that web app. The extension can also start, stop, or restart the Hotel daemon.

As of the publication of this article, Hotel Manager version 4 for GNOME 3.26 does not list the web apps in the extension’s drop-down menu. Version 4 also gives errors when installing on Fedora 28 (GNOME 3.28). However, version 3 works with Fedora 27 and Fedora 28.

For more details, see [the project’s Github page](https://github.com/hardpixel/hotel-manager).

## VSCode Search Provider

[VSCode Search Provider](https://extensions.gnome.org/extension/1207/vscode-search-provider/) is a simple extension that displays Visual Studio Code projects in the GNOME overview search results. For heavy VSCode users, this extension saves time by giving developers quick access to their projects. You can find more information on [the project’s Github page](https://github.com/jomik/vscode-search-provider).

Do you have a favourite extension you use for development? Let us know in the comments.

## Leslie Satenstein

My favourite gnome-extension is difficult to choose from amongst three of the top ones.

My first is activities configurator

My 2nd is Gno-Menu

My 3rd is TaskBar by Zpydr

Right click on activities configurator icon extension and you will have the equivalent of the TweakTool for gnome extensions.

Gno-Menu adds Gnome-2 menus to Gnome 3.

TaskBar does away with Dash to Dock by providing functionality to Gnome in the form of a favourites bar list and windows list.

Gnome-extensions are written with javascrypt. I would love to have these extensions written in a compiled language.

Extensions can also be installed to

/usr/share/gnome-shell/extensions with the

org*.xml extracted from within the extension/schema and copied to

/usr/share/glib-2.0/schemas

After making the extension globally accessable (to all users), run

glib-compile-schemas /usr/share/glib-2.0/schemas.

(on reboot, the global schemas will be available to all)

## Paul W. Frields

Users should not write information directly into

/usr, since this is an area reserved for vendor packaged software, so we don’t encourage this procedure. It’s better to package the extension and provide a local repo for it if needed. Also, there isn’t a benefit in having these in a compiled language. That would require client side build tools any time an extension is updated. This is precisely why the extensions are in Javascript.## Krystian

How often one updates an extension – once a week?

Adding few more seconds to compile an extension once and make the Shell experience better by improving the performance is the right way to do it.

Besides that, JS has many limitations and problems as a language affecting the final code quality and system stability while using it with gnome shell.

In general, there’s no gain from limiting the support to just one language/format.

## Andy

The situation here is often mischaracterized and overblown. Extensions are written in GJS, which is more like PyGObject, in that they are essentially written in GLib, Gtk and Clutter (C libraries) via language bindings, and contrary to popular belief about 40% of Gnome Shell is written in C.

Truth be told, writing extensions in a compiled language is orthogonal code quality, will increase the time and difficulty required to review them properly, probably result in very speed difference (given how little most of them do), significantly reduce the amount of capable authors and alienate all the current ones.

## Frederik

Is 0 equal to 0? In javascript? Who knows! Who cares? Let’s just hope I didn’t make a mistake and the interpreter just glazes over the problem and makes coffee, with extra cyanide, in my bathroom instead of verifying my data.

I wouldn’t be caught dead writing javascript if I have the option of using a real programming language. By restricting extensions to one language, you’re alienating everybody who doesn’t know or want to use the language. Javascript is likely the most hated language on the face of the planet to ever have existed — performance is not part of that problem.

Why Python wasn’t chosen instead of javascript really baffles me. All of the benefits of javascript, pretty much none of the problems and it’s actually liked by some people.

## Philipp

Bad code is not a disadvantage owed by a specific programming language. It’s the developer writing bad code not the language that makes him writing bad code.

Let’s take C for example. It allows you to write even worse and even more dangerous code than most of the higher level programming languages.

Even tough it is possible to do so, a developer who is used to use a specific language might still be able to write code of a good quality.

If you are not satisfied with the possibilities provided by gnome and you are a developer yourself… write the required modifications yourself. The good thing is that you’re free to do so. 😉

## Andy

What would make you think 0 doesn’t equal 0 in Javascript, and what problems with javascript as a language are you referring to? Some reasons Python wasn’t chosen:

You can’t monkey-patch like JS can, which is essential for extensions (these aren’t plugins)

JS is just a language (ECMA Script), not a whole platform of libraries and event loops that compete with the Gnome platform (GLib, Gtk, Clutter, etc)

JS was designed for asynchronous user interaction

JS has

neverbroken backwards compatibilityMuch of the hate towards JavaScript is really directed at “your dad’s JavaScript”, which is not the current state of affairs. There are classes, iterators/generators, async functions, weak sets/maps, typed arrays, Symbols (ala

foo), and more that people erroneously complain JS can’t do.I really like Python; I use it and often prefer it. But really, dragging the whole early-90s JavaScript bogey man out from under the bed thing is becoming quite tiresome.

## Leslie Satenstein

Hi Paul

Why have multiple copies of the extensions in the 5 logons on my desktop when I, as admin,install them within /usr.

You mentioned “It’s better to package the extension and provide a local repo for it if needed”. is there a configuration for gnome to inform the shell that there is an additional global path to local provided extensions?

FYI, I wrote a script that does the migration, the extract from the extensions of the schemas/*.xml files to glib-2.0/schemas and a glib-compile-schemas. Please point me to documentation to do what you propose.

Off topic

The xml files are “schema compiled”. Why can the *.desktop be desktop compiled, as are the schemas? I could see this too, becoming a performance enhancement feature.

## Paul W. Frields

Because users typically want different configurations of extensions. While they can enable/disable them individually if installed system-wide, you’ve now created a situation where they can’t be updated except by tedious manual intervention by only one person (the admin). Besides this, you’re relying on a writable /usr which may not be the case in future systems (such as Atomic editions). By packaging as RPM you avoid at least the manual intervention problem. But extensions are designed for per-user use and I see no good reason to override that.

## Davi

All these extensions should have been gtk apps. It’s a shame that making and distributing gtk apps is so much harder. Flatpak is changing that, though.

## Brian Exelbierd

This is a fantastic list! I am now super bummed not to be developing full-time anymore.

I wonder if we could find folks to extend the gnomehub extension to work with pagure.io?

## John Smith

I use standard Gnome on Fedora. My favourite is “EasyScreenCast” – as far as I know, it is the only good screen recorder. It is also a very nicely done extension with many superb options.

After all, the “built-in” screen recorder in Gnome records all your monitors, which is fairly useless if you want to make a screencast for students or colleagues of one specific window (e.g., to demonstrate how to do something in LibreOffice).

My 2nd favorite extension is “OpenWeather”, it just shows the weather and forecast in the top line and on clicking the details, very convenient and I would not want to use gnome without it anymore.

But there are issues I hope the developers can attend:

1) It is not so clear how to find and install extensions. The only way I can do it is to use the Gnome epiphany browsers (aka “web”), then go to the exensions website (https://extensions.gnome.org/), and then you can easily search and install them.

And after that you can manage them with the tweak tool. Okay, I don’t mind it, but I wonder how new users would find out. It would be nice if there would be a simple Gnome program that can do this, or a link somewhere on the desktop saying “search and install extensions”.

2) They can terribly crash your system. Take for example my favorite “EasyScreenCast” (what I am writing is true for both Fedora 27 and 28) on Wayland: You install it; you then logout; upon login you get a grey screen and there is no way to fix it. After much searching online, I found the solution is this: i) logout. ii) login with Xorg-Gnome instead of Wayland (only one time is enough) iii) logout again, iv) Now it miraculously does not longer crash your Wayland gnome shell: https://bugzilla.redhat.com/show_bug.cgi?id=1394755 ; To me, this seems a really weird bug — what does the one login to Xorg fix the situation? Apparently, this has been an issue since 2016.

3) I have had the “Places” extension give me the same problem of not being able to login anymore and I had to remove it.

PS: I also would want to learn how to program extensions. Any recommendations for a tutorial?

## Andy

1) It is not so clear how to find and install extensions.

If you’re using any recent version of Gnome you can actually browse and install extensions in “Software” (eg gnome-software).

2) They can terribly crash your system.

Gnome Shell extensions aren’t sandboxed or limited in any way; they can use sockets, HTTP requests, spawn external programs, create/delete files and anything else a “real” program can do. The catch is they can also crash things like any other program, which why the review process can be quite long; but still you can’t test for everything.

To my knowledge there aren’t any (current) start-to-finish tutorials for writing extensions, but their are ‘gjs’ and ‘gnome-shell’ tags on StackOverflow, #javascript and #gnome-shell channels on GimpNET (IRC) and most extensions list their Github repository on the official website. Most of the gnome-shell UI is written in JS too, so you can learn a lot about writing extensions just from reading that code.

## Rene Reichenbach

VSCode Search Provider

3 words …

awesome awesome awesome !