Geany on Ubuntu Touch device as text editor, source code editor, debugger and compiler for multiple languages

Just today I have commited an answer to Quora: Which is a good editor for writing C++ programs on the Ubuntu platform? after mistakenly reading that it was about Ubuntu Touch, when it was actually about Ubuntu in general.

So I decided to bring the content here, where it will not be an out-of-place content by mistake.

Geany is a GUI text editor which also supports multiple compilers including gcc or Free Pascal (fpc) which I use it mostly with. It also supports syntax highlighters for plethora of languages and formats. It is a GTK app, but you can get it up and running on your phone directly, without any container like Libertine. Without further do, below is the content I made on Quora.

Although I almost entirely write apps for UT devices in Pascal, but I did write a little in C++. I did not find any IDE as good as Lazarus IDE for Pascal, but at least for non GUI apps, I found Geany pretty convenient. It supporst many compilers, including gcc. Also it supports syntax highlighter for many languages, including C/C++.
When installed on the UT device, naturally it runs via Xmir. I tweak the settings in ~/.config/geany/geany.conf file, because when I use it on my phone I do not load any window manager. So I edit this portion of the config file:
  1. fullscreen=true
  2. geaometry=0;0;1100;1050;0;
I use it on Meizu MX4 Pro phone, and I fix the width of the editor to the width of the screen, but I make the height smaller, to fit the onscreen keyboard, because otherwise the OSK would overflow the editor and your text cursor may end up hidden behind it:
*above are screen captures from my Meizu MX4 Pro Ubuntu Edition
If you can connect a wireless keyboard/mouse dongle, like BT set, via USB to OTG adapter, then you can use geany on your UT device with a mouse pointer and keybouard, and you will not need OSK at all, in which case you can resize the window to entire working space. Also, with wireless keyboard you can use Ctrl+Scroll shortcut to resize font size, because by default due to high DPI on the device screen, the fonts will look very tiny.
Off course if you want to actually compile the program, you will need to install build-essential package on your phone, because is does not come included in the default system image, even now that Ubuntu Touch is continued by UB Ports. It contains thinks like linker etc., so install it along the gcc package.
Another crucial thing missing from the default image are maliit context packages maliit-inputcontext-gtk3 and maliit-inputcontext-gtk2. Without them, you won’t be able to use OSK with Geany, because it is GTK app running on your UT device via XMir, and only native Mir apps have maliit context package installed by default. Which is kind of weird for my, that Xmir is icluded by default, but if you want osk, then you need to install its context manually.
Anyways, to install these packages on your UT device, you can follow this routine, which accounts for the fact that by default the / partition on UT devices is mounted as read-only:
  1. sudo mount -o remount,rw /
  2. sudo apt-get update
  3. sudo apt-get install gcc build-essential
  4. sudo apt-get install maliit-inputcontext-gtk3 maliit-inputcontext-gtk2
  5. sudo apt-get install geany
  6. #the last command might throw some errors due to unmet dependencies
  7. #in which case the next command will take care of that:
  8. sudo apt-get -f install
  9. sudo moune -o remount,ro /
Also, if you use geany, then you can debug and run your programs directly from within it. You won’t need to go into terminal app to do it manually. And it is true not only for gcc, but any supported compiler. For example, if I don’t do GUI app, then I often use Geany with Free Pascal compiler as a lighter alternative to Lazarus IDE. Geany supports a number of compilers for plethora of languages.
Finally, I want to make a remark, that if you decide to install Geany directly into your phone - and by directly I mean notinto any container like Libertine, but pure straight into the phone itself - then along with it some dependencies will be installed and it will use up space on your limited / partition. If you’d like to save as much space as possible, you can manually try to install Geany somewhere in your home folder. This is somewhat of a hack, but not too difficult either. You need to download .deb packaged for geany from the default repo, then extrac tits content to some place in your home directory, and manually create some symlinks to your / partition. So that only the symlink leaves a tiny footprint, while actual data is stored in your user space. If you want to take that path, know that you need 2 packages: geany and geany-common:
  1. cd ~/Downloads
  2. apt-get download geany
  3. apt-get download geany-common
I found that you don’t even need all of the provided content to use geany. I only extracted binary from geany package’s usr/bin/geany, .desktop launcher from usr/share/applications/geany.desktop and icon file from usr/share/icons…(few options, I chose svg). Note that the paths are relative to the root of the deb archive, because deb files are just compressed archives.
Then from the geany-common package I only had to extract usr/share/geany folder and symlink it as /usr/share/geany.
Then last step was to tweak the original geany.desktop launcher to this:
  1. [Desktop Entry]
  2. Name=Geany Portable
  3. Comment=Geany Portable
  4. Exec=/home/phablet/.local/OpenSoftwareHub/geany-portable/usr/bin/geany
  5. Icon=/home/phablet/.local/OpenSoftwareHub/geany-portable/usr/share/icons/hicolor/scalable/apps/geany.svg
  6. Type=Application
  7. Terminal=false
  8. X-Ubuntu-Touch=true
  9. X-Ubuntu-XMir-Enable=true
This is to ensure that Xmir is used to run geany, which is a gtk app. Also, you need to fix your paths accordingly, because you might have extracted files to a different location. I covered some more info related to this in my blog post here: X applications on Ubuntu Phone. After this, you have a working Geany launcher on your Apps scope on your UT device:
*an actual screen capture from my Meizu MX4 Pro Ubuntu Edition
A bonus feature is, that when you now ssh into your UT device with X forwarding flag:
  1. ssh -Y (or ssh -X) user@address
then you can use geany to edit any files on your UT device including system config files, with the convenience of a GUI editor rather than some vi or nano (although I always use mcedit from mc package). That means, that after I ssh into the phone (remember to turn on X forwarding) I can run geany off my phone onto my desktop’s screen.


  1. Nice post.Thanks for sharing such a valuable and informative blog. Please read my blog too
    Buy Nembutal Injectable Online (10 Ml)
    We sell quality 100 ml Nembutal (Pentobarbital sodium)Injection Solution (300mg/ML) CAS Number 57-33-0 online at a low and reasonable price without any a compromise on quality and purity of our Nembutal.

    Buy Nembutal Pills 100mg Online (100 Pills)
    Some people find nembutal pills more convenient to take than nembutal oral solution and nembutal injectable solution.Nembutal pills are very efficient for Voluntary euthanasia. The right lethal dose will lead to a peaceful and painless death within a few minutes.

    Buy Potassium/Sodium Cyanide Powder Online(50 Grams)
    Not all products are always readily available for purchase. One such item is the potassium cyanide. However, if you want to make a potassium cyanide buy online, you are in the right place. Our online store distributes the best quality potassium around the world. Our colorless crystalline is famous due to its exceptional and extremely high-quality properties. Whether you are a jewelry dealer or an individual who wants to end his or her life, you will love it.

    Buy Potassium/Sodium Cyanide Solution Online (100 Mg).
    Making a cyanide poison buy online is not always an easy feat. Alternatively, is it? For those who are not aware, cyanide is a traditional highly toxic chemical that can cause death if you use the right concentrations. However, buying it is close to impossible. According to the peaceful pill handbook forum, some people have been purchasing cyanide from China. The peaceful pill handbook also provides information on how to manufacture cyanide. You can also find many details on the same on the internet.


Post a Comment

Popular posts from this blog

SSH and Ubuntu Touch - everything you want to ask but are afraid to ask

Lazarus IDE on ARM Ubuntu (Raspberry Pi, Ubuntu Touch, etc)

Console vs GUI application in Object Pascal - is it either-or?