Eli Taft

Eli Taft

Using Okular in Gnome without Installing KDE


When it comes to Linux desktop environments, I like Gnome. I do not like KDE. At the same time, there are some things in KDE that I consider superior to Gnome. One of those things is the PDF viewer, Okular. It is awesome. It’s the best. Really. It’s got many great features, including highlighting, underlining, and adding in-line or pop-up notes. For the research that I do, much of which consists of e-books that I have converted to PDF (because Adobe’s e-Book reader is the worst… perhaps another post on how I convert those to regular PDFs is in order at some point), I consider these features in Okular to be a necessity for me. You can install okular even if you use Gnome, but it will pull in a TON of KDE libraries. In the past, I would have been okay with that, but…

When it comes to Linux distributions, I like Debian. I do not like Debian’s package management system. I’ve been working with it, including building many packages, for years. Recently I had to reinstall my system. Two packages I wanted to install had conflicting dependencies, and I decided to trust aptitude to try and resolve them. The route that it chose ended up removing libraries that the package manager itself depended on, and also removed my ability to access su or sudo. It was bad. So now I’m super cautious about installing a bunch of libraries I don’t need. Isn’t there way to install Okular in Gnome without pulling in all of that? Yes. Read below. But first, just so you get an idea of what I’m talking about, this is what would have been installed, along with Okular, if I used “apt install okular”:

The following additional packages will be installed:
  kactivities-bin kactivitymanagerd keditbookmarks kinit kio kwayland-data kwayland-integration libaribb24-0 libbasicusageenvironment1 libcddb2 libdbusmenu-qt5-2 libdvbpsi10 libebml4v5 libfam0 libgroupsock8
  libhfstospell10 libixml10 libkf5activities5 libkf5archive5 libkf5attica5 libkf5auth-data libkf5auth5 libkf5bookmarks-data libkf5bookmarks5 libkf5codecs-data libkf5codecs5 libkf5completion-data
  libkf5completion5 libkf5config-bin libkf5config-data libkf5configcore5 libkf5configgui5 libkf5configwidgets-data libkf5configwidgets5 libkf5coreaddons-data libkf5coreaddons5 libkf5crash5 libkf5dbusaddons-bin
  libkf5dbusaddons-data libkf5dbusaddons5 libkf5doctools5 libkf5globalaccel-bin libkf5globalaccel-data libkf5globalaccel5 libkf5globalaccelprivate5 libkf5guiaddons5 libkf5i18n-data libkf5i18n5
  libkf5iconthemes-bin libkf5iconthemes-data libkf5iconthemes5 libkf5idletime5 libkf5itemviews-data libkf5itemviews5 libkf5jobwidgets-data libkf5jobwidgets5 libkf5js5 libkf5jsapi5 libkf5kexiv2-15.0.0
  libkf5kiocore5 libkf5kiogui5 libkf5kiontlm5 libkf5kiowidgets5 libkf5notifications-data libkf5notifications5 libkf5parts-data libkf5parts-plugins libkf5parts5 libkf5pty-data libkf5pty5 libkf5service-bin
  libkf5service-data libkf5service5 libkf5solid5 libkf5solid5-data libkf5sonnet5-data libkf5sonnetcore5 libkf5sonnetui5 libkf5textwidgets-data libkf5textwidgets5 libkf5threadweaver5 libkf5wallet-bin
  libkf5wallet-data libkf5wallet5 libkf5waylandclient5 libkf5widgetsaddons-data libkf5widgetsaddons5 libkf5windowsystem-data libkf5windowsystem5 libkf5xmlgui-bin libkf5xmlgui-data libkf5xmlgui5
  libkwalletbackend5-5 liblivemedia64 libmad0 libmatroska6v5 libokular5core8 libopenmpt-modplug1 libphonon4qt5-4 libplacebo7 libpolkit-qt5-1-1 libpoppler-qt5-1 libprotobuf-lite17 libproxy-tools libqca-qt5-2
  libqca-qt5-2-plugins libqmobipocket2 libqt5qml5 libqt5quick5 libqt5script5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5texttospeech5 libqt5waylandclient5 libqt5waylandcompositor5 libqt5xml5
  libresid-builder0c2a libsdl-image1.2 libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libvlccore9 libvoikko1 phonon4qt5 phonon4qt5-backend-vlc qtwayland5
  sonnet-plugins vlc-data vlc-plugin-base vlc-plugin-video-output

I didn’t want to do this. Isn’t there another way? Yep. It’s called a snap. A snap is a different way of installing a package on Linux. A snap is basically an application that includes all of its dependencies within its snap package. In other words, it’s a self-contained package, and snaps are available for many popular Linux distributions. I typically like to have a few package managers as possible on a system, so I would typically prefer apt for regular package installs. But in this case, it really made sense. I could install the okular snap package without having to install all of these extra kde packages with apt. Here’s all it took to install okular with snap:

$ sudo apt update
$ sudo apt install snapd
$ sudo snap install okular
← Back to home