diff options
| author | Arpit Chakladar <arpitchakladar@proton.me> | 2026-03-20 02:19:30 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@proton.me> | 2026-03-20 02:19:30 +0530 |
| commit | 805501fb3f0cb06816871fdcad5f53445f48ac95 (patch) | |
| tree | a3eb37ad341437b6c8eb838aa3422e8d493842ab /modules/desktop/i3/keybindings.nix | |
| parent | 1bf29502faf018284ff603c4d31970415742bec1 (diff) | |
| download | home-manager-config-805501fb3f0cb06816871fdcad5f53445f48ac95.tar.gz home-manager-config-805501fb3f0cb06816871fdcad5f53445f48ac95.zip | |
Added screen capture with ffmpeg
Diffstat (limited to 'modules/desktop/i3/keybindings.nix')
| -rw-r--r-- | modules/desktop/i3/keybindings.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/desktop/i3/keybindings.nix b/modules/desktop/i3/keybindings.nix index 9d6e668..5b16a05 100644 --- a/modules/desktop/i3/keybindings.nix +++ b/modules/desktop/i3/keybindings.nix @@ -84,4 +84,22 @@ in lib.mkIf config.tools.maim.enable "exec \"${lib.getExe pkgs.maim} -s | xclip -selection clipboard -t image/png\""; "${mod}+Shift+p" = lib.mkIf config.tools.maim.enable "exec \"mkdir -p ~/Pictures/Screenshots && ${lib.getExe pkgs.maim} -s ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png\""; + + # --- Screen Recordings --- + "${mod}+Mod1+r" = lib.mkIf config.tools.ffmpeg.enable ( + let + pidFile = "/tmp/ffmpeg-screenrecord.pid"; + outDir = "~/Videos/Recordings"; + in + "exec \"" + + "if [ -f ${pidFile} ]; then " + + "kill $(cat ${pidFile}) && rm ${pidFile}; " + + "else " + + "mkdir -p ${outDir} && " + + "${lib.getExe pkgs.ffmpeg-full} -f x11grab -i $DISPLAY " + + "-framerate 30 -c:v libx264 -preset ultrafast -crf 23 " + + "${outDir}/recording-$(date +%Y%m%d-%H%M%S).mp4 " + + "& echo $! > ${pidFile}; " + + "fi\"" + ); } |
