From be4d78b4f63d33e1c7e27ee3a3ba83aab85fa202 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Wed, 2 Aug 2023 13:07:07 +0200 Subject: [PATCH] feat: screenshot script --- home/desktop-river/default.nix | 17 +++++++++-------- home/desktop-river/screenshot.nix | 12 ++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 home/desktop-river/screenshot.nix diff --git a/home/desktop-river/default.nix b/home/desktop-river/default.nix index a91899a..e30a181 100644 --- a/home/desktop-river/default.nix +++ b/home/desktop-river/default.nix @@ -27,19 +27,20 @@ wl-clipboard wtype xdg-utils + (pks.callPackage ./screenshot.nix { inherit config pkgs; }) ]; - programs.zsh.loginExtra = '' + programs. zsh. loginExtra = '' if [[ -z "''${DISPLAY}" ]] && [[ "''${XDG_VTNR}" -eq 1 ]]; then - exec ${pkgs.river}/bin/river + exec ${ pkgs. river}/bin/river fi ''; - home.sessionVariables.XKB_DEFAULT_LAYOUT = "us"; - home.sessionVariables.XKB_DEFAULT_VARIANT = "altgr-intl"; - home.sessionVariables.XKB_DEFAULT_OPTIONS = "caps:escape"; + home. sessionVariables. XKB_DEFAULT_LAYOUT = "us"; + home. sessionVariables. XKB_DEFAULT_VARIANT = "altgr-intl"; + home. sessionVariables. XKB_DEFAULT_OPTIONS = "caps:escape"; - systemd.user.targets.river-session = { + systemd. user. targets. river-session = { Unit = { Description = "river window manager session"; BindsTo = "graphical-session.target"; @@ -48,14 +49,14 @@ }; }; - systemd.user.services.network-manager-applet = { + systemd. user. services. network-manager-applet = { Unit = { Description = "nm-applet"; BindsTo = [ "river-session.target" ]; }; Service = { Type = "simple"; - ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"; + ExecStart = "${ pkgs. networkmanagerapplet}/bin/nm-applet --indicator"; }; Install = { WantedBy = [ "river-session.target" ]; }; }; diff --git a/home/desktop-river/screenshot.nix b/home/desktop-river/screenshot.nix new file mode 100644 index 0000000..5287ee6 --- /dev/null +++ b/home/desktop-river/screenshot.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +let + shell = "${pkgs.dash}/bin/dash"; + grim = "${pkgs.grim}/bin/grim"; + slurp = "${pkgs.slurp}/bin/slurp"; + wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy"; +in +pkgs.writeScriptBin "screenshot" '' + #!${shell} + ${grim} -g "$(${slurp} -d)" - | ${wl-copy} -t image/png +''