Format project using nixfmt rfc candidate.
This commit is contained in:
parent
1f63817684
commit
a9f7fe416f
91 changed files with 1347 additions and 1000 deletions
|
@ -1,36 +1,38 @@
|
|||
{pkgs}:
|
||||
{ pkgs }:
|
||||
|
||||
let
|
||||
# TODO/FIX: pkgs.sway-unwrapped is not the same sway derivation as the one running the desktop
|
||||
grim-wrapper = pkgs.writeShellScript "grim-wrapper" /* bash */ ''
|
||||
OUTPUT_DIR="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)"
|
||||
DATE="$(${pkgs.coreutils}/bin/date +'%Y-%m-%d;%H:%M:%S;')";
|
||||
WINDOW_LIST="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.pid? and .visible?) | "\(.rect.x+.window_rect.x),\(.rect.y+.window_rect.y) \(.window_rect.width)x\(.window_rect.height) \(.app_id):\(.name)"' | ${pkgs.coreutils}/bin/tr -d '"/;\\')";
|
||||
grim-wrapper =
|
||||
pkgs.writeShellScript "grim-wrapper" # bash
|
||||
''
|
||||
OUTPUT_DIR="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir PICTURES)"
|
||||
DATE="$(${pkgs.coreutils}/bin/date +'%Y-%m-%d;%H:%M:%S;')";
|
||||
WINDOW_LIST="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.pid? and .visible?) | "\(.rect.x+.window_rect.x),\(.rect.y+.window_rect.y) \(.window_rect.width)x\(.window_rect.height) \(.app_id):\(.name)"' | ${pkgs.coreutils}/bin/tr -d '"/;\\')";
|
||||
|
||||
case "''${1}" in
|
||||
selection)
|
||||
# split slurp selection result into jseon selectable screen area (for grim) and output name
|
||||
SELECTION_FORMAT='{ "area": "%x,%y %wx%h", "name": "%wx%h;%o;%l" }';
|
||||
SELECTION="$(${pkgs.slurp}/bin/slurp -d -f "''${SELECTION_FORMAT}" <<< ''${WINDOW_LIST})";
|
||||
SELECTION_AREA="$(${pkgs.jq}/bin/jq -r '.area' <<< "''${SELECTION}")";
|
||||
SELECTION_NAME="$(${pkgs.jq}/bin/jq -r '.name' <<< "''${SELECTION}"| ${pkgs.coreutils}/bin/tr ' ' '_')";
|
||||
OUTNAME="''${OUTPUT_DIR}/''${DATE}''${SELECTION_NAME}.png";
|
||||
${pkgs.grim}/bin/grim -g "''${SELECTION_AREA}" "''${OUTNAME}";
|
||||
;;
|
||||
clip)
|
||||
SELECTION="$(${pkgs.slurp}/bin/slurp -d <<< ''${WINDOW_LIST})";
|
||||
${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy;
|
||||
;;
|
||||
*)
|
||||
DISPLAY="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name')";
|
||||
DISPLAY_RES="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .current_mode | "\(.width)x\(.height)"')";
|
||||
OUTNAME="''${OUTPUT_DIR}/''${DATE}''${DISPLAY_RES};''${DISPLAY};.png"
|
||||
${pkgs.grim}/bin/grim -o "''${DISPLAY}" "''${OUTNAME}";
|
||||
;;
|
||||
esac;
|
||||
'';
|
||||
in pkgs.writeText "config"
|
||||
''
|
||||
case "''${1}" in
|
||||
selection)
|
||||
# split slurp selection result into jseon selectable screen area (for grim) and output name
|
||||
SELECTION_FORMAT='{ "area": "%x,%y %wx%h", "name": "%wx%h;%o;%l" }';
|
||||
SELECTION="$(${pkgs.slurp}/bin/slurp -d -f "''${SELECTION_FORMAT}" <<< ''${WINDOW_LIST})";
|
||||
SELECTION_AREA="$(${pkgs.jq}/bin/jq -r '.area' <<< "''${SELECTION}")";
|
||||
SELECTION_NAME="$(${pkgs.jq}/bin/jq -r '.name' <<< "''${SELECTION}"| ${pkgs.coreutils}/bin/tr ' ' '_')";
|
||||
OUTNAME="''${OUTPUT_DIR}/''${DATE}''${SELECTION_NAME}.png";
|
||||
${pkgs.grim}/bin/grim -g "''${SELECTION_AREA}" "''${OUTNAME}";
|
||||
;;
|
||||
clip)
|
||||
SELECTION="$(${pkgs.slurp}/bin/slurp -d <<< ''${WINDOW_LIST})";
|
||||
${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy;
|
||||
;;
|
||||
*)
|
||||
DISPLAY="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name')";
|
||||
DISPLAY_RES="$(${pkgs.sway-unwrapped}/bin/swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .current_mode | "\(.width)x\(.height)"')";
|
||||
OUTNAME="''${OUTPUT_DIR}/''${DATE}''${DISPLAY_RES};''${DISPLAY};.png"
|
||||
${pkgs.grim}/bin/grim -o "''${DISPLAY}" "''${OUTNAME}";
|
||||
;;
|
||||
esac;
|
||||
'';
|
||||
in
|
||||
pkgs.writeText "config" ''
|
||||
include /etc/sway/config.d/*
|
||||
|
||||
# Read `man 5 sway` for a complete reference.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue