Skip to content

Commit 00e20c6

Browse files
committed
system versions bump, adding screen recording bindings
1 parent 217d894 commit 00e20c6

2 files changed

Lines changed: 46 additions & 15 deletions

File tree

flake.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

home/niri.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,32 @@
1717
[ -n "$sel" ] && pactl set-default-sink "$(echo "$sel" | cut -f1)"
1818
'';
1919
};
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+
};
2046
in {
2147
# Apply Stylix theme tokens to niri config.
2248
stylix.targets.niri.enable = true;
@@ -56,6 +82,7 @@ in {
5682
cliphist # Clipboard history
5783
grim # Screen capture
5884
slurp # Region picker
85+
wf-recorder # Screen recorder (Wayland)
5986
playerctl # MPRIS media control
6087
libnotify # notify-send for keybind feedback
6188
wlogout # Graphical power menu (logout/reboot/poweroff/suspend/lock)
@@ -229,6 +256,10 @@ in {
229256
"Ctrl+Print".action.screenshot-screen = {};
230257
"Alt+Print".action.screenshot-window = {};
231258

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+
232263
# --- Audio (wpctl uses PipeWire/WirePlumber) ---
233264
"XF86AudioRaiseVolume" = {
234265
action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%+";

0 commit comments

Comments
 (0)