From 2f64a2097812c1820766909037e724f3415c7576 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sun, 26 Jul 2026 00:13:26 +0530 Subject: feat: migrate to Wayland-native media tools, drop X11 cruft, polish waybar and hyprland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- modules/communication/neomutt/neomutt.nix | 2 +- modules/desktop/hyprland/default.nix | 22 ++------- modules/desktop/hyprland/keybindings.nix | 12 +++-- modules/desktop/rofi/theme.mustache.rasi | 18 ++++--- modules/desktop/waybar/module/default.nix | 2 +- modules/desktop/waybar/module/network.nix | 4 +- modules/desktop/waybar/module/workspaces.nix | 34 ++++++++++++- modules/desktop/waybar/style.nix | 9 +++- modules/file-management/yazi/default.nix | 2 +- modules/media/default.nix | 8 +-- modules/media/ffmpeg/default.nix | 17 ------- modules/media/grim/default.nix | 17 +++++++ modules/media/maim/default.nix | 17 ------- modules/media/slop/default.nix | 17 ------- modules/media/slurp/default.nix | 17 +++++++ modules/media/wf-recorder/default.nix | 17 +++++++ modules/networking/bluetui/default.nix | 2 +- modules/networking/impala/default.nix | 2 +- modules/scripts/default.nix | 3 +- modules/scripts/i3-keybindings/assertions.nix | 11 ----- modules/scripts/i3-keybindings/default.nix | 30 ----------- modules/scripts/i3-keybindings/script.sh | 66 ------------------------- modules/scripts/screen-recording/assertions.nix | 8 +-- modules/scripts/screen-recording/default.nix | 6 +-- modules/scripts/screen-recording/script.sh | 46 ++++------------- modules/web/w3m/default.nix | 2 +- 26 files changed, 141 insertions(+), 250 deletions(-) delete mode 100644 modules/media/ffmpeg/default.nix create mode 100644 modules/media/grim/default.nix delete mode 100644 modules/media/maim/default.nix delete mode 100644 modules/media/slop/default.nix create mode 100644 modules/media/slurp/default.nix create mode 100644 modules/media/wf-recorder/default.nix delete mode 100644 modules/scripts/i3-keybindings/assertions.nix delete mode 100644 modules/scripts/i3-keybindings/default.nix delete mode 100644 modules/scripts/i3-keybindings/script.sh (limited to 'modules') diff --git a/modules/communication/neomutt/neomutt.nix b/modules/communication/neomutt/neomutt.nix index 6cabf98..734bf7d 100644 --- a/modules/communication/neomutt/neomutt.nix +++ b/modules/communication/neomutt/neomutt.nix @@ -9,7 +9,7 @@ let neomuttDesktopItem = pkgs.makeDesktopItem { name = "neomutt"; desktopName = "NeoMutt"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe config.programs.neomutt.package}"; + exec = "${lib.getExe config.terminal.kitty.package} --class neomutt -e ${lib.getExe config.programs.neomutt.package}"; icon = "kitty"; categories = [ "Network" diff --git a/modules/desktop/hyprland/default.nix b/modules/desktop/hyprland/default.nix index 37f22d8..7c5f811 100644 --- a/modules/desktop/hyprland/default.nix +++ b/modules/desktop/hyprland/default.nix @@ -32,7 +32,7 @@ in border_size = 1; col = { active_border = { - colors = [ (toHyprColor base03) ]; + colors = [ (toHyprColor base07) ]; angle = 45; }; inactive_border = toHyprColor base00; @@ -67,29 +67,13 @@ in { name = "size-file-explorer"; match.class = "^(file-explorer)$"; - size = "1280 720"; + size = "1000 600"; } { name = "center-file-explorer"; match.class = "^(file-explorer)$"; center = true; } - - { - name = "float-rofi"; - match.class = "^(rofi)$"; - float = true; - } - { - name = "size-rofi"; - match.class = "^(rofi)$"; - size = "800 600"; - } - { - name = "center-rofi"; - match.class = "^(rofi)$"; - center = true; - } ]; }; }; @@ -98,7 +82,7 @@ in enable = true; package = pkgs.rose-pine-hyprcursor; name = "rose-pine-hyprcursor"; - size = 20; + size = 18; hyprcursor.enable = true; gtk.enable = false; x11.enable = false; diff --git a/modules/desktop/hyprland/keybindings.nix b/modules/desktop/hyprland/keybindings.nix index f8f074c..a72c965 100644 --- a/modules/desktop/hyprland/keybindings.nix +++ b/modules/desktop/hyprland/keybindings.nix @@ -134,9 +134,13 @@ in (bind "SHIFT + 0" "hl.dsp.window.move({ workspace = 10 })") # --- Screenshots --- - (bind "P" (execLuaSingle "grim -g \"$(slurp)\" - | wl-copy")) - (bind "SHIFT + P" ( - execLuaSingle "mkdir -p ~/Pictures/Screenshots && grim -g \"$(slurp)\" ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png" - )) + (lib.optionals (config.media.grim.enable && config.media.slurp.enable) [ + (bind "P" ( + execLuaSingle "${lib.getExe config.media.grim.package} -g \"$(${lib.getExe config.media.slurp.package})\" - | wl-copy" + )) + (bind "SHIFT + P" ( + execLuaSingle "mkdir -p ~/Pictures/Screenshots && ${lib.getExe config.media.grim.package} -g \"$(${lib.getExe config.media.slurp.package})\" ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png" + )) + ]) ]; } diff --git a/modules/desktop/rofi/theme.mustache.rasi b/modules/desktop/rofi/theme.mustache.rasi index d877fe8..794da97 100644 --- a/modules/desktop/rofi/theme.mustache.rasi +++ b/modules/desktop/rofi/theme.mustache.rasi @@ -42,15 +42,15 @@ background-color: transparent; foreground: @base07; - border-color: @base03; + border-color: @base07; separatorcolor: @base02; - selected-normal-background: @base02; + selected-normal-background: @base00; selected-normal-foreground: @base07; - selected-active-background: @base0D; - selected-active-foreground: @base00; - selected-urgent-background: @base08; - selected-urgent-foreground: @base00; + selected-active-background: @base00; + selected-active-foreground: @base07; + selected-urgent-background: @base00; + selected-urgent-foreground: @base0F; normal-background: @base00; normal-foreground: @base03; @@ -78,8 +78,10 @@ mainbox { } inputbar { - background-color: @base01; + background-color: @background; text-color: @foreground; + border: 1.5px; + border-color: @border-color; padding: 10px 14px; spacing: 10px; children: [ "prompt", "entry" ]; @@ -88,7 +90,7 @@ inputbar { prompt { background-color: transparent; text-color: @base04; - font: "JetBrainsMono Nerd Font Bold 11"; + font: "FiraCode Nerd Font Bold 11"; } entry { diff --git a/modules/desktop/waybar/module/default.nix b/modules/desktop/waybar/module/default.nix index 628b534..ee2918a 100644 --- a/modules/desktop/waybar/module/default.nix +++ b/modules/desktop/waybar/module/default.nix @@ -6,7 +6,7 @@ with config.scheme.withHashtag; { mainBar = { - "hyprland/workspaces" = import ./workspaces.nix { inherit config; }; + "hyprland/workspaces" = import ./workspaces.nix { inherit config lib; }; "hyprland/window" = import ./window.nix { inherit config; }; "pulseaudio" = import ./volume.nix { inherit config; diff --git a/modules/desktop/waybar/module/network.nix b/modules/desktop/waybar/module/network.nix index 514d54e..fb1e836 100644 --- a/modules/desktop/waybar/module/network.nix +++ b/modules/desktop/waybar/module/network.nix @@ -3,8 +3,8 @@ with config.scheme.withHashtag; { interval = 2; - format-wifi = "{icon} 󰁅 {bandwidthDownBytes} 󰁝 {bandwidthUpBytes}"; - format-ethernet = " 󰁅 {bandwidthDownBytes} 󰁝 {bandwidthUpBytes}"; + format-wifi = "{icon} 󰁅{bandwidthDownBytes} 󰁝{bandwidthUpBytes}"; + format-ethernet = " 󰁅{bandwidthDownBytes} 󰁝{bandwidthUpBytes}"; format-disconnected = "󰤮 Disconnected"; tooltip-format = "{ifname}"; diff --git a/modules/desktop/waybar/module/workspaces.nix b/modules/desktop/waybar/module/workspaces.nix index b3625dc..a16b9e5 100644 --- a/modules/desktop/waybar/module/workspaces.nix +++ b/modules/desktop/waybar/module/workspaces.nix @@ -1,7 +1,12 @@ -{ config }: +{ config, lib }: with config.scheme.withHashtag; +let + mkWindowRewrite = + enable: color: icon: + lib.mkIf enable "${icon}"; +in { - format = "{name}"; + format = "{windows} {id}"; persistent-workspaces = { "*" = [ 1 @@ -16,4 +21,29 @@ with config.scheme.withHashtag; 10 ]; }; + window-rewrite-default = ""; + window-rewrite = { + "class" = mkWindowRewrite config.web.chromium.enable "#4285F4" ""; + "class" = mkWindowRewrite config.terminal.kitty.enable "#F5A97F" "󰄛"; + "class" = mkWindowRewrite config.media.vlc.enable "#FF8800" "󰕼"; + "class" = mkWindowRewrite config.media.feh.enable "#7EC699" "󰋩"; + "class" = mkWindowRewrite config.office.zathura.enable "#E06C75" ""; + "class" = mkWindowRewrite config.gaming.heroic.enable "#4B93FF" "󱎓"; + "class" = mkWindowRewrite config.gaming.steam.enable "#1B2838" "󰓓"; + "class" = mkWindowRewrite config.development.bruno.enable "#F97316" "󰩃"; + "class" = mkWindowRewrite config.development.vscodium.enable "#3993EE" ""; + "class<.virt-manager-wrapped>" = mkWindowRewrite config.development.qemu.enable "#AD8AFF" "󰟀"; + "class" = mkWindowRewrite config.development.opencode.enable "#98C379" "󰘦"; + "class" = mkWindowRewrite config.security.enteauth.enable "#E5C07B" "󰍀"; + "class" = mkWindowRewrite config.file-management.yazi.enable "#56B6C2" "󰉋"; + "class" = mkWindowRewrite config.file-management.yazi.enable "#56B6C2" "󰉋"; + "class" = mkWindowRewrite config.web.w3m.enable "#8BE9FD" "󰖟"; + "class" = mkWindowRewrite config.networking.bluetui.enable "#BD93F9" ""; + "class" = mkWindowRewrite config.networking.impala.enable "#50FA7B" "󰤢"; + "class" = mkWindowRewrite config.communication.neomutt.enable "#FFB86C" "󰇮"; + "class" = mkWindowRewrite config.desktop.rofi.enable "#BD93F9" ""; + "class" = mkWindowRewrite config.scripts.aria2-run.enable "#8BE9FD" ""; + "class" = mkWindowRewrite config.scripts.screen-recording.enable "#FF5555" ""; + "class" = mkWindowRewrite config.scripts.system-monitor.enable "#50FA7B" "󰄨"; + }; } diff --git a/modules/desktop/waybar/style.nix b/modules/desktop/waybar/style.nix index 861555e..b0da995 100644 --- a/modules/desktop/waybar/style.nix +++ b/modules/desktop/waybar/style.nix @@ -32,7 +32,7 @@ with config.scheme.withHashtag; #window, #pulseaudio, #battery, #custom-vpn, #network, #clock.time, #memory, #cpu, #clock.date { - border: 1.5px solid ${base03}; + border: 1.5px solid ${base07}; color: ${base07}; padding: 0 8px; } @@ -45,6 +45,7 @@ with config.scheme.withHashtag; min-width: 24px; min-height: 24px; margin: 0 2px; + font-size: 30px; } #workspaces button:hover { @@ -52,7 +53,11 @@ with config.scheme.withHashtag; } #workspaces button.active { - background: ${base03}; + border-color: ${base07}; + } + + #workspaces button.empty { + color: ${base03}; } #workspaces button.urgent { diff --git a/modules/file-management/yazi/default.nix b/modules/file-management/yazi/default.nix index f52943f..6a6afdb 100644 --- a/modules/file-management/yazi/default.nix +++ b/modules/file-management/yazi/default.nix @@ -30,7 +30,7 @@ xdg.desktopEntries."yazi" = { name = "Yazi"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe config.file-management.yazi.package}"; + exec = "${lib.getExe config.terminal.kitty.package} --class yazi -e ${lib.getExe config.file-management.yazi.package}"; icon = "kitty"; categories = [ "Utility" ]; comment = "Terminal file manager"; diff --git a/modules/media/default.nix b/modules/media/default.nix index d408b66..0690e1e 100644 --- a/modules/media/default.nix +++ b/modules/media/default.nix @@ -1,14 +1,14 @@ -# Media - Multimedia tools (feh, ffmpeg, maim, pamixer, playerctl, slop, vlc) +# Media - Multimedia tools (feh, grim, pamixer, playerctl, slurp, vlc, wf-recorder) { ... }: { imports = [ ./feh - ./ffmpeg - ./maim + ./grim ./pamixer ./playerctl - ./slop + ./slurp ./vlc + ./wf-recorder ]; } diff --git a/modules/media/ffmpeg/default.nix b/modules/media/ffmpeg/default.nix deleted file mode 100644 index b0d5c25..0000000 --- a/modules/media/ffmpeg/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -# FFmpeg - Command-line audio/video converter and streaming tool -{ - config, - pkgs, - lib, - ... -}: -{ - options.media.ffmpeg = { - enable = lib.mkEnableOption "Enables ffmpeg."; - package = lib.mkPackageOption pkgs "ffmpeg-full" { }; - }; - - config = lib.mkIf config.media.ffmpeg.enable { - home.packages = [ config.media.ffmpeg.package ]; - }; -} diff --git a/modules/media/grim/default.nix b/modules/media/grim/default.nix new file mode 100644 index 0000000..b8d3645 --- /dev/null +++ b/modules/media/grim/default.nix @@ -0,0 +1,17 @@ +# Grim - Screenshot utility for wlroots Wayland compositors +{ + config, + lib, + pkgs, + ... +}: +{ + options.media.grim = { + enable = lib.mkEnableOption "Enables grim."; + package = lib.mkPackageOption pkgs "grim" { }; + }; + + config = lib.mkIf config.media.grim.enable { + home.packages = [ config.media.grim.package ]; + }; +} diff --git a/modules/media/maim/default.nix b/modules/media/maim/default.nix deleted file mode 100644 index a067935..0000000 --- a/modules/media/maim/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -# Maim - Screenshot utility (slop-based region selection) -{ - config, - lib, - pkgs, - ... -}: -{ - options.media.maim = { - enable = lib.mkEnableOption "Enables maim."; - package = lib.mkPackageOption pkgs "maim" { }; - }; - - config = lib.mkIf config.media.maim.enable { - home.packages = [ config.media.maim.package ]; - }; -} diff --git a/modules/media/slop/default.nix b/modules/media/slop/default.nix deleted file mode 100644 index 69af64b..0000000 --- a/modules/media/slop/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -# Slop - Region selector for screenshots (used by maim/flameshot) -{ - config, - lib, - pkgs, - ... -}: -{ - options.media.slop = { - enable = lib.mkEnableOption "Enables slop."; - package = lib.mkPackageOption pkgs "slop" { }; - }; - - config = lib.mkIf config.media.slop.enable { - home.packages = [ config.media.slop.package ]; - }; -} diff --git a/modules/media/slurp/default.nix b/modules/media/slurp/default.nix new file mode 100644 index 0000000..6288e14 --- /dev/null +++ b/modules/media/slurp/default.nix @@ -0,0 +1,17 @@ +# Slurp - Region selector for wlroots Wayland compositors (used by grim) +{ + config, + lib, + pkgs, + ... +}: +{ + options.media.slurp = { + enable = lib.mkEnableOption "Enables slurp."; + package = lib.mkPackageOption pkgs "slurp" { }; + }; + + config = lib.mkIf config.media.slurp.enable { + home.packages = [ config.media.slurp.package ]; + }; +} diff --git a/modules/media/wf-recorder/default.nix b/modules/media/wf-recorder/default.nix new file mode 100644 index 0000000..60e6f4c --- /dev/null +++ b/modules/media/wf-recorder/default.nix @@ -0,0 +1,17 @@ +# Wf-recorder - Screen recording utility for wlroots Wayland compositors +{ + config, + pkgs, + lib, + ... +}: +{ + options.media.wf-recorder = { + enable = lib.mkEnableOption "Enables wf-recorder."; + package = lib.mkPackageOption pkgs "wf-recorder" { }; + }; + + config = lib.mkIf config.media.wf-recorder.enable { + home.packages = [ config.media.wf-recorder.package ]; + }; +} diff --git a/modules/networking/bluetui/default.nix b/modules/networking/bluetui/default.nix index 6aefc6a..c6cb96b 100644 --- a/modules/networking/bluetui/default.nix +++ b/modules/networking/bluetui/default.nix @@ -9,7 +9,7 @@ let bluetuiDesktopItem = pkgs.makeDesktopItem { name = "bluetui"; desktopName = "BlueTUI"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe config.networking.bluetui.package}"; + exec = "${lib.getExe config.terminal.kitty.package} --class bluetui -e ${lib.getExe config.networking.bluetui.package}"; icon = "kitty"; categories = [ "Network" ]; comment = "Bluetooth TUI client"; diff --git a/modules/networking/impala/default.nix b/modules/networking/impala/default.nix index 6d37361..81b9df5 100644 --- a/modules/networking/impala/default.nix +++ b/modules/networking/impala/default.nix @@ -9,7 +9,7 @@ let impalaDesktopItem = pkgs.makeDesktopItem { name = "impala"; desktopName = "Impala"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe config.networking.impala.package}"; + exec = "${lib.getExe config.terminal.kitty.package} --class impala -e ${lib.getExe config.networking.impala.package}"; icon = "kitty"; categories = [ "Network" ]; comment = "TUI for managing wifi on Linux"; diff --git a/modules/scripts/default.nix b/modules/scripts/default.nix index 5e70c4e..5f1820e 100644 --- a/modules/scripts/default.nix +++ b/modules/scripts/default.nix @@ -8,7 +8,6 @@ imports = [ ./aria2-run ./deep-clean - ./i3-keybindings ./neomutt-sync ./screen-recording ./system-monitor @@ -28,7 +27,7 @@ pkgs.makeDesktopItem { name = name; desktopName = sc.desktop.displayName; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe sc.package}"; + exec = "${lib.getExe config.terminal.kitty.package} --class ${name} -e ${lib.getExe sc.package}"; icon = "kitty"; categories = [ "Utility" ]; terminal = false; diff --git a/modules/scripts/i3-keybindings/assertions.nix b/modules/scripts/i3-keybindings/assertions.nix deleted file mode 100644 index ce1dd6b..0000000 --- a/modules/scripts/i3-keybindings/assertions.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, ... }: -[ - { - assertion = !config.scripts.i3-keybindings.enable || config.desktop.enable; - message = "scripts.i3-keybindings is enabled but requires `desktop.enable`."; - } - { - assertion = !config.scripts.i3-keybindings.enable || config.terminal.less.enable; - message = "scripts.i3-keybindings is enabled but requires `terminal.less.enable`."; - } -] diff --git a/modules/scripts/i3-keybindings/default.nix b/modules/scripts/i3-keybindings/default.nix deleted file mode 100644 index e1be7fe..0000000 --- a/modules/scripts/i3-keybindings/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit ((import ../lib.nix { inherit lib pkgs; })) mkScriptModule; - base = mkScriptModule { - name = "i3-keybindings"; - path = ./script.sh; - description = "Path to your i3 config file"; - deps = [ - pkgs.coreutils - pkgs.gawk - pkgs.ncurses - ]; - desktop = { - enable = true; - displayName = "i3 Keybindings"; - }; - inherit config; - }; -in -{ - options = base.options; - config = base.moduleConfig // { - assertions = base.moduleConfig.assertions ++ (import ./assertions.nix { inherit config lib; }); - }; -} diff --git a/modules/scripts/i3-keybindings/script.sh b/modules/scripts/i3-keybindings/script.sh deleted file mode 100644 index 326e8bd..0000000 --- a/modules/scripts/i3-keybindings/script.sh +++ /dev/null @@ -1,66 +0,0 @@ -I3_CONFIG="$HOME/.config/i3/config" - -# Function to wrap text -wrap_text() { - local text="$1" - local width="$2" - echo "$text" | fold -s -w "$width" -} - -# Get terminal width and calculate columns -terminal_width=$(tput cols) -table_width=$((terminal_width - 4)) -max_keybinding_length=$((table_width / 3)) # Keybindings are usually shorter in i3 -max_keybinding_content_length=$((max_keybinding_length - 2)) -description_width=$((table_width - max_keybinding_length - 1)) -description_content_width=$((description_width - 2)) - -# Border lines -top_border="┌$(printf '%.0s─' $(seq 1 $max_keybinding_length))┬$(printf '%.0s─' $(seq 1 $description_width))┐" -row_sep="├$(printf '%.0s─' $(seq 1 $max_keybinding_length))┼$(printf '%.0s─' $(seq 1 $description_width))┤" -bottom_border="└$(printf '%.0s─' $(seq 1 $max_keybinding_length))┴$(printf '%.0s─' $(seq 1 $description_width))┘" - -{ - echo "$top_border" - printf "│ %-*s │ %-*s │\n" "$max_keybinding_content_length" "KEYBINDING" "$description_content_width" "DESCRIPTION" - - last_comment="" - - # Read i3 config line by line - while IFS= read -r line; do - # If line is a comment, store it as a potential description - if [[ $line =~ ^#\ (.*) ]]; then - last_comment="${BASH_REMATCH[1]}" - - # If line contains a bindsym - elif [[ $line =~ ^bindsym ]]; then - # Extract the key combo (the parts between 'bindsym' and the start of the command/exec) - # This regex captures bindsym [options] - keybinding=$(echo "$line" | awk '{print $2}') - - # If the comment is empty, use the command itself as the description - if [[ -z "$last_comment" ]]; then - display_desc=$(echo "$line" | cut -d' ' -f3-) - else - display_desc="$last_comment" - fi - - wrapped_description=$(wrap_text "$display_desc" "$description_content_width") - - echo "$row_sep" - - # Print first line of binding and description - printf "│ %-*s │ %-*s │\n" "$max_keybinding_content_length" "$keybinding" "$description_content_width" "$(echo "$wrapped_description" | head -n 1)" - - # Print subsequent lines of wrapped description - echo "$wrapped_description" | sed '1d' | while read -r continuation; do - printf "│ %-*s │ %-*s │\n" "$max_keybinding_content_length" "" "$description_content_width" "$continuation" - done - - # Reset comment after use - last_comment="" - fi - done < "$I3_CONFIG" - - echo "$bottom_border" -} | less -R 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" diff --git a/modules/web/w3m/default.nix b/modules/web/w3m/default.nix index 3dad0a2..5316e04 100644 --- a/modules/web/w3m/default.nix +++ b/modules/web/w3m/default.nix @@ -9,7 +9,7 @@ let w3mDesktopItem = pkgs.makeDesktopItem { name = "w3m"; desktopName = "w3m"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe' config.web.w3m.package "w3m"}"; + exec = "${lib.getExe config.terminal.kitty.package} --class w3m -e ${lib.getExe' config.web.w3m.package "w3m"}"; icon = "kitty"; categories = [ "Network" ]; comment = "Text-based web browser"; -- cgit v1.2.3