feat(home/feats/wayland): make, swaylock, swayidle, screenshot keys
9 files changed, -5/+152
home/features/misc/vesktop.nix
@@ -16,7 +16,8 @@ let bus="$(mktemp -u "$run/vesktop-bus.XXXXXX")" xdg-dbus-proxy "$DBUS_SESSION_BUS_ADDRESS" "$bus" --filter \- --talk=org.freedesktop.portal.Desktop &+ --talk=org.freedesktop.portal.Desktop \+ --talk=org.freedesktop.Notifications & proxy=$! trap 'kill "$proxy" 2>/dev/null; rm -f "$bus"' EXIT while [ ! -S "$bus" ]; do sleep 0.05; done
home/features/wayland/dwl.nix
@@ -1,5 +1,22 @@-{ pkgs, ... }:+{ config, pkgs, ... }: -{- home.packages = with pkgs; [ wmenu wl-clipboard xdg-utils ];+let+ screenshot = pkgs.writeShellApplication {+ name = "screenshot";+ runtimeInputs = with pkgs; [ grim slurp wl-clipboard coreutils ];+ text = ''+ case "''${1:-area}" in+ area) grim -g "$(slurp)" - | wl-copy -t image/png ;;+ output) grim -g "$(slurp -o)" - | wl-copy -t image/png ;;+ save)+ dir="${config.xdg.userDirs.pictures}/screenshots"+ mkdir -p "$dir"+ grim -g "$(slurp)" "$dir/$(date +%Y-%m-%d_%H-%M-%S).png"+ ;;+ *) echo "usage: screenshot [area|output|save]" >&2; exit 1 ;;+ esac+ '';+ };+in {+ home.packages = with pkgs; [ wmenu wl-clipboard xdg-utils screenshot ]; }
home/features/wayland/mako.nix
@@ -0,0 +1,34 @@+{ outputs, ... }:++let+ c = outputs.palette.colors;+in {+ services.mako = {+ enable = true;++ settings = {+ font = "Fantasque Sans Mono 11";+ anchor = "top-right";+ margin = "10";+ padding = "8,10";+ width = 360;+ border-size = 1;+ border-radius = 0;+ default-timeout = 5000;++ background-color = c.bg;+ text-color = c.fg;+ border-color = c.surface;+ progress-color = "over ${c.surface}";++ "urgency=low" = {+ text-color = c.dim;+ };++ "urgency=critical" = {+ border-color = c.red;+ default-timeout = 0;+ };+ };+ };+}
home/features/wayland/swayidle.nix
@@ -0,0 +1,24 @@+{ config, lib, pkgs, ... }:++let+ lock = "${lib.getExe config.programs.swaylock.package} -f";+ wlopm = lib.getExe pkgs.wlopm;+in {+ services.swayidle = {+ enable = true;++ timeouts = [+ { timeout = 600; command = lock; }+ {+ timeout = 900;+ command = "${wlopm} --off '*'";+ resumeCommand = "${wlopm} --on '*'";+ }+ ];++ events = {+ before-sleep = lock;+ lock = lock;+ };+ };+}
home/features/wayland/swaylock.nix
@@ -0,0 +1,46 @@+{ lib, outputs, ... }:++let+ c = lib.mapAttrs (_: lib.removePrefix "#") outputs.palette.colors;+in {+ programs.swaylock = {+ enable = true;++ settings = {+ daemonize = true;+ ignore-empty-password = true;+ show-failed-attempts = true;++ font = "Fantasque Sans Mono";+ font-size = 18;+ indicator-radius = 80;+ indicator-thickness = 6;++ color = c.bg;++ inside-color = c.bg;+ inside-clear-color = c.bg;+ inside-ver-color = c.bg;+ inside-wrong-color = c.bg;++ ring-color = c.surface;+ ring-clear-color = c.dim;+ ring-ver-color = c.yellow;+ ring-wrong-color = c.red;++ key-hl-color = c.green;+ bs-hl-color = c.red;++ line-color = "00000000";+ line-clear-color = "00000000";+ line-ver-color = "00000000";+ line-wrong-color = "00000000";+ separator-color = "00000000";++ text-color = c.fg;+ text-clear-color = c.dim;+ text-ver-color = c.yellow;+ text-wrong-color = c.red;+ };+ };+}
home/profiles/peony.nix
@@ -14,6 +14,9 @@ ../features/wayland/dwl.nix ../features/wayland/foot.nix ../features/wayland/wbg.nix+ ../features/wayland/mako.nix+ ../features/wayland/swaylock.nix+ ../features/wayland/swayidle.nix ../features/secrets.nix ];
nixos/features/global.nix
@@ -18,7 +18,7 @@ in { defaultLocale = "en_US.UTF-8"; supportedLocales = [ "en_US.UTF-8/UTF-8" ]; };- time.timeZone = "UTC";+ time.timeZone = lib.mkDefault "UTC"; nix = { package = pkgs.nixVersions.latest;@@ -37,6 +37,14 @@ in { trusted-users = [ "root" "@wheel" ]; experimental-features = [ "nix-command" "flakes" ]; };++ registry.nixpkgs.to = {+ type = "github";+ owner = "NixOS";+ repo = "nixpkgs";+ inherit (inputs.nixpkgs) rev narHash;+ };+ nixPath = [ "nixpkgs=flake:nixpkgs" ]; }; nixpkgs = {
nixos/roles/desktop.nix
@@ -29,6 +29,8 @@ in { extraSessionCommands = "exec < <(${lib.getExe garden-status})"; }; + security.pam.services.swaylock = { };+ environment.loginShellInit = '' if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = /dev/tty1 ]; then /etc/xdg/dwl-session
overlays/dwl/config.h
@@ -92,6 +92,12 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA #define CHVT(n) { MODCTRL|MODALT, XKB_KEY_F##n, chvt, {.ui = (n)} } static const char *termcmd[] = { "foot", NULL };+static const char *lockcmd[] = { "swaylock", NULL };+static const char *dismisscmd[] = { "makoctl", "dismiss", NULL };+static const char *dismissallcmd[] = { "makoctl", "dismiss", "--all", NULL };+static const char *shotareacmd[] = { "screenshot", "area", NULL };+static const char *shotoutputcmd[] = { "screenshot", "output", NULL };+static const char *shotsavecmd[] = { "screenshot", "save", NULL }; static const char *menucmd[] = { "wmenu-run", "-f", "Fantasque Sans Mono 11", "-N", "@bgRgb@", "-n", "@fgRgb@", "-M", "@bgRgb@", "-m", "@greenRgb@", "-S", "@surfaceRgb@", "-s", "@fgRgb@", NULL };@@ -115,6 +121,12 @@ static const Key keys[] = { { MODKEY, XKB_KEY_f, togglefullscreen, {0} }, { MODKEY, XKB_KEY_g, togglegaps, {0} }, { MODKEY, XKB_KEY_b, togglebar, {0} },+ { MODKEY, XKB_KEY_Escape, spawn, {.v = lockcmd} },+ { MODKEY, XKB_KEY_n, spawn, {.v = dismisscmd} },+ { MODKEY|MODSHIFT, XKB_KEY_n, spawn, {.v = dismissallcmd} },+ { 0, XKB_KEY_Print, spawn, {.v = shotareacmd} },+ { MODSHIFT, XKB_KEY_Print, spawn, {.v = shotoutputcmd} },+ { MODKEY, XKB_KEY_Print, spawn, {.v = shotsavecmd} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} }, { MODKEY|MODSHIFT, XKB_KEY_comma, tagmon, {.i = WLR_DIRECTION_LEFT} },