diff --git a/flake.nix b/flake.nix index 4209795..3c6240d 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,11 @@ url = "github:hyprwm/hypridle"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprrecord = { + url = "github:ooks-io/hyprrecord"; + inputs.nixpkgs.follows = "nixpkgs"; + }; hyprpaper.url = "github:hyprwm/hyprpaper"; diff --git a/home/modules/desktop/wayland/windowManager/hyprland/default.nix b/home/modules/desktop/wayland/windowManager/hyprland/default.nix index 1fd2fe6..0c4f392 100644 --- a/home/modules/desktop/wayland/windowManager/hyprland/default.nix +++ b/home/modules/desktop/wayland/windowManager/hyprland/default.nix @@ -1,7 +1,7 @@ { lib, config, pkgs, inputs, ... }: let cfg = config.homeModules.desktop.wayland.windowManager.hyprland; - inherit (import ./pkgs {inherit pkgs;}) hyprrecord hyprbrightness hyprvolume hyprkillsession; + inherit (import ./pkgs {inherit pkgs;}) hyprbrightness hyprvolume hyprkillsession; in { imports = [ @@ -22,8 +22,8 @@ in hyprvolume hyprkillsession hyprbrightness - hyprrecord - ]; + inputs.hyprrecord.packages.${pkgs.system}.hyprrecord + ]; wayland.windowManager.hyprland = { enable = true; diff --git a/home/modules/desktop/wayland/windowManager/hyprland/pkgs/default.nix b/home/modules/desktop/wayland/windowManager/hyprland/pkgs/default.nix index 5098d98..f03b479 100644 --- a/home/modules/desktop/wayland/windowManager/hyprland/pkgs/default.nix +++ b/home/modules/desktop/wayland/windowManager/hyprland/pkgs/default.nix @@ -4,7 +4,6 @@ let packages = { hyprvolume = pkgs.callPackage ./hyprvolume.nix {}; hyprbrightness = pkgs.callPackage ./hyprbrightness.nix {}; - hyprrecord = pkgs.callPackage ./hyprrecord {}; # Script to help Hyprland quit https://github.com/hyprwm/Hyprland/issues/3558#issuecomment-1848768654 hyprkillsession = pkgs.callPackage ./hyprkillsession.nix {}; }; diff --git a/home/modules/desktop/wayland/windowManager/hyprland/pkgs/hyprrecord/default.nix b/home/modules/desktop/wayland/windowManager/hyprland/pkgs/hyprrecord/default.nix deleted file mode 100644 index 2b6d270..0000000 --- a/home/modules/desktop/wayland/windowManager/hyprland/pkgs/hyprrecord/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: - - -pkgs.writeShellScriptBin "hyprrecord" '' - ${builtins.readFile ./hyprrecord.sh} - '' - - - - diff --git a/home/modules/desktop/wayland/windowManager/hyprland/pkgs/hyprrecord/hyprrecord.sh b/home/modules/desktop/wayland/windowManager/hyprland/pkgs/hyprrecord/hyprrecord.sh deleted file mode 100755 index 623907a..0000000 --- a/home/modules/desktop/wayland/windowManager/hyprland/pkgs/hyprrecord/hyprrecord.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -getTargetDirectory() { - test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" && - . "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" - echo "${XDG_RECORDINGS_DIR:-${XDG_VIDEOS_DIR:-$HOME}}" -} - -SINK="$(pactl get-default-sink).monitor" -AUDIO="" -FILE="--file=$(getTargetDirectory)/$(date -Ins).mp4" -SET_REGION=false - -while [[ "$#" -gt 0 ]]; do - case $1 in - -a | --audio) - AUDIO="--audio=$SINK" - shift - ;; - -r | --region) - SET_REGION=true - shift - ;; - *) - echo "Unknown parameter passed: $1" - exit 1 - ;; - esac -done - -notify() { - notify-send -t 5000 -a system-notify "$@" -} - -takeRecording() { - if pgrep -x "wf-recorder" >/dev/null; then - pkill -x "wf-recorder" - notify "Recording Stopped" - else - # Only invoke slurp if starting a new recording and the region option was set - if [ "$SET_REGION" = true ]; then - REGION="--geometry=$(slurp)" - fi - wf-recorder "$AUDIO" "$REGION" "$FILE" - fi -} - -echo $(takeRecording)