From fd4b574ee74c09364602aafd40d526c30b04ca82 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sun, 24 Sep 2023 21:07:05 +0200 Subject: [PATCH] pinwheel: Add module for `screenshot`s --- flake.lock | 21 +++++++++++++++++++ flake.nix | 5 +++++ hosts/pinwheel/configuration.nix | 1 + hosts/pinwheel/modules/screenshot/default.nix | 20 ++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 hosts/pinwheel/modules/screenshot/default.nix diff --git a/flake.lock b/flake.lock index 79e9073..21dd4f9 100644 --- a/flake.lock +++ b/flake.lock @@ -125,6 +125,26 @@ "type": "github" } }, + "hyprland-contrib": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1695455081, + "narHash": "sha256-AtAMze2J5Maol28OLQoCFgppRWEy06Mn9RhduXNmhiI=", + "owner": "hyprwm", + "repo": "contrib", + "rev": "33663f663e07b4ca52c9165f74e3d793f08b15e7", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "contrib", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1695109627, @@ -194,6 +214,7 @@ "agenix": "agenix", "emacs-overlay": "emacs-overlay", "home-manager": "home-manager_2", + "hyprland-contrib": "hyprland-contrib", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs2211": "nixpkgs2211" diff --git a/flake.nix b/flake.nix index 7d8576c..c3b9f56 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,11 @@ url = "github:nix-community/emacs-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprland-contrib = { + url = "github:hyprwm/contrib"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, ... } @inputs : { diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index cb96204..3bb24ec 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -23,6 +23,7 @@ ./modules/swaylock ./modules/dunst ./modules/bemenu + ./modules/screenshot ./modules/fzf ./modules/syncthing ./modules/firefox diff --git a/hosts/pinwheel/modules/screenshot/default.nix b/hosts/pinwheel/modules/screenshot/default.nix new file mode 100644 index 0000000..37be871 --- /dev/null +++ b/hosts/pinwheel/modules/screenshot/default.nix @@ -0,0 +1,20 @@ +{ inputs, pkgs, system, ...}: +let + grimblast = inputs.hyprland-contrib.packages.${system}.grimblast; + area = "${pkgs.libnotify}/bin/notify-send 'ps: selected area' && ${grimblast}/bin/grimblast copy area"; + screen = "${pkgs.libnotify}/bin/notify-send 'ps: selected screen' &&${grimblast}/bin/grimblast copy output"; +in +{ + home-manager.users.alex = { + home.packages = [ grimblast ]; + + wayland.windowManager.hyprland = { + settings = { + bind = [ + "$mod, Print, exec, ${area}" + "$mod CTRL, Print, exec, ${screen}" + ]; + }; + }; + }; +}