-
Notifications
You must be signed in to change notification settings - Fork 39
modules/zathura: init #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aquifolly
wants to merge
1
commit into
Lassulus:main
Choose a base branch
from
aquifolly:push-yozxkpsoopvr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+123
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,123 @@ | ||||||
| { | ||||||
| config, | ||||||
| lib, | ||||||
| wlib, | ||||||
| ... | ||||||
| }: | ||||||
| let | ||||||
| formatLine = | ||||||
| n: v: | ||||||
| let | ||||||
| formatValue = v: if lib.isBool v then (if v then "true" else "false") else toString v; | ||||||
| in | ||||||
| ''set ${n} "${formatValue v}"''; | ||||||
|
|
||||||
| formatMapLine = n: v: "map ${n} ${toString v}"; | ||||||
| in | ||||||
| { | ||||||
| _class = "wrapper"; | ||||||
| options = { | ||||||
| options = lib.mkOption { | ||||||
| type = lib.types.attrsOf ( | ||||||
| lib.types.oneOf [ | ||||||
| lib.types.str | ||||||
| lib.types.bool | ||||||
| lib.types.int | ||||||
| lib.types.float | ||||||
| ] | ||||||
| ); | ||||||
| default = { }; | ||||||
| description = '' | ||||||
| Add {option}`:set` command options to zathura and make | ||||||
| them permanent. See | ||||||
| {manpage}`zathurarc(5)` | ||||||
| for the full list of options. | ||||||
| ''; | ||||||
| example = { | ||||||
| default-bg = "#000000"; | ||||||
| default-fg = "#FFFFFF"; | ||||||
| }; | ||||||
| }; | ||||||
| mappings = lib.mkOption { | ||||||
| type = lib.types.attrsOf lib.types.str; | ||||||
| default = { }; | ||||||
| description = '' | ||||||
| Add {option}`:map` mappings to zathura and make | ||||||
| them permanent. See | ||||||
| {manpage}`zathurarc(5)` | ||||||
| for the full list of possible mappings. | ||||||
|
|
||||||
| You can create a mode-specific mapping by specifying the mode before the key: | ||||||
| `"[normal] <C-b>" = "scroll left";` | ||||||
| ''; | ||||||
| example = { | ||||||
| D = "toggle_page_mode"; | ||||||
| "<Right>" = "navigate next"; | ||||||
| "[fullscreen] <C-i>" = "zoom in"; | ||||||
| }; | ||||||
| }; | ||||||
| extraConfig = lib.mkOption { | ||||||
| type = lib.types.lines; | ||||||
| default = ""; | ||||||
| description = '' | ||||||
| Additional commands for zathura that will be added to the | ||||||
| {file}`zathurarc` file. | ||||||
| ''; | ||||||
| }; | ||||||
| "zathurarc" = lib.mkOption { | ||||||
| type = wlib.types.file config.pkgs; | ||||||
| description = "zathura config file"; | ||||||
| default.content = | ||||||
| lib.concatStringsSep "\n" ( | ||||||
| lib.optional (config.extraConfig != "") config.extraConfig | ||||||
| ++ lib.mapAttrsToList formatLine config.options | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ++ lib.mapAttrsToList formatMapLine config.mappings | ||||||
| ) | ||||||
| + "\n"; | ||||||
| }; | ||||||
| extraFiles = lib.mkOption { | ||||||
| type = lib.types.listOf ( | ||||||
| lib.types.submodule { | ||||||
| options = { | ||||||
| name = lib.mkOption { | ||||||
| type = lib.types.nonEmptyStr; | ||||||
| description = "File name in the config directory"; | ||||||
| }; | ||||||
| file = lib.mkOption { | ||||||
| type = wlib.types.file config.pkgs; | ||||||
| description = "File or path to add into the config directory"; | ||||||
| }; | ||||||
| }; | ||||||
| } | ||||||
| ); | ||||||
| default = [ ]; | ||||||
| description = "Additional files to be placed in the config directory"; | ||||||
| }; | ||||||
| }; | ||||||
| config = { | ||||||
| flags = { | ||||||
| "--config-dir" = toString ( | ||||||
| config.pkgs.linkFarm "zathura-merged-config" ( | ||||||
| let | ||||||
| entry = name: path: { inherit name path; }; | ||||||
| in | ||||||
| [ (entry "zathurarc" config."zathurarc".path) ] | ||||||
| ++ (map (f: { | ||||||
| inherit (f) name; | ||||||
| path = f.file.path; | ||||||
| }) config.extraFiles) | ||||||
| ) | ||||||
| ); | ||||||
| }; | ||||||
| package = config.pkgs.zathura; | ||||||
| meta = { | ||||||
| maintainers = [ | ||||||
| { | ||||||
| name = "holly"; | ||||||
| github = "hollymlem"; | ||||||
| githubId = 35699052; | ||||||
| } | ||||||
| ]; | ||||||
| }; | ||||||
| }; | ||||||
| } | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as per RFC42 and consistency with the other modules