feat(hyprrecord): add prototype screen recording script, still needs some work
This commit is contained in:
parent
9ace54121a
commit
40083a5db5
5 changed files with 64 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{ lib, config, pkgs, inputs, ... }:
|
||||
let
|
||||
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
|
||||
inherit (import ./pkgs {inherit pkgs;}) hyprbrightness hyprvolume hyprkillsession;
|
||||
inherit (import ./pkgs {inherit pkgs;}) hyprrecord hyprbrightness hyprvolume hyprkillsession;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
|
@ -22,6 +22,7 @@ in
|
|||
hyprvolume
|
||||
hyprkillsession
|
||||
hyprbrightness
|
||||
hyprrecord
|
||||
];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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 {};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
|
||||
pkgs.writeShellScriptBin "hyprrecord" ''
|
||||
${builtins.readFile ./hyprrecord.sh}
|
||||
''
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#!/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)
|
||||
|
|
@ -42,6 +42,9 @@ in
|
|||
|
||||
", Print, exec, grimblast --notify --cursor copysave area"
|
||||
"SUPER, Print, exec, grimblast --notify --cursor copysave screen"
|
||||
"SUPER, r, exec, hyprrecord -a"
|
||||
"SUPER CTRL, r, exec, hyprrecord -a -r"
|
||||
|
||||
|
||||
# Brightness
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue