mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 06:08:11 +09:00
screen shot
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
screenshot = import ./screenshot.nix { inherit pkgs; };
|
||||||
|
|
||||||
systemctl = lib.getExe' pkgs.systemd "systemctl";
|
systemctl = lib.getExe' pkgs.systemd "systemctl";
|
||||||
|
|
||||||
keybind = key: actionAttrs: {
|
keybind = key: actionAttrs: {
|
||||||
@@ -38,6 +40,8 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
home.packages = [ screenshot ];
|
||||||
|
|
||||||
wayland.windowManager.labwc = {
|
wayland.windowManager.labwc = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# NixOS owns the package so Home Manager only generates the user config.
|
# NixOS owns the package so Home Manager only generates the user config.
|
||||||
@@ -75,6 +79,9 @@ in
|
|||||||
(snapToEdge "W-C-Up" "up")
|
(snapToEdge "W-C-Up" "up")
|
||||||
(snapToEdge "W-C-Down" "down")
|
(snapToEdge "W-C-Down" "down")
|
||||||
(confirmAction "W-S-e" "Exit labwc?" "Exit")
|
(confirmAction "W-S-e" "Exit labwc?" "Exit")
|
||||||
|
(execute "Print" "labwc-screenshot region")
|
||||||
|
(execute "C-Print" "labwc-screenshot output")
|
||||||
|
(execute "A-Print" "labwc-screenshot all")
|
||||||
|
|
||||||
# spawn applications (sync with niri modules/applications/niri/home.nix)
|
# spawn applications (sync with niri modules/applications/niri/home.nix)
|
||||||
(execute "W-t" "ghostty")
|
(execute "W-t" "ghostty")
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "labwc-screenshot";
|
||||||
|
|
||||||
|
runtimeInputs = with pkgs; [
|
||||||
|
coreutils
|
||||||
|
grim
|
||||||
|
slurp
|
||||||
|
wl-clipboard
|
||||||
|
xdg-user-dirs
|
||||||
|
];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
mode="''${1:-region}"
|
||||||
|
|
||||||
|
pictures_dir="$(xdg-user-dir PICTURES)"
|
||||||
|
if [[ -z "$pictures_dir" ]]; then
|
||||||
|
pictures_dir="$HOME/Pictures"
|
||||||
|
fi
|
||||||
|
|
||||||
|
output_dir="$pictures_dir/Screenshots"
|
||||||
|
output_file="$output_dir/Screenshot from $(date '+%Y-%m-%d %H-%M-%S').png"
|
||||||
|
|
||||||
|
mkdir -p "$output_dir"
|
||||||
|
|
||||||
|
case "$mode" in
|
||||||
|
region)
|
||||||
|
geometry="$(slurp)" || exit 0
|
||||||
|
grim -g "$geometry" "$output_file"
|
||||||
|
;;
|
||||||
|
|
||||||
|
output)
|
||||||
|
geometry="$(slurp -o)" || exit 0
|
||||||
|
grim -g "$geometry" "$output_file"
|
||||||
|
;;
|
||||||
|
|
||||||
|
all)
|
||||||
|
grim "$output_file"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown screenshot mode: $mode" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
wl-copy --type image/png < "$output_file"
|
||||||
|
'';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user