fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . urxvt ; 8 9in { 10options . programs . urxvt = { 11enable = mkEnableOption "rxvt-unicode terminal emulator" ; 12 13package = mkOption { 14type = types . package ; 15default = pkgs . rxvt-unicode ; 16defaultText = literalExpression "pkgs.rxvt-unicode" ; 17description = "rxvt-unicode package to install." ; 18}; 19 20fonts = mkOption { 21type = types . listOf types . str ; 22default = [ ]; 23description = "List of fonts to be used." ; 24example = [ "xft:Droid Sans Mono Nerd Font:size=9" ]; 25}; 26 27keybindings = mkOption { 28type = types . attrsOf types . str ; 29default = { }; 30description = "Mapping of keybindings to actions" ; 31example = literalExpression '' 32{ 33"Shift-Control-C" = "eval:selection_to_clipboard"; 34"Shift-Control-V" = "eval:paste_clipboard"; 35} 36'' ; 37}; 38 39iso14755 = mkOption { 40type = types . bool ; 41default = true ; 42description = 43"ISO14755 support for viewing and entering unicode characters." ; 44}; 45 46scroll = { 47bar = mkOption { 48type = types . submodule { 49options = { 50enable = mkOption { 51type = types . bool ; 52default = true ; 53description = "Whether to enable the scrollbar" ; 54}; 55 56style = mkOption { 57type = types . enum [ "rxvt" "plain" "next" "xterm" ]; 58default = "plain" ; 59description = "Scrollbar style." ; 60}; 61 62align = mkOption { 63type = types . enum [ "top" "bottom" "center" ]; 64default = "center" ; 65description = "Scrollbar alignment." ; 66}; 67 68position = mkOption { 69type = types . enum [ "left" "right" ]; 70default = "right" ; 71description = "Scrollbar position." ; 72}; 73 74floating = mkOption { 75type = types . bool ; 76default = true ; 77description = 78"Whether to display an rxvt scrollbar without a trough." ; 79}; 80}; 81}; 82default = { }; 83description = "Scrollbar settings." ; 84}; 85 86lines = mkOption { 87type = types . ints . unsigned ; 88default = 10000 ; 89description = "Number of lines to save in the scrollback buffer." ; 90}; 91 92keepPosition = mkOption { 93type = types . bool ; 94default = true ; 95description = 96"Whether to keep a scroll position when TTY receives new lines." ; 97}; 98 99scrollOnKeystroke = mkOption { 100type = types . bool ; 101default = true ; 102description = "Whether to scroll to bottom on keyboard input." ; 103}; 104 105scrollOnOutput = mkOption { 106type = types . bool ; 107default = false ; 108description = "Whether to scroll to bottom on TTY output." ; 109}; 110}; 111 112transparent = mkOption { 113type = types . bool ; 114default = false ; 115description = "Whether to enable pseudo-transparency." ; 116}; 117 118shading = mkOption { 119type = types . ints . between 0 200 ; 120default = 100 ; 121description = 122"Darken (0 to 99) or lighten (101 to 200) the transparent background." ; 123}; 124 125extraConfig = mkOption { 126default = { }; 127type = types . attrsOf types . anything ; 128description = "Additional configuration to add." ; 129example = { "shading" = 15 ; }; 130}; 131 132}; 133 134config = mkIf cfg . enable { 135home . packages = [ cfg . package ]; 136 137xresources . properties = { 138"URxvt.scrollBar" = cfg . scroll . bar . enable ; 139"URxvt.scrollstyle" = cfg . scroll . bar . style ; 140"URxvt.scrollBar_align" = cfg . scroll . bar . align ; 141"URxvt.scrollBar_right" = cfg . scroll . bar . position == "right" ; 142"URxvt.scrollBar_floating" = cfg . scroll . bar . floating ; 143"URxvt.saveLines" = cfg . scroll . lines ; 144"URxvt.scrollWithBuffer" = cfg . scroll . keepPosition ; 145"URxvt.scrollTtyKeypress" = cfg . scroll . scrollOnKeystroke ; 146"URxvt.scrollTtyOutput" = cfg . scroll . scrollOnOutput ; 147"URxvt.transparent" = cfg . transparent ; 148"URxvt.shading" = cfg . shading ; 149"URxvt.iso14755" = cfg . iso14755 ; 150} // flip mapAttrs' cfg . keybindings 151( kb :action :nameValuePair "URxvt.keysym. ${ kb } " action ) 152// optionalAttrs ( cfg . fonts != [ ]) { 153"URxvt.font" = concatStringsSep "," cfg . fonts ; 154} // flip mapAttrs' cfg . extraConfig ( k :v :nameValuePair "URxvt. ${ k } " v ); 155}; 156}