|
17 | 17 | [ -n "$sel" ] && pactl set-default-sink "$(echo "$sel" | cut -f1)" |
18 | 18 | ''; |
19 | 19 | }; |
| 20 | + screenRecord = pkgs.writeShellApplication { |
| 21 | + name = "screen-record"; |
| 22 | + runtimeInputs = with pkgs; [wf-recorder slurp libnotify coreutils procps]; |
| 23 | + text = '' |
| 24 | + mode="''${1:-region}" |
| 25 | + outdir="$HOME/Videos" |
| 26 | + mkdir -p "$outdir" |
| 27 | + if pgrep -x wf-recorder >/dev/null; then |
| 28 | + pkill -INT -x wf-recorder |
| 29 | + notify-send "Screen recording" "Stopped" |
| 30 | + exit 0 |
| 31 | + fi |
| 32 | + out="$outdir/rec-$(date +%Y%m%d-%H%M%S).mp4" |
| 33 | + case "$mode" in |
| 34 | + region) |
| 35 | + geom=$(slurp) || exit 0 |
| 36 | + notify-send "Screen recording" "Started (region) → $out" |
| 37 | + wf-recorder -g "$geom" -f "$out" |
| 38 | + ;; |
| 39 | + screen) |
| 40 | + notify-send "Screen recording" "Started (screen) → $out" |
| 41 | + wf-recorder -f "$out" |
| 42 | + ;; |
| 43 | + esac |
| 44 | + ''; |
| 45 | + }; |
20 | 46 | in { |
21 | 47 | # Apply Stylix theme tokens to niri config. |
22 | 48 | stylix.targets.niri.enable = true; |
|
56 | 82 | cliphist # Clipboard history |
57 | 83 | grim # Screen capture |
58 | 84 | slurp # Region picker |
| 85 | + wf-recorder # Screen recorder (Wayland) |
59 | 86 | playerctl # MPRIS media control |
60 | 87 | libnotify # notify-send for keybind feedback |
61 | 88 | wlogout # Graphical power menu (logout/reboot/poweroff/suspend/lock) |
@@ -229,6 +256,10 @@ in { |
229 | 256 | "Ctrl+Print".action.screenshot-screen = {}; |
230 | 257 | "Alt+Print".action.screenshot-window = {}; |
231 | 258 |
|
| 259 | + # --- Screen recording (toggle: press to start, press again to stop) --- |
| 260 | + "Shift+Print".action = spawn (lib.getExe screenRecord) "region"; |
| 261 | + "Ctrl+Shift+Print".action = spawn (lib.getExe screenRecord) "screen"; |
| 262 | + |
232 | 263 | # --- Audio (wpctl uses PipeWire/WirePlumber) --- |
233 | 264 | "XF86AudioRaiseVolume" = { |
234 | 265 | action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%+"; |
|
0 commit comments