From 567a2a3ffca6c2517b9ccbe15b945790d62426f7 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" Date: Fri, 20 Feb 2026 17:37:53 +0000 Subject: [PATCH] Add screenshot sync to Mac via niri --- kitty/files/kitty.conf | 2 +- niri/files/config.kdl | 2 +- niri/files/copy-latest-screenshot.sh | 29 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 niri/files/copy-latest-screenshot.sh diff --git a/kitty/files/kitty.conf b/kitty/files/kitty.conf index 6caa6cc..11cb198 100644 --- a/kitty/files/kitty.conf +++ b/kitty/files/kitty.conf @@ -29,7 +29,7 @@ map kitty_mod+, #: kitty has very powerful font management. You can configure #: individual font faces and even specify special fonts for particular #: characters. -font_family family="FantasqueSansM Nerd Font" +font_family family="IosevkaTermSlab Nerd Font" bold_font auto italic_font auto bold_italic_font auto diff --git a/niri/files/config.kdl b/niri/files/config.kdl index 03784f4..947fa0b 100644 --- a/niri/files/config.kdl +++ b/niri/files/config.kdl @@ -489,7 +489,7 @@ binds { // Mod+Space { switch-layout "next"; } // Mod+Shift+Space { switch-layout "prev"; } - Mod+P { screenshot; } + Mod+P { spawn "sh" "-c" "niri msg action screenshot && ~/.config/niri/copy-latest-screenshot.sh"; } Mod+Ctrl+P { screenshot-screen; } Mod+Alt+P { screenshot-window; } diff --git a/niri/files/copy-latest-screenshot.sh b/niri/files/copy-latest-screenshot.sh new file mode 100755 index 0000000..c2b1dd9 --- /dev/null +++ b/niri/files/copy-latest-screenshot.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +screenshot_dir="$HOME/Pictures/Screenshots" +remote_target="mac-attio:~/screenshot.png" + +notify() { + DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus" \ + XDG_RUNTIME_DIR="/run/user/$(id -u)" \ + notify-send "$@" +} + +shopt -s nullglob +files=("$screenshot_dir"/*.png) +latest_file="" +if (( ${#files[@]} )); then + latest_file=$(ls -1t "${files[@]}" | head -n 1) +fi + +if [[ -z "${latest_file:-}" ]]; then + notify "Screenshot upload" "No screenshots found in $screenshot_dir" + exit 1 +fi + +if scp -q "$latest_file" "$remote_target"; then + notify "Screenshot upload" "Uploaded $(basename "$latest_file")" +else + notify "Screenshot upload" "Upload failed" + exit 1 +fi