blob: 163ee3f76f2d6132dbb1f5af2d0ee5e81614d147 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# Screen recording script using wf-recorder and slurp
{
config,
lib,
pkgs,
...
}:
let
screenRecordingScript = pkgs.writeShellApplication {
name = "screen-recording";
runtimeInputs = [
pkgs.bash
config.media.slurp.package
config.media.wf-recorder.package
];
text = builtins.readFile ./screen-recording.sh;
};
screenRecordingCompletion =
pkgs.runCommand "screen-recording-completion"
{
nativeBuildInputs = [ pkgs.installShellFiles ];
}
''
mkdir -p $out/share/zsh/site-functions
installShellCompletion zsh --name _screen-recording ${pkgs.writeText "screen-recording.zsh" (builtins.readFile ./screen-recording.zsh)}
'';
scriptPkg = pkgs.symlinkJoin {
name = "screen-recording";
paths = [
screenRecordingScript
screenRecordingCompletion
];
meta = screenRecordingScript.meta or { };
};
in
{
options.media.screen-recording = {
enable = lib.mkEnableOption "Screen recording script using wf-recorder and slurp";
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
default = scriptPkg;
description = "The screen-recording script package.";
};
};
config = lib.mkIf config.media.screen-recording.enable {
home.packages = [ scriptPkg ];
assertions = import ./assertions.nix { inherit config lib; };
home.file.".local/share/icons/hicolor/scalable/apps/obs.svg" = {
source = ../../../assets/icons/apps/obs.svg;
};
xdg.desktopEntries.screen-recording = {
name = "Screen Recording";
exec = "${lib.getExe config.terminal.kitty.package} --class screen-recording -e ${lib.getExe scriptPkg}";
icon = "obs";
categories = [ "Utility" ];
terminal = false;
type = "Application";
};
};
}
|