refactor(hypr): use screen-cap
as a nix package
This commit is contained in:
parent
3c121195e4
commit
f980f035c0
@ -4,6 +4,7 @@
|
|||||||
rustPlatform = pkgs.rustPlatform;
|
rustPlatform = pkgs.rustPlatform;
|
||||||
fetchFromGitHub = pkgs.fetchFromGitHub;
|
fetchFromGitHub = pkgs.fetchFromGitHub;
|
||||||
};
|
};
|
||||||
|
screen-cap = pkgs.callPackage ./screen-cap/default.nix { };
|
||||||
Fmt = pkgs.writeShellApplication {
|
Fmt = pkgs.writeShellApplication {
|
||||||
name = "Fmt";
|
name = "Fmt";
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
|
17
pkgs/screen-cap/default.nix
Normal file
17
pkgs/screen-cap/default.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "screen-cap";
|
||||||
|
runtimeInputs = with pkgs; [
|
||||||
|
wl-screenrec
|
||||||
|
gifski
|
||||||
|
inotify-tools
|
||||||
|
libnotify
|
||||||
|
mktemp
|
||||||
|
slurp
|
||||||
|
file
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
#!${pkgs.bash}/bin/bash
|
||||||
|
${builtins.readFile ./screen-cap.bash}
|
||||||
|
'';
|
||||||
|
}
|
14
users/price/dots/.config/hypr/scripts/screen-cap.bash → pkgs/screen-cap/screen-cap.bash
Executable file → Normal file
14
users/price/dots/.config/hypr/scripts/screen-cap.bash → pkgs/screen-cap/screen-cap.bash
Executable file → Normal file
@ -1,14 +1,4 @@
|
|||||||
#!/usr/bin/env -S nix shell github:nix-community/nixgl#nixGLIntel nixpkgs#bash nixpkgs#wl-screenrec nixpkgs#gifski nixpkgs#inotify-tools nixpkgs#libnotify nixpkgs#mktemp nixpkgs#slurp nixpkgs#slurp --command bash
|
set -euoE pipefail
|
||||||
|
|
||||||
# Dependencies:
|
|
||||||
# - wl-screenrec: https://github.com/russelltg/wl-screenrec
|
|
||||||
# - notification daemon: https://archlinux.org/packages/?name=notification-daemon
|
|
||||||
# - wl-clipboard: https://github.com/bugaevc/wl-clipboard
|
|
||||||
# - gifski: https://github.com/sindresorhus/Gifski
|
|
||||||
#
|
|
||||||
# Gifski is necessary because `wl-screenrec` doesn't support gifs
|
|
||||||
|
|
||||||
# set -euoE pipefail
|
|
||||||
|
|
||||||
mk-screen-cap() {
|
mk-screen-cap() {
|
||||||
local program_name="Screen Capture"
|
local program_name="Screen Capture"
|
||||||
@ -40,7 +30,7 @@ mk-screen-cap() {
|
|||||||
|
|
||||||
local geometry
|
local geometry
|
||||||
geometry="$(slurp)"
|
geometry="$(slurp)"
|
||||||
nixGLIntel wl-screenrec --filename "$tmp_file" --geometry "$geometry" &
|
wl-screenrec --filename "$tmp_file" --geometry "$geometry" &
|
||||||
local pid="${!}"
|
local pid="${!}"
|
||||||
printf "%s" "$pid" >"$pid_file"
|
printf "%s" "$pid" >"$pid_file"
|
||||||
printf "Putting pid: '%d' into pid file: '%s'\n" "$pid" "$pid_file"
|
printf "Putting pid: '%d' into pid file: '%s'\n" "$pid" "$pid_file"
|
@ -74,8 +74,8 @@ bind = SUPERSHIFT,M,exit
|
|||||||
# May be videos or screenshots
|
# May be videos or screenshots
|
||||||
bind = SUPER,S,exec,grim -g "$(slurp)" - | swappy -f - -o - | wl-copy
|
bind = SUPER,S,exec,grim -g "$(slurp)" - | swappy -f - -o - | wl-copy
|
||||||
bind = CTRLSUPER,S,exec,grim -g "$(slurp)" - | wl-copy --type image/png
|
bind = CTRLSUPER,S,exec,grim -g "$(slurp)" - | wl-copy --type image/png
|
||||||
bind = SUPERSHIFT,S,exec,~/.config/hypr/scripts/screen-cap.bash
|
bind = SUPERSHIFT,S,exec,screen-cap
|
||||||
bind = SUPERSHIFT,A,exec,~/.config/hypr/scripts/screen-cap.bash gif
|
bind = SUPERSHIFT,A,exec,screen-cap gif
|
||||||
|
|
||||||
# Mediakey bindings as taken from `wev`
|
# Mediakey bindings as taken from `wev`
|
||||||
bindl = ,XF86AudioPrev,exec,playerctl previous
|
bindl = ,XF86AudioPrev,exec,playerctl previous
|
||||||
|
@ -47,6 +47,7 @@ in
|
|||||||
slurp
|
slurp
|
||||||
unzip
|
unzip
|
||||||
Fmt
|
Fmt
|
||||||
|
screen-cap
|
||||||
starship
|
starship
|
||||||
nodePackages.prettier
|
nodePackages.prettier
|
||||||
cargo
|
cargo
|
||||||
|
Loading…
Reference in New Issue
Block a user