Skip to content

Instantly share code, notes, and snippets.

@ivan
Created January 15, 2019 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/cf1a57614d6915e785a88cdc37f479cd to your computer and use it in GitHub Desktop.
Save ivan/cf1a57614d6915e785a88cdc37f479cd to your computer and use it in GitHub Desktop.
okular: use chromium's zoom factors
From 64e83c7326c9cbb4d41158aebe08c228490470cb Mon Sep 17 00:00:00 2001
From: Ivan Kozik <ivan@ludios.org>
Date: Tue, 15 Jan 2019 21:36:28 +0000
Subject: [PATCH] okular: use chromium's zoom factors
---
pkgs/applications/kde/okular.nix | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pkgs/applications/kde/okular.nix b/pkgs/applications/kde/okular.nix
index 39fb232b342..031fef97e29 100644
--- a/pkgs/applications/kde/okular.nix
+++ b/pkgs/applications/kde/okular.nix
@@ -18,6 +18,12 @@ mkDerivation {
kwindowsystem libkexiv2 libspectre libzip phonon poppler qca-qt5
qtdeclarative qtsvg threadweaver kcrash
] ++ lib.optional (!stdenv.isAarch64) chmlib;
+ postPatch = ''
+ # Okular doesn't have enough zoom factors, going down from e.g. 100% to 75%,
+ # so replace the zoom factors with those from Chromium.
+ factors="{0.25, 1 / 3.0, 0.5, 2 / 3.0, 0.75, 0.8, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 4.0, 5.0}"
+ sed -i -r "s@^static const float kZoomValues\[\] = .*@static const float kZoomValues[] = $factors;@g" ui/pageview.cpp
+ '';
meta = with lib; {
homepage = http://www.kde.org;
license = with licenses; [ gpl2 lgpl21 fdl12 bsd3 ];
--
2.18.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment