summaryrefslogtreecommitdiff
path: root/home-manager/features/gui/desktops/niri/parts/scrap-maker.nix
blob: 19cce5680b59c0e738b7dbfe8402fafb1185f79c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.features.gui.desktops.niri.parts.scrap-maker;

  scrapDirectory = "~/Sync/vault/scraps";
in {
  options.features.gui.desktops.niri.parts.scrap-maker.enable = lib.mkEnableOption "scrap maker";
  config = lib.mkIf cfg.enable {
    home.packages = [
      (pkgs.writers.writeNuBin "scrap-maker" ''
        let scrap_text = fuzzel -d -l 0 -p "" -x 8 -y 8 -w 40
        let scrap_name = date now | format date "%s"
        let scrap_path = ("${scrapDirectory}" + "/" + $scrap_name + ".md") | path expand
        $scrap_text | save $scrap_path
      '')
    ];
  };
}