Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions modules/apps/okular.nix
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,43 @@ with lib.types;
"TrimSelect"
]);
};

showMenuBar = lib.mkOption {
description = "Whether to show the menu bar.";
default = null;
type = nullOr bool;
};
showSidebar = lib.mkOption {
description = "Whether to show the sidebar.";
default = null;
type = nullOr bool;
};
lockSidebar = lib.mkOption {
description = "Whether to lock the sidebar from being toggled.";
default = null;
type = nullOr bool;
};
fullScreen = lib.mkOption {
description = "Whether to open in fullscreen by default.";
default = null;
type = nullOr bool;
};
useCustomBackgroundColor = lib.mkOption {
description = "Whether to set a custom background color (the color around the displayed page). By default, the Qt™ toolkit color is used when this option is unchecked. ";
default = null;
type = nullOr bool;
};
backgroundColor = lib.mkOption {
description = "The RGB color that will fill the part of the screen not covered by the page when on presentation mode.";
default = null;
example = "255,255,255";
type = nullOr str;
};
colorScheme = lib.mkOption {
description = "The color scheme used for the user interface. This does not affect the colors of the documents.";
default = null;
type = nullOr str;
};
};

# ==================================
Expand Down Expand Up @@ -246,6 +283,8 @@ with lib.types;
"ViewContinuous" = applyIfSet gen.viewContinuous;
"ViewMode" = applyIfSet gen.viewMode;
"MouseMode" = applyIfSet gen.mouseMode;
"UseCustomBackgroundColor" = applyIfSet gen.useCustomBackgroundColor;
"BackgroundColor" = applyIfSet gen.backgroundColor;
};

"Zoom" = {
Expand Down Expand Up @@ -282,4 +321,29 @@ with lib.types;
};
}
);

config.programs.plasma.configFile."okularrc" = lib.mkIf cfg.enable (
let
gen = cfg.general;
applyIfSet = opt: lib.mkIf (opt != null) opt;
in
{
"Desktop Entry" = {
"FullScreen" = applyIfSet gen.fullScreen;
};

"General" = {
"LockSidebar" = applyIfSet gen.lockSidebar;
"ShowSidebar" = applyIfSet gen.showSidebar;
};

"MainWindow" = {
"MenuBar" = applyIfSet (if gen.showMenuBar then "Enabled" else "Disabled");

@folliehiyuki folliehiyuki Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applyIfSet is redundant here, since the value (Enabled or Disabled) is never null. I also get evaluation error when showMenuBar option isn't set, since if conditional statement doesn't accept a null value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#634 seems to fix the issue.

};

"UiSettings" = {
"ColorScheme" = applyIfSet gen.colorScheme;
};
}
);
}
Loading