DEV Community

Cover image for Gnome plugin with Python

Posted on

Gnome plugin with Python

You can create Gnome 3.x plugins straight from Python. Of course, you should know Python programming. It's not that hard to do. Great! how do you create a plugin?

Do you use/like Gnome desktop? It's the default desktop on many Linux distros like Ubuntu, Debian, OpenSuse and others.

It's this one:

The setup

It takes some setup before you can run Python script on the gnome desktop. I've tested this on then newest gnome desktop, it may not work for classic gnome desktop (mate).

Setup the argos plugin and enable it using gnome tweak tool.

Click extensions and enable argos. If you don't have tweak tool, run this command

sudo apt install gnome-tweak-tool
Enter fullscreen mode Exit fullscreen mode

Create the gnome plugin

Then open a terminal (Ctrl+Alt+T) and type this

cd ~/.config/argos
Enter fullscreen mode Exit fullscreen mode

or any other editor.
Paste the Python code below.

#!/usr/bin/env python

import re
from gi.repository import Gio

print("Python | iconName=starred") 
print("Gedit | iconName=gedit bash=gedit terminal=false")
print("Nautilus | iconName=system-file-manager bash=nautilus terminal=false")
Enter fullscreen mode Exit fullscreen mode

Save and close. Then type

chmod +x
Enter fullscreen mode Exit fullscreen mode

You should now see the Python script output in your tool bar. The plugin argos will scan the directory ~/.config/argos constantly for changes.
Any file you place in there is a plugin.

Alt Text

Related links

Top comments (1)

omidziveh profile image
omidziveh • Edited

Thank you for your post.
I love to learn how can I make extensions for ubuntu
but I've got some problems.
when I click on the python button in my top bar , it doesn't do anything.
what shall I do?
and I have ubuntu 20.04