You Got A Question? Ask    GNOME Community!

Add GEdit Integration With FPaste

GEdit 3.11.x is the only module from GNOME.Next I have linked against GNOME 3.10. Actually this is a bad practice, because you can mess up your configurations files, but gEdit is sooo good ;)

GEdit 3.12 added a patch to External Tools that enables us to send our scripts from gEdit to Fedora’s Paste Bin. You can also use this to older gEdit versions. I tested on GNOME 3.10, but I will show it in GNOME 3.11.x.


To use it, you need to get Fpaste.

$ sudo yum install fpaste

FPaste tool, it just sends an output to Fedora’s Paste Bin Online Service. For example check the following figure.


In the first Terminal I output the ls on screen, and on the second terminal I send ls output to FPaste. Of course you can also send files, for example

$ fpaste myfile.txt

GEdit & FPaste

GEdit 3.12 added a script that automates the previous job. You select some text in GEdit’s editor, you press a keyboard-shortcut and your text goes directly to


This is supposed to already work by default in GEdit 3.12, but for some reason I had to do it my self. Some bug I guess.

To activate it, we create a new Tool, we add the code to be executed, and we assign it to a Shortcut, in my case <Shift><Super>+p.

You can do that also in GEdit 3.10. The code:

#!/bin/env python3

import os, urllib, json, sys, urllib.request
from gi.repository import Gtk, Gdk

current_document_path = os.getenv('GEDIT_CURRENT_DOCUMENT_PATH')
selected_text = os.getenv('GEDIT_SELECTED_TEXT')

if selected_text is None:
    selected_text =

url_params = urllib.parse.urlencode({'paste_data': selected_text, 'paste_lang': lang, 'mode':'json', 'api_submit':'true'})
openfpaste = urllib.request.urlopen("", bytes(url_params, 'utf-8')).read().decode("utf-8")
final_data = json.loads(openfpaste)

paste_url = "" + final_data['result']['id']

print(paste_url + " has been copied to clipboard.")

disp = Gdk.Display.get_default()
clipper = Gtk.Clipboard.get_for_display(disp, Gdk.SELECTION_CLIPBOARD)
clipper.set_text(paste_url, len(paste_url))

It’s a good idea to get the code from Online, if they do some future updates. Obviously you can use some other pastebin tools and services like that.

  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community