feat: screenshot script

main
Ricard Illa 2023-08-02 13:07:07 +02:00
parent 0a938c80d4
commit be4d78b4f6
Signed by: rilla
GPG Key ID: 525307BD467E4205
2 changed files with 21 additions and 8 deletions

View File

@ -27,19 +27,20 @@
wl-clipboard wl-clipboard
wtype wtype
xdg-utils xdg-utils
(pks.callPackage ./screenshot.nix { inherit config pkgs; })
]; ];
programs.zsh.loginExtra = '' programs. zsh. loginExtra = ''
if [[ -z "''${DISPLAY}" ]] && [[ "''${XDG_VTNR}" -eq 1 ]]; then if [[ -z "''${DISPLAY}" ]] && [[ "''${XDG_VTNR}" -eq 1 ]]; then
exec ${pkgs.river}/bin/river exec ${ pkgs. river}/bin/river
fi fi
''; '';
home.sessionVariables.XKB_DEFAULT_LAYOUT = "us"; home. sessionVariables. XKB_DEFAULT_LAYOUT = "us";
home.sessionVariables.XKB_DEFAULT_VARIANT = "altgr-intl"; home. sessionVariables. XKB_DEFAULT_VARIANT = "altgr-intl";
home.sessionVariables.XKB_DEFAULT_OPTIONS = "caps:escape"; home. sessionVariables. XKB_DEFAULT_OPTIONS = "caps:escape";
systemd.user.targets.river-session = { systemd. user. targets. river-session = {
Unit = { Unit = {
Description = "river window manager session"; Description = "river window manager session";
BindsTo = "graphical-session.target"; BindsTo = "graphical-session.target";
@ -48,14 +49,14 @@
}; };
}; };
systemd.user.services.network-manager-applet = { systemd. user. services. network-manager-applet = {
Unit = { Unit = {
Description = "nm-applet"; Description = "nm-applet";
BindsTo = [ "river-session.target" ]; BindsTo = [ "river-session.target" ];
}; };
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.networkmanagerapplet}/bin/nm-applet --indicator"; ExecStart = "${ pkgs. networkmanagerapplet}/bin/nm-applet --indicator";
}; };
Install = { WantedBy = [ "river-session.target" ]; }; Install = { WantedBy = [ "river-session.target" ]; };
}; };

View File

@ -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
''