DEV Community

Cover image for How I added an overlooked feature in Linux Mint Image Viewer!
Sujit Agarwal
Sujit Agarwal

Posted on

How I added an overlooked feature in Linux Mint Image Viewer!

The ability to view/edit documents and images is something that is always taken as one of the primary elements of any Operating System these days.

Whenever I land up on a new Linux Distro or a new Linux update that is there to disrupt it all, what do I expect?

Let's list it down -

  1. Is it smooth?
  2. Is it fast?
  3. Is it secure?
  4. Is it stable?
  5. Is it a daily driver for me?

Of all these questions, #5 is something I consider giving double triple thoughts.

So, while moving to Linux Mint, I observed something very basic was missing in the Image Viewer application that comes out-of-the-box. It lacked the quick toolbar buttons to view your images as a SlideShow / Full Screen.

FYI, the functionality to view images as Slideshow / Full Screen is already present in the X-Viewer App, but accessible only through the drop-down menu.

And that's when I thought, why not add those tiny little buttons and make it work?

All I had in mind is to clone the source code from github and find the exact functions that are triggered for those features.

It took me 4 hours of my time to setup my build environment and inspect the code to reach the exact lines of code which would fulfill my requirements.

The file that I changed was src/xviewer-window.c

I added the following lines of code inside the function xviewer_window_construct_ui()

separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (tool_box), separator, FALSE, FALSE, 0);

box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (tool_box), box, FALSE, FALSE, 0);

action = gtk_action_group_get_action (priv->actions_image, "ViewFullscreen");
button = create_toolbar_button (action);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);

action = gtk_action_group_get_action (priv->actions_gallery, "ViewSlideshow");
button = create_toolbar_button (action);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);

And here's what I got as the output -

Alt Text

Discussion (0)