Yes!
https://github.com/linuxmint/nemo/tree/master/search-helpers explains how:
- Write a script or program that takes a file name and outputs the plain text of that file
- make that script executable
- Write a search helper definition file and put it into
~/.local/share/nemo/search-helpers.
Luckily, the first part has already been done by the PDF library that pdfgrep uses internally: There's a pdftotext utility.
So what you'd need to do is install pdftotext (sudo apt install poppler-utils), and write a application-pdf.nemo_search_helper:
[Nemo Search Helper]
TryExec=pdftotext
Exec=pdftotext %s
MimeType=application/pdf;
Priority=100
and put it in application-pdf.nemo_search_helper.
Fun fact:
that's already implemented in nemo 5, there's a pdftotext search helper, so you don't have to do anything. Just install poppler-utils, and you should get that search when hitting ctrl+f in nemo.
Not so fun fact: Ubuntu 21.10 is surprisingly conservative
... in the version of Nemo it ships: you need nemo 5, but it ships nemo 4.
You can build the official nemo source into a Ubuntu package and install it, but no guarantees are made. This might break things on your system, I haven't tested the functionality!
Now, you can build nemo from source:
sudo apt install git-buildpackage
git clone https://github.com/linuxmint/nemo
cd nemo
dpkg-buildpackage -rfakeroot
which will complain about missing packages:
dpkg-checkbuilddeps: error: Unmet build dependencies: cinnamon-l10n debhelper-compat (= 12) dh-python gobject-introspection gtk-doc-tools (>= 1.4) intltool (>= 0.40.1) itstool libatk1.0-dev (>= 1.32.0) libcinnamon-desktop-dev (>= 4.8) libexempi-dev (>= 2.2.0) libexif-dev (>= 0.6.20) libgail-3-dev libgirepository1.0-dev (>= 0.9.12) libglib2.0-dev (>= 2.45.7) libglib2.0-doc libgsf-1-dev libgtk-3-dev (>= 3.10) libgtk-3-doc libnotify-dev (>= 0.7.0) libpango1.0-dev libx11-dev libxapp-dev (>= 2.0.0) libxext-dev libxml2-dev (>= 2.7.8) libxrender-dev meson python3-gi x11proto-core-dev
Simply install these (the list might look different to you!) using
sudo apt install cinnamon-l10n debhelper-compat dh-python gobject-introspection gtk-doc-tools intltool itstool libatk1.0-dev libcinnamon-desktop-dev libexempi-dev libexif-dev libgail-3-dev libgirepository1.0-dev libglib2.0-dev libglib2.0-doc libgsf-1-dev libgtk-3-dev libgtk-3-doc libnotify-dev libpango1.0-dev libx11-dev libxapp-dev libxext-dev libxml2-dev libxrender-dev meson python3-gi x11proto-core-dev
then try again:
dpkg-buildpackage -rfakeroot
Which should now work flawlessly. (it does for my fresh Ubuntu 21.10 container). You can now install:
cd ..
sudo dpkg -i gir*.deb libnemo*.deb nemo-data*.deb nemo_*.deb
# there will be config errors of the above; run apt-get install to fix these:
sudo apt-get install -f
There you go, you'll have a bleeding edge nemo installation now.