Format project using nixfmt rfc candidate.

This commit is contained in:
Kevin Baensch 2024-11-20 20:32:38 +01:00
parent 1f63817684
commit a9f7fe416f
Signed by: derped
GPG key ID: C0F1D326C7626543
91 changed files with 1347 additions and 1000 deletions

View file

@ -1,4 +1,5 @@
{pkgs, ...}: (pkgs.writeText "config" ''
{ pkgs, ... }:
(pkgs.writeText "config" ''
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

View file

@ -1,26 +1,30 @@
{pkgs}: let
tabMode = pkgs.writeScript "tab-finder.sh" (with pkgs; /* bash */ ''
#!/usr/bin/env bash
if [ -z ''${1} ]; then
${brotab}/bin/bt list;
else
TARGET_TAB=$(sed "s/\t.*$//g" <<< ''${1});
# activate window as focused to it is easy to switch to
${brotab}/bin/bt activate --focused ''${TARGET_TAB} > /dev/null 2>&1;
if [ -n ''${SWAYSOCK} ] && which swaymsg; then
swaymsg "[urgent=latest] focus" > /dev/null 2>&1;
{ pkgs }:
let
tabMode = pkgs.writeScript "tab-finder.sh" (
with pkgs; # bash
''
#!/usr/bin/env bash
if [ -z ''${1} ]; then
${brotab}/bin/bt list;
else
TARGET_TAB=$(sed "s/\t.*$//g" <<< ''${1});
# activate window as focused to it is easy to switch to
${brotab}/bin/bt activate --focused ''${TARGET_TAB} > /dev/null 2>&1;
if [ -n ''${SWAYSOCK} ] && which swaymsg; then
swaymsg "[urgent=latest] focus" > /dev/null 2>&1;
fi
fi
fi
exit 0;
'');
exit 0;
''
);
in
pkgs.writeText "rofi.rasi" ''
configuration {
modi: "combi,window,drun,ssh,tabFinder:${tabMode}";
font: "hack 10";
combi-modi: "window,drun,ssh,tabFinder";
icon-theme: "Papirus";
show-icons: true;
}
@theme "DarkBlue"
''
pkgs.writeText "rofi.rasi" ''
configuration {
modi: "combi,window,drun,ssh,tabFinder:${tabMode}";
font: "hack 10";
combi-modi: "window,drun,ssh,tabFinder";
icon-theme: "Papirus";
show-icons: true;
}
@theme "DarkBlue"
''

View file

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