Sway: Difference between revisions

Phobos (talk | contribs)
mNo edit summary
Phobos (talk | contribs)
m Added a section for a basic screenshot setup
Line 357: Line 357:
     };
     };
</syntaxhighlight>
</syntaxhighlight>
=== Screenshots ===
Screenshots using grim, slurp, and [https://github.com/XodTech/grimshot grimshot] for selection screenshots/full screen screenshots.
Install tools
{{File|3=environment.systemPackages = with pkgs; [
  grim
  slurp
  sway-contrib.grimshot
];|name=/etc/nixos/configuration.nix|lang=nix}}
Example Home Manager configuration.
{{File|3=wayland.windowManager.sway = {
  enable = true;
  config = let
    modifier = config.wayland.windowManager.sway.config.modifier;
    in {
    modifier = "Mod4";
    keybindings = lib.mkOptionDefault {
      # Super + Shift + S
      # Screenshot a selection that saves to ~/Screenshots and copies to clipboard.
      "${modifier}+Shift+s" = "exec selection=$(slurp) && grim -g \"$selection\" - {{!}} tee ~/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png {{!}} wl-copy";
     
      # Print Screen Button
      # Screenshot the currently focused screen, save to ~/Screenshots and copy to clipboard.
      "Print" = "exec grimshot save output - {{!}} tee ~/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png {{!}} wl-copy";
    };
  };
};|name=/etc/nixos/home.nix|lang=nix}}


=== Screen sharing ===
=== Screen sharing ===