diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-26 00:13:26 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-26 00:13:26 +0530 |
| commit | 2f64a2097812c1820766909037e724f3415c7576 (patch) | |
| tree | 8dd91e2d68df1530e3db00db82be91135c672e36 /modules/scripts/screen-recording | |
| parent | 550cadaf45165ccbc3dbe050a45d0d041c2c221d (diff) | |
| download | home-manager-config-2f64a2097812c1820766909037e724f3415c7576.tar.gz home-manager-config-2f64a2097812c1820766909037e724f3415c7576.zip | |
feat: migrate to Wayland-native media tools, drop X11 cruft, polish waybar and hyprland
- Switch ffmpeg/maim/slop → grim/slurp/wf-recorder (X11→Wayland)
- Rewrite screen-recording script for wf-recorder+slurp
- Add window-rewrite icons and style workspace buttons in waybar
- Set --class on kitty desktop entries for correct hyprland window matching
- Remove i3-keybindings script and stale rofi window rules
- Tweak cursor size, border colors, file-explorer dimensions
Diffstat (limited to 'modules/scripts/screen-recording')
| -rw-r--r-- | modules/scripts/screen-recording/assertions.nix | 8 | ||||
| -rw-r--r-- | modules/scripts/screen-recording/default.nix | 6 | ||||
| -rw-r--r-- | modules/scripts/screen-recording/script.sh | 46 |
3 files changed, 17 insertions, 43 deletions
diff --git a/modules/scripts/screen-recording/assertions.nix b/modules/scripts/screen-recording/assertions.nix index ad4d1eb..f858623 100644 --- a/modules/scripts/screen-recording/assertions.nix +++ b/modules/scripts/screen-recording/assertions.nix @@ -1,11 +1,11 @@ { config, ... }: [ { - assertion = !config.scripts.screen-recording.enable || config.media.ffmpeg.enable; - message = "scripts.screen-recording is enabled but requires `media.ffmpeg.enable`."; + assertion = !config.scripts.screen-recording.enable || config.media.slurp.enable; + message = "scripts.screen-recording is enabled but requires `media.slurp.enable`."; } { - assertion = !config.scripts.screen-recording.enable || config.media.slop.enable; - message = "scripts.screen-recording is enabled but requires `media.slop.enable`."; + assertion = !config.scripts.screen-recording.enable || config.media.wf-recorder.enable; + message = "scripts.screen-recording is enabled but requires `media.wf-recorder.enable`."; } ] diff --git a/modules/scripts/screen-recording/default.nix b/modules/scripts/screen-recording/default.nix index f687d36..b997b02 100644 --- a/modules/scripts/screen-recording/default.nix +++ b/modules/scripts/screen-recording/default.nix @@ -9,10 +9,10 @@ let base = mkScriptModule { name = "screen-recording"; path = ./script.sh; - description = "Screen recording script using FFmpeg and slop for region selection\nRecords X11 screen to MP4 with x264 encoding\nUsage: screen-recording.sh [-s|--select]\n -s, --select Launch slop to select recording region"; + description = "Screen recording script using wf-recorder and slurp for region selection\nRecords Wayland screen to MP4\nUsage: screen-recording.sh [-s|--select]\n -s, --select Launch slurp to select recording region"; deps = [ - config.media.ffmpeg.package - config.media.slop.package + config.media.slurp.package + config.media.wf-recorder.package ]; desktop = { enable = true; diff --git a/modules/scripts/screen-recording/script.sh b/modules/scripts/screen-recording/script.sh index a3bf86a..c2dafbe 100644 --- a/modules/scripts/screen-recording/script.sh +++ b/modules/scripts/screen-recording/script.sh @@ -17,43 +17,23 @@ while [[ "$#" -gt 0 ]]; do done # --- 2. GEOMETRY SELECTION --- -# Default to a standard 1080p fallback if detection fails -WIDTH=1920 -HEIGHT=1080 -X_OFF=0 -Y_OFF=0 - -# Try to get actual root window size if xwininfo exists -if command -v xwininfo >/dev/null 2>&1; then - WIDTH=$(xwininfo -root | grep 'Width:' | awk '{print $2}') - HEIGHT=$(xwininfo -root | grep 'Height:' | awk '{print $2}') -fi +GEOMETRY="" if [ "$SELECT_MODE" = true ]; then - if command -v slop >/dev/null 2>&1; then + if command -v slurp >/dev/null 2>&1; then echo -e "${YELLOW}Select a window or draw a box...${NC}" - # slop output: 123 456 10 20 - read -r W H X Y < <(slop -f "%w %h %x %y" --nokeyboard) + GEOMETRY=$(slurp) - if [ -n "$W" ]; then - WIDTH=$W - HEIGHT=$H - X_OFF=$X - Y_OFF=$Y - else + if [ -z "$GEOMETRY" ]; then echo "Selection cancelled. Exiting." exit 1 fi else - echo -e "${RED}Error: 'slop' not found.${NC} Recording full screen..." + echo -e "${RED}Error: 'slurp' not found.${NC} Recording full screen..." sleep 1 fi fi -# Ensure even dimensions (FFmpeg/x264 requirement) -WIDTH=$(( WIDTH + WIDTH % 2 )) -HEIGHT=$(( HEIGHT + HEIGHT % 2 )) - # --- 3. START RECORDING --- FILENAME="$OUT_DIR/recording-$(date +%Y%m%d-%H%M%S).mp4" @@ -62,16 +42,10 @@ echo -e "Press ${YELLOW}'q'${NC} in this terminal to stop." echo "File: $FILENAME" echo "------------------------------------------------" -# We pass arguments explicitly here to avoid "Unrecognized option" shell errors -ffmpeg -hide_banner \ - -f x11grab \ - -video_size "${WIDTH}x${HEIGHT}" \ - -framerate 30 \ - -i "${DISPLAY:-:0.0}+${X_OFF},${Y_OFF}" \ - -c:v libx264 \ - -preset ultrafast \ - -crf 23 \ - -pix_fmt yuv420p \ - "$FILENAME" +if [ -n "$GEOMETRY" ]; then + wf-recorder -g "$GEOMETRY" -f "$FILENAME" +else + wf-recorder -f "$FILENAME" +fi echo -e "\n${GREEN}Done!${NC} Video saved to $FILENAME" |
