Using Geany for C++ and GTK programming

Previously I had been using VS Code for my programming. That all changed when I came to Manjaro. When I copied the files from my VS Code install from Pop!-OS to Manjaro, they broke. VS Code couldn’t find my compiler, it couldn’t do code completion, and it generally only worked as a text editor.

VS Code is very difficult to set up under Linux in the first place. It needs a copy of all the include files as well compiler and linker options. Entering all these files into VS Code can be quite tedious. And worse, if you enter something wrong, things begin not working correctly. Programming under Linux is different, however. It has tools that take care of most of these annoyances for you. All you have to do is use the tools that are designed for Linux programming.

With that in mind, I still spent a little while trying to track down the errors that were preventing it from finding my compiler then decided it might serve me better to see what other options I have at my disposal.

I am very glad that I did. I found something that works better than VS Code, is lighter, faster, more configurable, works seamlessly with the tools that I already use, and has easy access to code completion as well as all the other perks that I like to have in a light weight IDE.

Installing Geany

To install Geany on Manjaro, all you have to do is search for Geany using the pamac package manager. With one click and your password it will be installed and ready to use. It will already be set to use make and makefiles. It had no problems finding my compiler, and the syntax highlighting worked flawlessly right out of the box.

But there is one more thing that I added to Geany to make it superior to VS Code in every way. I added code completion. And while VS Code does code completion with enough work, it is simple to set up with Geany.

Code Completion in Geany – autocomplete

Geany uses specially created “tags” files for its autocomplete. While you can make these files yourself, you can also download tags files created by others that you can add to Geany so that it can autocomplete your language of choice as well as other things like GTK, Qt, and gtkmm. Simply choose the files corresponding to the language/libraries that you want Geany to autocomplete – or download them all – and add them to Geany’s configuration.

There is a collection of files on Geany’s Wikipedia page for tags files that are available for anyone interested. While I might download more in the future, I have selected one for the standard C++ headers, one for the standard template library, and one for GTK C++ interface which is what you need to work with gtkmm.

Once you have downloaded the files you want, you need to copy them into Geany’s configuration folder.

Geany has two different locations where it stores configuration data. The first place is global data. The second place is where you want to put copy the tags files to.

You can check where Geany’s configuration locations are by starting Geany, selecting Help then Debug Messages. In the messages you should see something like this:

Geany INFO : System data dir: /usr/share/geany
Geany INFO : User config dir: /home/(username)/.config/geany

If your version of Geany uses the same locations as mine does, then you can open a terminal in your home directory and type the following commands:

cd ./config/geany/tags/

That is the directory you want to copy the tags files into.

Assuming you downloaded the tags files into the Downloads directory, you could type the following commands into the terminal to get the files into the proper directory.

cd ~/Downloads/
cp *tags ~/.config/geany/tags/

Once this is done, start Geany and it should have code completion working.

Setting up Manjaro for C++ programming using GTK

Manjaro is the first Linux distribution that I have used that wasn’t a branch off of Debian. While many things are the same, there are some notable differences. One of those differences is what it takes to set up a programming environment. With Debian based systems, you could get most of the requirements with a single command:

sudo get update && apt-get install build-essential

With Manjaro, however, there isn’t a single installation that will pull most of the build requirements to your computer. But that doesn’t mean that it is difficult to set Manjaro up for programming, it is just different.

Finding the necessary applications

Instead of having a meta package that will install all the other packages, Manjaro has a group that you can look up under the pamac program manager. The pamac program manager is also shown simply as “add/remove software” in the menu. If you are using the Gnome desktop environment, it will probably also have a shield icon on the bar at the top of your screen.

To find the necessary programming applications, open pamac and search for the following:

base-devel

Searching for “base-devel” will show you a group of related applications that are necessary for programming. Some of them will already be installed on your system. Others might not be needed depending on the kind of programming you want to do.

Here is the list that I currently have installed:

automake
binutils
file
findutils
gawk
gcc
gettext
grep
groff
gzip
libtool
make
pacman
pkgconf
sed
sudo
texinfo
which

Since I want to create graphical programs using the GTK toolkit, I also did the following search:

gtkmm3

and added the following packages:

gtkmm3
gtkmm3-docs

The gtkmm3 package is a C++ wrapper for the GTK toolkit. It allows you to access all of its classes using standard C++ syntax to create programs that natively use GTK (also sometimes called GTK+). This will allow your programs to run natively under both the Gnome and Cinnamon desktop environments. And of course the gtkmm3-docs package is the documentation that goes along with it.

This should give you all the tools you need to build C++ programs with Manjaro. In a future entry, we will look at installing and setting up the “VS Code” text editor.

Manjaro Gnome edition

I have made one more distribution switch. I am currently using Manjaro, and if things continue to work out as well as they have, I will be sticking with it. I currently have my laptop set up to dual boot Manjaro and Pop!-OS 20.10. I am doing this because I am still a little fearful of the stability of rolling releases. This way, if Manjaro were to die on me, I could use Pop!-OS until I could properly recover my system.

Continue reading Manjaro Gnome edition

Nice firmware you got there…

It would seem that Gnome does something that I never expected. While there might be other desktops that manage updates for firmware, this is the first time that I have ever had a computer simply take care of firmware for me.

When I first installed Pop! OS to get the Gnome desktop, I did the obligatory look through the settings menu setting up my preferences.

Side note, in case you are wondering. My eyes have never been very good, and they have only gotten worse with age. One of the first things that I do is change the font scaling factor so that I can read the screen better. Accessibility features on Windows were never as good as they have been in the Linux ecosystem as far as I’m concerned. While I can’t say that is true for all distributions of Linux, it has been true for every one that I have tried.

Anyway, I noticed that there was a tab for firmware in the settings menu. I looked in it and there was nothing there. Now I never gave much thought to what firmware Gnome would be looking for. I assumed that it would primarily be interested in the computer’s bios and that was about it. I even considered whether it was something specific to Pop! OS being tightly integrated with their hardware. Essentially, I mentally shrugged and moved on with my life.

Gnome desktop automatically found updates for my keyboard and mouse

Yesterday a notification popped up telling me that there were two pieces of firmware on my system that could be upgraded. Surprised, I looked over the firmware to see what it was. The firmware showed two entries for “Unifying Receiver.”

Perhaps I should explain a little bit here. I have three little USB pimples plugged into my laptop. I have one for a Logitech wireless mouse, one for a Logitech wireless keyboard, and a third or a Logitech wireless touchpad/keyboard combination. I had manually updated the USB pimple for the Logitech wireless touchpad/keyboard combination when I was still using Windows. In fact, it was one of the final straws that finally motivated me to give Linux another try after trying it more than 20 years ago. But that’s another story.

The reason that I have so many USB pimples plugged into my laptop is because I have keyboards at both my home and office. Since I use keyboards extensively, I have purchased vastly superior keyboards to the built-in one. This isn’t a knock against the laptop’s built-in keyboard. In my opinion, a separate keyboard can always be superior to a built-in keyboard since they aren’t limited by the constraints of having to fit into a laptop housing. At the same time, I don’t want to lug those wonderful – yet huge! – keyboards from place to place. To solve that problem, I use one keyboard at home, one at the office, and the laptop’s built-in keyboard if I find myself working from someplace else.

So when Gnome found the updates to my “Unifying Receivers” firmware, I didn’t really know how to react. When I clicked on the notification Gnome opened up the settings menu and went to the firmware tab. There was a button beside the entries for the “Unifying Receivers” saying to click it to update the firmware.

Of course I clicked it.

Then I waited.

And waited.

It never showed a successful update

Previously I mentioned that I had updated one of the receivers under Windows. I had a problem between Windows 10 and the keyboard I used at home. After a ton of searching online, I found an entry on a random message board mentioning that there was updated firmware for the keyboard I used at my house.

I had to download the firmware updater and run it. It found all the different USB pimples on my machine and basically freaked out. It said that it could only update them one at a time. I removed the all the receivers from my USB ports except the one associated with the keyboard and tried again. It worked, and showed me great fanfare when it was finished about how it had successfully updated the firmware.

Since Gnome gave me no indications whether it was successful or not, I had no idea whether it worked or not. And since I didn’t bother to remove any of the USB pimples from my machine prior to initiating the firmware upgrade, I feared the worst.

I learned how to update firmware manually on Linux

I did a quick search on failed firmware updates using Gnome and found an article showing the kind of errors that Gnome displays if it fails in addition to instructions on how to manually update firmware on Linux.

Well, I didn’t get an error message. Still, after all the fanfare from the updater I had to download for Windows 10, I expected some kind of message telling me that everything was successful.

I followed the directions in the article. I checked for updates using the command line. Sure enough, it found the updates for my little USB pimples. I then told it to install them only to be told that the latest versions were already installed.

Too good to be true

What I discovered through this little adventure was that I was still expecting things to be done in the Windows way instead of the Linux way. I was expecting it to be complicated. I was expecting to have to jump through hoops and be rewarded by bells, whistles, and flashing lights telling me that my operating system had done something magnificent for me and that I should be eternally grateful. I never expected it to just quietly do what I told it to do and let me get on with my business.

It seems like even when the operating system is so powerful, or the user interface is so easy, I have still brought many expectations with me to Linux that I didn’t even realize that I had. These expectations aren’t show shopping expectation; instead, they show how simple things can be.

That said, I wouldn’t have minded a little notification telling me that the firmware had been flashed successfully.

I have switched to Pop!OS version 20.10

Even though Pop!OS version 20.10 will only have support for about 9 months, there was just too much that I wanted to try to pass it up.

I wanted to try Gnome version 3.38

Even while I was a Windows user, I loved the idea of Gnome. When I started developing GUI based software, I didn’t want to make it locked to Windows. Even way back in the days of Windows 3.1, I liked the idea of open source. To me, Gnome seemed to be the pinnacle of open source, cross platform GUI components for languages such as C and C++.

Another thing that made me really want to try Gnome was Derek Taylor (DT) over at Distro Tube. While he isn’t a big fan of Gnome (to put it mildly) he has created a lot of videos talking about the advantages of tiling window managers. I have watched enough of his videos that I began to want to try them out as well.

The Gnome version in Pop!OS not only has a tiling window manager built in, it also has the ability to stack those tiles together so that they will fit even better on my smaller screen and be more easily viewable by my aging eyes.

Finally, what sealed the deal for installing the Gnome desktop was the GNOME Code of Conduct. With a code of conduct like this in place, I feel like I can actually participate in the community without having to hide a major part of myself from others out of fear of being harassed. And truth be told, I can’t really hide myself from others. Anyone that knows me knows that I tend to stand out in a crowd.

Pop OS doesn’t install easily in a dual boot configuration

Once I downloaded Pop!OS, I set aside some time on the weekend to install it on my system. While I really wanted to switch to a Gnome desktop, I didn’t want to give up Linux Mint, nor did I want to completely remove the copy of Windows 10 I had on my computer. After all, I had been using Windows on this computer since Windows 8.1 and there was a lot of stuff that I had accumulated on it. Not only that, but Linux Mint was a dream operating system. As far as I’m concerned, it is a drop-in replacement for Windows. It is so easy to use and has the feel that every Windows user has come to expect from a computer that I wanted to keep it as well.

Finally, since Linux Mint was relatively new on my system and my Windows install was full of data, I decided to overwrite the Linux Mint install with Pop!OS. That’s when the problems started.

The Pop!OS installer doesn’t have an easy way to install it on a dual boot system. It expects to be the main, and only, operating system on the machine. While it can be configured manually to install in a dual boot system, it takes some knowledge of disk partitioning, formatting, and telling the Pop!OS installer where to put things.

That’s when I realized just what a mess my hard disk was in after so many operating system upgrades. There were Windows 10 partitions, Windows reinstall partitions, boot partitions, Linux Mint partitions, and a few others that I didn’t bother to pay any attention to. Many of those partitions were fragmented, and the thought of trying to find a descent place for Pop!OS in the middle of that mess just seemed like a bad idea.

Looking at that mess, I decided that it was time for Windows to go.

I threw caution to the wind and threw Windows away

I knew that I needed to erase my hard disk and start over. I didn’t think about it for long because I knew that if I thought about it, I wouldn’t do it. There was just no other choice. I needed a fresh start.

I rebooted my system with the USB key containing a copy of the Pop!OS 20.10 iso and told it to just use the entire hard disk. The installer was more than happy to clear everything and put a fresh copy of Pop!OS in place of all the convoluted partitions.

It wasn’t until after my hard disk was cleared that it occurred to me that there might have been pictures, documents, tax returns, old code, and other important things on the hard disk that weren’t stored anywhere else. It left me with a sinking feeling in my stomach and an uneasy feeling in my mind.

Initial problems with Pop!OS

It was in the overly tired, messed up, scared frame of mind about possibly destroying needed information on my Windows partitions that I tried to get some things working on Pop!OS. There wasn’t anything in Pop!OS itself that wasn’t working, but since I work on a laptop, on the go, with a metered connection, it was important that I have something to see at a glance telling me how much data I have used. That necessitated that I learn how to install extensions.

Extensions weren’t anything new to me. In fact, most desktops use extensions of one kind or the other. Having never used Gnome before, I had to learn how to install them on the Gnome desktop. Then, in the process of finding the extensions that I needed, I discovered that they weren’t updated for the latest version of the Gnome desktop since it had just been released.

There was another problem that I had when I installed Pop!OS. I had changed some of the configurations in my bios, and I had messed up. It wasn’t that the computer didn’t boot, but it was having a tremendously difficult time and took forever.

In my sleep and fear addled mind, that was a bridge too far. I reached for my USB key with my copy of the Linux Mint 20 iso on it.

I reinstalled Linux Mint 20

It was in the process of reinstalling Linux Mint 20 that I discovered that I had inadvertently changed the wrong setting in my computer’s bios. It was also too late to save the installation of Pop!OS, but it did give me a fresh install of Linux Mint 20.

With all the cruft of Windows 10 and its predecessors removed, Linux Mint booted faster, cleaner, and better than ever before. It was like getting an upgrade just by wiping the hard disk and starting over. Granted, since this is an old computer to begin with, it isn’t nearly like getting a new machine, but I don’t think that I have ever seen better performance on this machine than I have after cleaning the hard disk.

The only thing left was to reinstall all the packages that I had installed on Linux Mint previously.

It was actually easier than I thought it would be. I already knew what I wanted. Going straight to the command line, I quickly added back all my favorites. But that still left me wanting to use the Gnome desktop.

Installing the Gnome desktop on Linux Mint 20

I had read an article about how to install the Gnome desktop on Linux Mint 20. It is actually pretty easy. Since I still really wanted to switch to the Gnome desktop, or at least give it a proper try, I decided to install it on Linux Mint 20 even though there are plenty of people that recommend against it.

I followed the directions of the article, but I didn’t install the Gnome desktop manager (GDM3) in place of the desktop manager that came with Linux Mint 20 (LightDM). I also didn’t remove the Cinnamon desktop from Linux Mint 20. I kept them both installed even though it is discouraged by many people.

Using Linux Mint with the Gnome desktop, I learned how to install extensions. After a little reading, I discovered that the easiest way is to install them is through your browser. With a few plugins and the directions provided by ‘It’s FOSS’ – the second method in particular – I had everything up and running on Linux Mint to give Gnome a better try.

Gnome on Linux Mint 20 is fast, sleek, and uses less memory than the Cinnamon desktop. It was a wonderful experience. I have noticed that it doesn’t work perfectly. There are a few things that Gnome says it will do that just don’t work. Perhaps this is because I didn’t change the underlying desktop manager from LightDM to GDM3, or perhaps it is something else. I also can’t help but wonder whether the combination of Gnome and Linux Mint is a bad idea. Perhaps the reason that the Gnome desktop is so light on resources is that the Gnome desktop on Linux Mint just isn’t running all the software that it should – like the system update utility. I will have to look into these possibilities later if I decide to keep the Gnome desktop on Linux Mint.

Honestly, other playing with it for a few hours, I don’t have much experience with the Gnome desktop on Linux Mint. But there is a reason for that.

Since the version of Gnome available from the Ubuntu repositories (which Linux Mint taps into) is an older version as well as not having the built-in tiling window manager available through Pop!OS, I was still left with a desire to try Pop!OS again.

I finally installed Pop OS 20.10 manually as a second system using dual boot

Pop!OS can be installed in a dual boot system, but you have to do the partitioning manually. Still having a desire to use the latest Gnome desktop in addition to the enhancements made to it by Pop!OS, I decided to install it the next day.

I booted with a USB drive containing the Pop!OS iso of 20.10. When it reached the part asking to use the entire drive, I selected advanced and looked at the new layout of my hard disk. My hard disk was so much cleaner and better prepared than it had been just one day before. Now, instead of partitions strewn in a seaming random fashion across the hard disk, there was just two partitions: a small boot partition at the start of the drive, and a massive partition containing Linux Mint 20.

I resized the Linux Mint 20 partition down to about half the drive so that I could use the other half for Pop!OS. While I was at it, I created a swap partition for Pop!OS as well.

Linux Mint 20 uses a swap file instead of a partition. But I noticed that when I installed Pop!OS previously on my system that it used a swap partition instead. Since there was so much room, and since the drive was so organized, I didn’t mind creating a swap partition for Pop!OS. Keeping in mind that this is an older system, I even thought it might make it perform faster than it would with a swap file. I even went as far as to make the swap partition twice the size of the one that Pop!OS originally created in the first install.

Pop!OS had warned me that it needed at least two partitions: one for its EFI, and one for the operating system itself. Since Linux Mint had already created an EFI partition, I skipped that one.

Once the partitions were created, I had to tell the Pop!OS installer which ones to use for what. I told it to use the big one for the operating system, the small one for a swap partition, and the boot partition Linux Mint created for its EFI partition.

Pop!OS accepted these instructions and happily installed.

When the Pop!OS installer was done, I rebooted my system. My system ignored the GRUB bootloader installed by Linux Mint 20 and booted directly into Pop!OS. As far as it was concerned, it was the only operating system on the computer.

I rebooted the system again, this time pressing the F12 key and entering the EFI boot options supported by the bios. There was the main entry for booting Pop!OS in the first position. I moved “Ubuntu” (which the Linux Mint 20 boot loader calls itself) to the first position and booted into Linux Mint 20.

Once Linux Mint 20 was running, I changed the font setting as well as the login wait time in the GRUB configuration file and told GRUB to update itself. GRUB found the EFI data for Pop!OS and added the settings for booting it to the menu as well. Now when I boot my system I have a choice whether to boot into Linux Mint 20 or Pop!OS 20.10.

The result

I have installed all the software that I use on Pop!OS and can now boot into either system at will. I absolutely adore what I have seen of each system so far. And as for the Gnome desktop, it was well worth all the hassle to clean up my computer to use it.

I even found better extensions to add to the Gnome desktop to keep track of how much data I use. While it was a long and circuitous road to get everything up and running, everything now works better than I had ever dreamed.

If I were going to change anything, I would have taken the time to boot into Windows and make sure that I had backed up all the information that I had accumulated over the years. Then I would have wiped the drive and installed Pop!OS and Linux Mint correctly from the start.

I have transitioned to Linux

TL:DR – The Cinnamon desktop version of Linux Mint is a drop-in replacement for Windows. Any Windows user should be able to use it right out of the box. You can use it the same way that you used Windows and simply get back to doing the things that you bought your computer for in the first place.

My experience:

I didn’t really know where to start this post. I tried Linux once 10, maybe 15 years ago. While I was able to get it working, it took me several days to get it completely usable. But even as I got all the hardware working on my system, I still had to actually learn the intricacies of Linux itself. I didn’t know it at the time, but I had chosen the wrong distribution. Maybe my experience would have been better if I had known a little bit more before I installed it.

Fast forward to today. I have been hearing that Linux was ready for the desktop for several years now. After the time I wasted on it in years past, hearing that it was now ready for the desktop still wasn’t enough to get me to try it again. That changed one day when I had just a little bit too much aggravation trying to fix a problem with Windows that just wouldn’t be fixed.

Following the advice of a YouTube channel that I had absolutely no reason to believe, I chose Linux Mint as my distribution to try this time. Chris Titus of Chris Titus Tech was the channel that gave me all that wonderful advice.

I thought I would wait until I had enough experience and knew enough about Linux to begin to have valuable information to discuss. I expected to have to wrestle with Linux Mint to get it to work with all my hardware. Once installed, I expected to have a rather steep learning curve before I could actually get anything done on my computer. None of these things turned out to be accurate. What I found was that the transition to Linux was so easy that it was basically just put Linux Mint on my system and go to work.

There are a few things that I believe really helped me make the transition as easy as possible. And only one of those things had anything to do with Linux itself.

For starters, I have been using open source software on Windows as far back as I can remember. I hadn’t used Microsoft Office since college. It is just too expensive unless you have an absolute need for it. Instead, I used OpenOffice followed by LibreOffice. I never used Photo shop. I used Gimp and Krita. For programming, I always used the gcc and g++ compiler. While all of the software that I used worked quite well on Windows, there wasn’t any software that I used that would only work on Windows.

The one thing Linux had to do with making the transition easy was the distribution (distro) that I chose. Linux Mint (with the cinnamon desktop) was supposed to be an easy distro to work with coming from Windows. And it was more than I could have ever expected.

Why you ask? Well, if you can navigate and run Windows, you can navigate and run Linux Mint. You don’t ever have to use the terminal (command line) unless you just want to. All the necessary programs are already installed on the system, and getting most others that you might be interested in are actually easier than getting them on Windows. Linux Mint, as most distros now, come with a software manager for installing a plethora of programs that are already tested to work with that distro. Simply select the software that you want, click install, provide the password you created during setup, and your new software will be downloaded and installed. It’s that simple.

The last time I worked with Linux, such things weren’t available.

So Linux Mint is essentially a drop-in replacement for Windows. Coming from the Windows world, it is easy and intuitive.

On the same day that I installed Linux Mint – without a single problem – I was surfing the Internet with my favorite browser, writing in my favorite office suite, watching movies on Netflix, and generally getting on with my life.

Switching to Linux was both easy and painless. But even better than that, I have found that I am able to get more things done, and do them faster, than I could on Windows. Linux Mint, or Linux in general, might not be for everyone. Mostly it depends on what you need out of an operating system. But one thing that I can tell you is that if you think Linux might be something that is useful to you, it is absolutely as easy, powerful, and productive as any other operating system.

Getting Python running under Linux Mint 20

I recently installed the latest version of Linux Mint on my machine. As wonderful as this operating system is, I have still run into one problem. On occasions, python scripts would fail. Linux Mint comes with Python 2 and Python 3 installed by default. So why would it fail?

Python can fail to run on Linux Mint due the way that certain scripts call on python.

At the start of a script in Linux it has a “shebang” telling Linux what interpreter it needs to run. It looks something like this:

#!/usr/bin/python

When the script writer calls for ‘python,’ they are actually calling for Python 2. The problem is that Linux Mint, while having Python 2 installed, doesn’t have a link to it called ‘python.’

The solution is simple. All I had to do was add a symbolic link for ‘python’ to call ‘python2.7.’ To accomplish this, I did the following:

  • Open a terminal window.
  • type ‘cd /usr/bin’
  • type ‘ls python*’

At this point, I saw that Linux Mint had Python 2.7 and Python 3.8 installed. It also had symbolic links connecting python2 to Python 2.7 and python3 to Python 3.8.

I added a symbolic link called ‘python’ and connected it to python2.7. To do this, type the following:

sudo ln -s /usr/bin/python /usr/bin/python2.7

You will then be prompted for your password. If successful, you will have created a link in the /usr/bin directory called ‘python.’ When a script tries to use ‘python’ it will be sent to the Python 2.7 interpreter and should run normally.