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 . termite ; 8 9in { 10options = { 11programs . termite = { 12enable = mkEnableOption "Termite VTE-based terminal" ; 13 14allowBold = mkOption { 15default = null ; 16type = types . nullOr types . bool ; 17description = '' 18Allow the output of bold characters when the bold escape sequence appears. 19'' ; 20}; 21 22audibleBell = mkOption { 23default = null ; 24type = types . nullOr types . bool ; 25description = "Have the terminal beep on the terminal bell." ; 26}; 27 28clickableUrl = mkOption { 29default = null ; 30type = types . nullOr types . bool ; 31description = '' 32Auto-detected URLs can be clicked on to open them in your browser. 33Only enabled if a browser is configured or detected. 34'' ; 35}; 36 37dynamicTitle = mkOption { 38default = null ; 39type = types . nullOr types . bool ; 40description = '' 41Settings dynamic title allows the terminal and the shell to 42update the terminal's title. 43'' ; 44}; 45 46enableVteIntegration = mkEnableOption "Shell VTE integration" // { 47default = true ; 48}; 49 50fullscreen = mkOption { 51default = null ; 52type = types . nullOr types . bool ; 53description = "Enables entering fullscreen mode by pressing F11." ; 54}; 55 56mouseAutohide = mkOption { 57default = null ; 58type = types . nullOr types . bool ; 59description = '' 60Automatically hide the mouse pointer when you start typing. 61'' ; 62}; 63 64scrollOnOutput = mkOption { 65default = null ; 66type = types . nullOr types . bool ; 67description = "Scroll to the bottom when the shell generates output." ; 68}; 69 70scrollOnKeystroke = mkOption { 71default = null ; 72type = types . nullOr types . bool ; 73description = '' 74Scroll to the bottom automatically when a key is pressed. 75'' ; 76}; 77 78searchWrap = mkOption { 79default = null ; 80type = types . nullOr types . bool ; 81description = "Search from top again when you hit the bottom." ; 82}; 83 84urgentOnBell = mkOption { 85default = null ; 86type = types . nullOr types . bool ; 87description = "Sets the window as urgent on the terminal bell." ; 88}; 89 90font = mkOption { 91default = null ; 92example = "Monospace 12" ; 93type = types . nullOr types . str ; 94description = "The font description for the terminal's font." ; 95}; 96 97geometry = mkOption { 98default = null ; 99example = "640x480" ; 100type = types . nullOr types . str ; 101description = "The default window geometry for new terminal windows." ; 102}; 103 104iconName = mkOption { 105default = null ; 106example = "terminal" ; 107type = types . nullOr types . str ; 108description = 109"The name of the icon to be used for the terminal process." ; 110}; 111 112scrollbackLines = mkOption { 113default = null ; 114example = 10000 ; 115type = types . nullOr types . int ; 116description = 117"Set the number of lines to limit the terminal's scrollback." ; 118}; 119 120browser = mkOption { 121default = null ; 122type = types . nullOr types . str ; 123example = " ${ pkgs . xdg-utils } /xdg-open" ; 124description = '' 125Set the default browser for opening links. If its not set, $BROWSER is read. 126If that's not set, url hints will be disabled. 127'' ; 128}; 129 130cursorBlink = mkOption { 131default = null ; 132example = "system" ; 133type = types . nullOr ( types . enum [ "system" "on" "off" ]); 134description = '' 135Specify the how the terminal's cursor should behave. 136Accepts system to respect the gtk global configuration, 137on and off to explicitly enable or disable them. 138'' ; 139}; 140 141cursorShape = mkOption { 142default = null ; 143example = "block" ; 144type = types . nullOr ( types . enum [ "block" "underline" "ibeam" ]); 145description = '' 146Specify how the cursor should look. Accepts block, ibeam and underline. 147'' ; 148}; 149 150filterUnmatchedUrls = mkOption { 151default = null ; 152type = types . nullOr types . bool ; 153description = 154"Whether to hide url hints not matching input in url hints mode." ; 155}; 156 157modifyOtherKeys = mkOption { 158default = null ; 159type = types . nullOr types . bool ; 160description = '' 161Emit escape sequences for extra keys, 162like the modifyOtherKeys resource for 163{manpage}`xterm(1)`. 164'' ; 165}; 166 167sizeHints = mkOption { 168default = null ; 169type = types . nullOr types . bool ; 170description = '' 171Enable size hints. Locks the terminal resizing 172to increments of the terminal's cell size. 173Requires a window manager that respects scroll hints. 174'' ; 175}; 176 177scrollbar = mkOption { 178default = null ; 179type = types . nullOr ( types . enum [ "off" "left" "right" ]); 180description = "Scrollbar position." ; 181}; 182 183backgroundColor = mkOption { 184default = null ; 185example = "rgba(63, 63, 63, 0.8)" ; 186type = types . nullOr types . str ; 187description = "Background color value." ; 188}; 189 190cursorColor = mkOption { 191default = null ; 192example = "#dcdccc" ; 193type = types . nullOr types . str ; 194description = "Cursor color value." ; 195}; 196 197cursorForegroundColor = mkOption { 198default = null ; 199example = "#dcdccc" ; 200type = types . nullOr types . str ; 201description = "Cursor foreground color value." ; 202}; 203 204foregroundColor = mkOption { 205default = null ; 206example = "#dcdccc" ; 207type = types . nullOr types . str ; 208description = "Foreground color value." ; 209}; 210 211foregroundBoldColor = mkOption { 212default = null ; 213example = "#ffffff" ; 214type = types . nullOr types . str ; 215description = "Foreground bold color value." ; 216}; 217 218highlightColor = mkOption { 219default = null ; 220example = "#2f2f2f" ; 221type = types . nullOr types . str ; 222description = "highlight color value." ; 223}; 224 225hintsActiveBackgroundColor = mkOption { 226default = null ; 227example = "#3f3f3f" ; 228type = types . nullOr types . str ; 229description = "Hints active background color value." ; 230}; 231 232hintsActiveForegroundColor = mkOption { 233default = null ; 234example = "#e68080" ; 235type = types . nullOr types . str ; 236description = "Hints active foreground color value." ; 237}; 238 239hintsBackgroundColor = mkOption { 240default = null ; 241example = "#3f3f3f" ; 242type = types . nullOr types . str ; 243description = "Hints background color value." ; 244}; 245 246hintsForegroundColor = mkOption { 247default = null ; 248example = "#dcdccc" ; 249type = types . nullOr types . str ; 250description = "Hints foreground color value." ; 251}; 252 253hintsBorderColor = mkOption { 254default = null ; 255example = "#3f3f3f" ; 256type = types . nullOr types . str ; 257description = "Hints border color value." ; 258}; 259 260hintsBorderWidth = mkOption { 261default = null ; 262example = "0.5" ; 263type = types . nullOr types . str ; 264description = "Hints border width." ; 265}; 266 267hintsFont = mkOption { 268default = null ; 269example = "Monospace 12" ; 270type = types . nullOr types . str ; 271description = "The font description for the hints font." ; 272}; 273 274hintsPadding = mkOption { 275default = null ; 276example = 2 ; 277type = types . nullOr types . int ; 278description = "Hints padding." ; 279}; 280 281hintsRoundness = mkOption { 282default = null ; 283example = "0.2" ; 284type = types . nullOr types . str ; 285description = "Hints roundness." ; 286}; 287 288optionsExtra = mkOption { 289default = "" ; 290example = "fullscreen = true" ; 291type = types . lines ; 292description = 293"Extra options that should be added to [options] section." ; 294}; 295 296colorsExtra = mkOption { 297default = "" ; 298example = '' 299color0 = #3f3f3f 300color1 = #705050 301color2 = #60b48a 302'' ; 303type = types . lines ; 304description = 305"Extra colors options that should be added to [colors] section." ; 306}; 307 308hintsExtra = mkOption { 309default = "" ; 310example = "border = #3f3f3f" ; 311type = types . lines ; 312description = 313"Extra hints options that should be added to [hints] section." ; 314}; 315}; 316}; 317 318config = ( let 319boolToString = v :if v then "true" else "false" ; 320optionalBoolean = name :val : 321lib . optionalString ( val != null ) " ${ name } = ${ boolToString val } " ; 322optionalInteger = name :val : 323lib . optionalString ( val != null ) " ${ name } = ${ toString val } " ; 324optionalString = name :val : 325lib . optionalString ( val != null ) " ${ name } = ${ val } " ; 326in mkIf cfg . enable { 327home . packages = [ pkgs . termite ]; 328xdg . configFile . "termite/config" . text = '' 329[options] 330${ optionalBoolean "allow_bold" cfg . allowBold } 331${ optionalBoolean "audible_bell" cfg . audibleBell } 332${ optionalString "browser" cfg . browser } 333${ optionalBoolean "clickable_url" cfg . clickableUrl } 334${ optionalString "cursor_blink" cfg . cursorBlink } 335${ optionalString "cursor_shape" cfg . cursorShape } 336${ optionalBoolean "dynamic_title" cfg . dynamicTitle } 337${ optionalBoolean "filter_unmatched_urls" cfg . filterUnmatchedUrls } 338${ optionalString "font" cfg . font } 339${ optionalBoolean "fullscreen" cfg . fullscreen } 340${ optionalString "geometry" cfg . geometry } 341${ optionalString "icon_name" cfg . iconName } 342${ optionalBoolean "modify_other_keys" cfg . modifyOtherKeys } 343${ optionalBoolean "mouse_autohide" cfg . mouseAutohide } 344${ optionalBoolean "scroll_on_keystroke" cfg . scrollOnKeystroke } 345${ optionalBoolean "scroll_on_output" cfg . scrollOnOutput } 346${ optionalInteger "scrollback_lines" cfg . scrollbackLines } 347${ optionalString "scrollbar" cfg . scrollbar } 348${ optionalBoolean "search_wrap" cfg . searchWrap } 349${ optionalBoolean "size_hints" cfg . sizeHints } 350${ optionalBoolean "urgent_on_bell" cfg . urgentOnBell } 351 352${ cfg . optionsExtra } 353 354[colors] 355${ optionalString "background" cfg . backgroundColor } 356${ optionalString "cursor" cfg . cursorColor } 357${ optionalString "cursor_foreground" cfg . cursorForegroundColor } 358${ optionalString "foreground" cfg . foregroundColor } 359${ optionalString "foreground_bold" cfg . foregroundBoldColor } 360${ optionalString "highlight" cfg . highlightColor } 361 362${ cfg . colorsExtra } 363 364[hints] 365${ optionalString "active_background" cfg . hintsActiveBackgroundColor } 366${ optionalString "active_foreground" cfg . hintsActiveForegroundColor } 367${ optionalString "background" cfg . hintsBackgroundColor } 368${ optionalString "border" cfg . hintsBorderColor } 369${ optionalInteger "border_width" cfg . hintsBorderWidth } 370${ optionalString "font" cfg . hintsFont } 371${ optionalString "foreground" cfg . hintsForegroundColor } 372${ optionalInteger "padding" cfg . hintsPadding } 373${ optionalInteger "roundness" cfg . hintsRoundness } 374 375${ cfg . hintsExtra } 376'' ; 377 378programs . bash . enableVteIntegration = lib . mkDefault cfg . enableVteIntegration ; 379programs . zsh . enableVteIntegration = lib . mkDefault cfg . enableVteIntegration ; 380}); 381}