Skip to content

Configure Commit Capturing

Matthew Hutchinson edited this page May 13, 2019 · 15 revisions

Environment Variables

lolcommits has some capture options for extra lulz. You can enable these via environment variables like so;

  • LOLCOMMITS_DEVICE set a webcam device - except windows (non-animated) captures
  • LOLCOMMITS_VIDEO (in seconds) set time for capturing a video - requires FFmpeg
  • LOLCOMMITS_ANIMATE (in seconds) set time for capturing an animated gif - requires FFmpeg
  • LOLCOMMITS_DELAY (in seconds) set the delay time before capturing (for slow webcams to warm up)
  • LOLCOMMITS_FORK fork lolcommit runner (capture command forks to a new process, speedily returning you to your terminal)
  • LOLCOMMITS_STEALTH disable all notification messages when capturing
  • LOLCOMMITS_DIR set the output directory used for all repositories (defaults to ~/.lolcommits)
  • LOLCOMMITS_CAPTURE_DISABLED disables lolcommit capturing in the commit hook (when set as 'true')

Or they can be set with arguments to the capture command (located in your repository's .git/hooks/post-commit file).

  • --device {name} or -d {name}
  • --video {seconds} or -v {seconds}
  • --animate {seconds} or -a {seconds}
  • --delay {seconds} or -w {seconds}
  • --fork
  • --stealth

Use lolcommits --devices to list all attached video devices available for capturing. Finally, run lolcommits --help for details on all the available arguments.


Loltext Options

You can configure the default loltext plugin to adjust the style of your lolcommit:

lolcommits --config -p loltext
  • text color
  • text font
  • text position
  • uppercase text?
  • size (point size for the font)
  • stroke color (font outline color)
  • transparent overlay (fills your image with a random background color)
  • transparent overlay % (sets the fill colorise strength)

Please note that:

  • The message and sha text can have different text options
  • Always use the full absolute path to fonts
  • Any blank options will use the default (indicated when prompted for an option)
  • Valid text positions are NE, NW, SE, SW, S, C (centred)
  • Colors can be hex #FC0 values or strings 'white'
  • You can set one or more overlay_colors to pick from, separated with commas

With these options, it's possible to create your own unique lolcommit format. For example, to achieve these hipster-styled commits, try the following:

loltext:
  enabled: true
  :message:
    :color: white
    :font: "/Users/matt/Library/Fonts/Raleway-Light.ttf"
    :position: C
    :size: 30
    :stroke_color: none
    :uppercase: true
  :sha:
    :color: white
    :font: "/Users/matt/Library/Fonts/Raleway-Light.ttf"
    :position: S
    :size: 20
    :stroke_color: none
    :uppercase: false
  :overlay:
    :enabled: true

NOTE: you can grab the 'Raleway-Light' font for free from fontsquirrel.


Pass Capture Options with --enable

Any extra arguments you pass with the --enable command are auto-appended to the git-commit capture command. For example;

lolcommits --enable --delay 5 --animate 4 --fork                                                                                                   

This will configure capturing of an animated gif (4 secs) after a 5 sec delay in a forked process. See the section below for more capture configuration variables.