Gtkedit - A notepad clone based on GTK+

What is it?

Gtkedit is a simple editor, written using the GTK+ 1.2 toolkit. It aims to be (in that order) light, useful and simple (source code-wise).

Being a simple project, it also can serve as a real world GTK+ tutorial.

To sum it up: gtkedit is the little unsexy app everybody needs to have ;-).

What? another editor? Don't we have enough of them already? - I hear you saying.

Well, yes, indeed. There are quite a lot of different - and not so different - editors one can download from the Internet. Anyway...

  1. I wanted a simple project to try GUI programming in Unix.
  2. I have an old machine (Pentium 166 MHz, 32 MB RAM) with Slackware Linux 9.0. This machine runs Xfce 3.8, based on GTK+ 1.2.
  3. There's no decent GUI editor for this machine. All are too slow, too bloated or too ugly.

OK, In fact I did found an editor that works fine. It's called gnotepad+, but it too takes too long to load (about 2 seconds) in this old machine. There's plenty of room for improvements here, I thought.

And so gtkedit begun. I only wanted the most basic editing features: cut, copy, paste, basic undo/redo... nothing fancy. The obvious model to copy was, of course, Notepad.


Do you want to see what it looks like? Great, this is an screenshot of gtkedit editting its own code:

screenshot of gtkedit

Surprised? I guess you are not. This is a feature not a bug!


The project is currently hosted by There you can download the source code or a pre-compiled binary.

The binary was compiled with Slackware 9, and tested to run in a Madriva 2005 LE machine. Should this binary not work on your system, you just have to download the source and compile it.

Using the editor

gtkedit is very simple to use. It understands the basic common shortcut keys, like <Ctrl>C for copy. You will find them listed next to each menu item.

Very basic undo/redo capabilities are provided, because the editor can only undo the very last text insertion or removal.

You can find and replace text, and there is a menu option that will allow you to quickly go to any particular line, which is handy if one is writting a program and wants locate an error line.

One useful feature is the ability to open files by dragging them from your file manager into the editor window, replacing the current open one.

Finally, you can change the font used for text display, or toggle the wrapping of long lines by means of the "Format" menu. Gtkedit will remember those settings, along with the window size (they are saved to a file named ./gtkeditrc in you home directory.)

Compiling and running

Gtkedit uses the GNU gettext library for translation. It is included with the GNU C library, and is a requirement of GTK+, so the odds are that you have it installed in your system.

To compile the source, issue the following command from a terminal window:


Alternatively you can compile the program with the following command:

gcc $(gtk-config --cflags --libs) -O -o gtkedit gtkedit.c

I assumed you use GNU bash. If you use any other shell, use this instead:

gcc `gtk-config --cflags --libs` -O -o gtkedit gtkedit.c

Beware of the back-quotes (`), as they are not the same as single quotes (') if you happen to be a Unix shell.

Once the compilation finishes you can start the program with the command:


This opens the editor with a blank unnamed file. You can add the name of a file to have it loaded, if you wish. Alternatively you can use the file manager to drag file over the editor window.

If you like the editor and plan to use it frequently, it would be wise to put it somewhere in your path, for example in /usr/bin or /usr/local/bin, and create a shortcut in your desktop.

If your primary language is not English you may want to install one or more of the translations modules, found in the po subdirectory. Each module name is the ISO code of the language it adds. For instance, is the Catalan language module.

For example, to install the Catalan language translation you should issue the following commands:

password: *****
cp po/ /usr/share/locale/ca/LC_MESSAGES/

There are a couple of important things to note:


If you want to help (that's the best part of this thing called Open Source) you can by translating gtkedit to your native language. To do this you should do the following:

  1. Download the latest source code from Sourceforge. Inside the tarball you will find the gtkedit.pot. This POT (Portable Object Template) is a text file with all the strings in the application.
  2. Translate the strings in the gtkedit.pot file and save it as <language-code>.po, where language-code is the ISO 2 letter code for your language. Since the .POT file is just plain text you can edit it with gtkedit itself, although I strongly recommend using an specialized editor like poedit. Be sure to fill in the Copyright and license comments. For simplicity, I will only accept translations under the same license as gtkedit.
  3. Send the translated file to me, or better yet, publish it in the Developers forum.

Of course, other contributions will be welcomed too.