Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 008dac69f5 | |||
| d0b1d3be4a |
@@ -27,6 +27,14 @@ end
|
|||||||
|
|
||||||
status is-interactive; and begin
|
status is-interactive; and begin
|
||||||
|
|
||||||
|
# On macOS SSH sessions, normalize TERM if remote terminfo is missing
|
||||||
|
# (eg. TERM=alacritty from Linux host), otherwise tools like jj/less warn
|
||||||
|
if test (uname) = Darwin; and set -q SSH_TTY
|
||||||
|
if not infocmp "$TERM" >/dev/null 2>&1
|
||||||
|
set -gx TERM xterm-256color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Abbreviations
|
# Abbreviations
|
||||||
abbr -a tx 'tmux'
|
abbr -a tx 'tmux'
|
||||||
abbr -a txa 'tmux attach'
|
abbr -a txa 'tmux attach'
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
[templates.ghostty]
|
[templates.ghostty]
|
||||||
input_path = '~/.config/matugen/templates/ghostty-theme'
|
input_path = '~/.config/matugen/templates/ghostty-theme'
|
||||||
output_path = '~/.config/ghostty/themes/matugen'
|
output_path = '~/.config/ghostty/themes/matugen'
|
||||||
post_hook = 'pkill -SIGUSR2 ghostty'
|
post_hook = "pkill -SIGUSR2 ghostty || true && nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/ghostty/themes/matugen ~/.config/ghostty/themes/matugen --remote-cmd 'pkill -SIGUSR2 ghostty || true' >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.kitty]
|
[templates.kitty]
|
||||||
input_path = '~/.config/matugen/templates/kitty-colors.conf'
|
input_path = '~/.config/matugen/templates/kitty-colors.conf'
|
||||||
output_path = '~/.config/kitty/colors.conf'
|
output_path = '~/.config/kitty/colors.conf'
|
||||||
|
post_hook = "nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/kitty/colors.conf ~/.config/kitty/colors.conf >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.foot]
|
[templates.foot]
|
||||||
input_path = '~/.config/matugen/templates/foot-theme'
|
input_path = '~/.config/matugen/templates/foot-theme'
|
||||||
@@ -24,10 +25,12 @@ output_path = '~/.config/gtk-4.0/colors.css'
|
|||||||
[templates.fish-prompt]
|
[templates.fish-prompt]
|
||||||
input_path = '~/.config/matugen/templates/fish-prompt-colors.fish'
|
input_path = '~/.config/matugen/templates/fish-prompt-colors.fish'
|
||||||
output_path = '~/.config/fish/conf.d/prompt-colors.fish'
|
output_path = '~/.config/fish/conf.d/prompt-colors.fish'
|
||||||
|
post_hook = "nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/fish/conf.d/prompt-colors.fish ~/.config/fish/conf.d/prompt-colors.fish >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.yazi]
|
[templates.yazi]
|
||||||
input_path = '~/.config/matugen/templates/yazi-theme.toml'
|
input_path = '~/.config/matugen/templates/yazi-theme.toml'
|
||||||
output_path = '~/.config/yazi/theme.toml'
|
output_path = '~/.config/yazi/theme.toml'
|
||||||
|
post_hook = "nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/yazi/theme.toml ~/.config/yazi/theme.toml >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.qt5ct]
|
[templates.qt5ct]
|
||||||
input_path = '~/.config/matugen/templates/qtct-colors.conf'
|
input_path = '~/.config/matugen/templates/qtct-colors.conf'
|
||||||
@@ -44,28 +47,29 @@ output_path = '~/.config/niri/colors.kdl'
|
|||||||
[templates.tmux]
|
[templates.tmux]
|
||||||
input_path = '~/.config/matugen/templates/tmux-colors.conf'
|
input_path = '~/.config/matugen/templates/tmux-colors.conf'
|
||||||
output_path = '~/.config/tmux/colors.conf'
|
output_path = '~/.config/tmux/colors.conf'
|
||||||
post_hook = 'tmux source-file ~/.config/tmux/tmux.conf 2>/dev/null || true && nohup ~/.config/matugen/scripts/sync-tmux-mac.sh >/dev/null 2>&1 &'
|
post_hook = "tmux source-file ~/.config/tmux/tmux.conf 2>/dev/null || true && nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/tmux/colors.conf ~/.config/tmux/colors.conf --remote-cmd 'export PATH=\"/opt/homebrew/bin:/usr/local/bin:$PATH\" && tmux source-file ~/.config/tmux/tmux.conf 2>/dev/null || true' >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.zellij]
|
[templates.zellij]
|
||||||
input_path = '~/.config/matugen/templates/zellij-colors.kdl'
|
input_path = '~/.config/matugen/templates/zellij-colors.kdl'
|
||||||
output_path = '~/.config/zellij/themes/matugen.kdl'
|
output_path = '~/.config/zellij/themes/matugen.kdl'
|
||||||
post_hook = 'touch ~/.config/zellij/config.kdl && nohup ~/.config/matugen/scripts/sync-zellij-mac.sh >/dev/null 2>&1 &'
|
post_hook = "touch ~/.config/zellij/config.kdl && nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/zellij/themes/matugen.kdl ~/.config/zellij/themes/matugen.kdl --remote-cmd 'touch ~/.config/zellij/config.kdl' >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.jjui]
|
[templates.jjui]
|
||||||
input_path = '~/.config/matugen/templates/jjui-theme.toml'
|
input_path = '~/.config/matugen/templates/jjui-theme.toml'
|
||||||
output_path = '~/.config/jjui/themes/matugen.toml'
|
output_path = '~/.config/jjui/themes/matugen.toml'
|
||||||
|
post_hook = "nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/jjui/themes/matugen.toml ~/.config/jjui/themes/matugen.toml >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.nvim]
|
[templates.nvim]
|
||||||
input_path = '~/.config/matugen/templates/neovim.lua'
|
input_path = '~/.config/matugen/templates/neovim.lua'
|
||||||
output_path = '~/.config/nvim/lua/plugins/dankcolors.lua'
|
output_path = '~/.config/nvim/lua/plugins/dankcolors.lua'
|
||||||
post_hook = 'nohup ~/.config/matugen/scripts/sync-nvim-mac.sh >/dev/null 2>&1 &'
|
post_hook = "nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.config/nvim/lua/plugins/dankcolors.lua ~/.config/nvim/lua/plugins/dankcolors.lua >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.pi]
|
[templates.pi]
|
||||||
input_path = '~/.config/matugen/templates/pi-theme.json'
|
input_path = '~/.config/matugen/templates/pi-theme.json'
|
||||||
output_path = '~/.pi/agent/themes/matugen.json.tmp'
|
output_path = '~/.pi/agent/themes/matugen.json.tmp'
|
||||||
post_hook = 'cat ~/.pi/agent/themes/matugen.json.tmp > ~/.pi/agent/themes/matugen.json && nohup ~/.config/matugen/scripts/sync-pi-mac.sh >/dev/null 2>&1 &'
|
post_hook = "cat ~/.pi/agent/themes/matugen.json.tmp > ~/.pi/agent/themes/matugen.json && nohup ~/.config/matugen/scripts/sync-mac.sh file ~/.pi/agent/themes/matugen.json ~/.pi/agent/themes/matugen.json >/dev/null 2>&1 &"
|
||||||
|
|
||||||
[templates.wallpaper]
|
[templates.wallpaper]
|
||||||
input_path = '~/.config/matugen/templates/wallpaper-path.txt'
|
input_path = '~/.config/matugen/templates/wallpaper-path.txt'
|
||||||
output_path = '~/.cache/matugen-last-image'
|
output_path = '~/.cache/matugen-last-image'
|
||||||
post_hook = 'nohup ~/.config/matugen/scripts/sync-wallpaper-mac.sh >/dev/null 2>&1 &'
|
post_hook = "nohup ~/.config/matugen/scripts/sync-mac.sh wallpaper ~/.cache/matugen-last-image >/dev/null 2>&1 &"
|
||||||
|
|||||||
Executable
+98
@@ -0,0 +1,98 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
host="${MATUGEN_SYNC_HOST:-mac-attio}"
|
||||||
|
log_file="$HOME/.cache/matugen-sync-mac.log"
|
||||||
|
|
||||||
|
mkdir -p "$HOME/.cache"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "usage:" >&2
|
||||||
|
echo " sync-mac.sh file <source_path> <remote_path> [--remote-cmd <command>]" >&2
|
||||||
|
echo " sync-mac.sh wallpaper <wallpaper_path_file>" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_file() {
|
||||||
|
source_path="$1"
|
||||||
|
remote_path="$2"
|
||||||
|
remote_cmd="${3-}"
|
||||||
|
|
||||||
|
# If caller passes a local absolute path, mirror it under remote $HOME.
|
||||||
|
case "$remote_path" in
|
||||||
|
"$HOME")
|
||||||
|
remote_path="~"
|
||||||
|
;;
|
||||||
|
"$HOME"/*)
|
||||||
|
remote_path="~/${remote_path#"$HOME"/}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
remote_dir="$(dirname "$remote_path")"
|
||||||
|
remote_tmp="${remote_path}.tmp"
|
||||||
|
|
||||||
|
ssh "$host" "mkdir -p $remote_dir"
|
||||||
|
scp "$source_path" "$host:$remote_tmp"
|
||||||
|
ssh "$host" "mv $remote_tmp $remote_path"
|
||||||
|
|
||||||
|
if [ -n "$remote_cmd" ]; then
|
||||||
|
ssh "$host" "$remote_cmd"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_wallpaper() {
|
||||||
|
wallpaper_path_file="$1"
|
||||||
|
|
||||||
|
[ -f "$wallpaper_path_file" ] || exit 0
|
||||||
|
|
||||||
|
wallpaper_path="$(cat "$wallpaper_path_file")"
|
||||||
|
[ -n "$wallpaper_path" ] || exit 0
|
||||||
|
[ -f "$wallpaper_path" ] || exit 0
|
||||||
|
|
||||||
|
base_name="$(basename "$wallpaper_path")"
|
||||||
|
local_cache_dir="$HOME/.cache/matugen-wallpapers"
|
||||||
|
local_copy="$local_cache_dir/$base_name"
|
||||||
|
|
||||||
|
mkdir -p "$local_cache_dir"
|
||||||
|
cp -f "$wallpaper_path" "$local_copy"
|
||||||
|
|
||||||
|
ssh "$host" "mkdir -p ~/.cache/matugen-wallpapers"
|
||||||
|
scp "$local_copy" "$host:~/.cache/matugen-wallpapers/$base_name"
|
||||||
|
ssh "$host" "osascript -e 'tell application \"System Events\" to tell every desktop to set picture to POSIX file \"~/.cache/matugen-wallpapers/$base_name\"'"
|
||||||
|
}
|
||||||
|
|
||||||
|
mode="${1-}"
|
||||||
|
[ -n "$mode" ] || usage
|
||||||
|
shift
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] mode=$mode"
|
||||||
|
|
||||||
|
case "$mode" in
|
||||||
|
file)
|
||||||
|
[ "$#" -ge 2 ] || usage
|
||||||
|
source_path="$1"
|
||||||
|
remote_path="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
remote_cmd=""
|
||||||
|
if [ "${1-}" = "--remote-cmd" ]; then
|
||||||
|
[ "$#" -eq 2 ] || usage
|
||||||
|
remote_cmd="$2"
|
||||||
|
elif [ "$#" -ne 0 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
sync_file "$source_path" "$remote_path" "$remote_cmd"
|
||||||
|
;;
|
||||||
|
|
||||||
|
wallpaper)
|
||||||
|
[ "$#" -eq 1 ] || usage
|
||||||
|
sync_wallpaper "$1"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
} >>"$log_file" 2>&1
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
log_file="$HOME/.cache/matugen-sync-nvim.log"
|
|
||||||
|
|
||||||
mkdir -p "$HOME/.cache"
|
|
||||||
|
|
||||||
{
|
|
||||||
ssh mac-attio "mkdir -p ~/.config/nvim/lua/plugins"
|
|
||||||
scp "$HOME/.config/nvim/lua/plugins/dankcolors.lua" \
|
|
||||||
mac-attio:~/.config/nvim/lua/plugins/
|
|
||||||
} >>"$log_file" 2>&1
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
log_file="$HOME/.cache/matugen-sync-pi.log"
|
|
||||||
|
|
||||||
mkdir -p "$HOME/.cache"
|
|
||||||
|
|
||||||
{
|
|
||||||
ssh mac-attio "mkdir -p ~/.pi/agent/themes"
|
|
||||||
scp "$HOME/.pi/agent/themes/matugen.json" \
|
|
||||||
mac-attio:~/.pi/agent/themes/matugen.json.tmp
|
|
||||||
ssh mac-attio "mv ~/.pi/agent/themes/matugen.json.tmp ~/.pi/agent/themes/matugen.json"
|
|
||||||
} >>"$log_file" 2>&1
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
log_file="$HOME/.cache/matugen-sync-tmux.log"
|
|
||||||
|
|
||||||
mkdir -p "$HOME/.cache"
|
|
||||||
|
|
||||||
{
|
|
||||||
ssh mac-attio "mkdir -p ~/.config/tmux"
|
|
||||||
scp "$HOME/.config/tmux/colors.conf" \
|
|
||||||
mac-attio:~/.config/tmux/
|
|
||||||
ssh mac-attio 'export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" && tmux source-file ~/.config/tmux/tmux.conf 2>/dev/null || true'
|
|
||||||
} >>"$log_file" 2>&1
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
log_file="$HOME/.cache/matugen-sync-wallpaper.log"
|
|
||||||
|
|
||||||
mkdir -p "$HOME/.cache"
|
|
||||||
|
|
||||||
{
|
|
||||||
wallpaper_path="$(cat "$HOME/.cache/matugen-last-image")"
|
|
||||||
if [ -n "$wallpaper_path" ]; then
|
|
||||||
base_name="$(basename "$wallpaper_path")"
|
|
||||||
dest_path="$HOME/.cache/matugen-wallpapers/$base_name"
|
|
||||||
|
|
||||||
mkdir -p "$HOME/.cache/matugen-wallpapers"
|
|
||||||
cp -f "$wallpaper_path" "$dest_path"
|
|
||||||
|
|
||||||
ssh mac-attio "mkdir -p ~/.cache/matugen-wallpapers"
|
|
||||||
scp "$dest_path" "mac-attio:~/.cache/matugen-wallpapers/$base_name"
|
|
||||||
ssh mac-attio "osascript -e 'tell application \"System Events\" to tell every desktop to set picture to POSIX file \"~/.cache/matugen-wallpapers/$base_name\"'"
|
|
||||||
fi
|
|
||||||
} >>"$log_file" 2>&1
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
log_file="$HOME/.cache/matugen-sync-zellij.log"
|
|
||||||
|
|
||||||
mkdir -p "$HOME/.cache"
|
|
||||||
|
|
||||||
{
|
|
||||||
ssh mac-attio "mkdir -p ~/.config/zellij/themes"
|
|
||||||
scp "$HOME/.config/zellij/themes/matugen.kdl" \
|
|
||||||
mac-attio:~/.config/zellij/themes/
|
|
||||||
ssh mac-attio "touch ~/.config/zellij/config.kdl"
|
|
||||||
} >>"$log_file" 2>&1
|
|
||||||
@@ -52,6 +52,7 @@ Host mac mac-attio
|
|||||||
LocalForward 8082 localhost:8082
|
LocalForward 8082 localhost:8082
|
||||||
LocalForward 54043 localhost:54043
|
LocalForward 54043 localhost:54043
|
||||||
IdentitiesOnly yes
|
IdentitiesOnly yes
|
||||||
|
SetEnv TERM=xterm-256color
|
||||||
|
|
||||||
Host linux-pc 192.168.1.80
|
Host linux-pc 192.168.1.80
|
||||||
HostName 192.168.1.80
|
HostName 192.168.1.80
|
||||||
|
|||||||
Reference in New Issue
Block a user