Compare commits
5 commits
25ef6e6605
...
6da8d4336b
Author | SHA1 | Date | |
---|---|---|---|
6da8d4336b | |||
c6fafa34c9 | |||
7cbbb5d696 | |||
065953fdc7 | |||
38d52ea4b3 |
12 changed files with 108 additions and 89 deletions
3
.bin/.e
3
.bin/.e
|
@ -5,8 +5,8 @@ declare -A mapper=(
|
||||||
[".t"]="$HOME/.bin/.t"
|
[".t"]="$HOME/.bin/.t"
|
||||||
["alacritty"]="$HOME/.config/alacritty/alacritty.toml"
|
["alacritty"]="$HOME/.config/alacritty/alacritty.toml"
|
||||||
["autoinstall.conf"]="$HOME/.config/autoinstall.conf"
|
["autoinstall.conf"]="$HOME/.config/autoinstall.conf"
|
||||||
|
["autorestic"]="$HOME/.config/autorestic/.autorestic.yml"
|
||||||
["autostart.toml"]="$HOME/.config/autostart.toml"
|
["autostart.toml"]="$HOME/.config/autostart.toml"
|
||||||
["backup"]="$HOME/.bin/host-backup-$(cat /proc/sys/kernel/hostname)"
|
|
||||||
["bash"]="$HOME/.bashrc"
|
["bash"]="$HOME/.bashrc"
|
||||||
["bspwm"]="$HOME/.config/bspwm/bspwmrc"
|
["bspwm"]="$HOME/.config/bspwm/bspwmrc"
|
||||||
["completions"]="$HOME/.config/completionsrc"
|
["completions"]="$HOME/.config/completionsrc"
|
||||||
|
@ -57,6 +57,7 @@ declare -A hooks=(
|
||||||
["sway.d"]="sway reload"
|
["sway.d"]="sway reload"
|
||||||
["waybar"]="killall -SIGUSR2 waybar"
|
["waybar"]="killall -SIGUSR2 waybar"
|
||||||
["yadm"]="yadm alt"
|
["yadm"]="yadm alt"
|
||||||
|
["yadm-encrypt"]="yadm alt"
|
||||||
)
|
)
|
||||||
|
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
_hostname="$(cat /proc/sys/kernel/hostname)"
|
|
||||||
_host_backup_file="host-backup-$_hostname"
|
|
||||||
if [ -x "$( which "$_host_backup_file")" ]
|
|
||||||
then
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
. "$_host_backup_file"
|
|
||||||
else
|
|
||||||
echo "No host-backup file found: $_host_backup_file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
host_backup_run
|
|
||||||
sleep 3
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
"_forget")
|
|
||||||
host-backup forget --prune --group-by "host" \
|
|
||||||
--keep-last 14 \
|
|
||||||
--keep-daily 60 \
|
|
||||||
--keep-weekly 24 \
|
|
||||||
--keep-monthly 36 \
|
|
||||||
--keep-yearly 10
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
restic "$@"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
modes="monitor-std
|
|
||||||
monitor-single
|
|
||||||
monitor-single-sec
|
|
||||||
zellij"
|
|
||||||
|
|
||||||
portalo_mode_monitor () {
|
|
||||||
echo "Loading portalo monitor layout ${1:-std}"
|
|
||||||
yadm config --unset-all local.class monitor-*
|
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
|
||||||
yadm config --add local.class "$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
swaymsg reload
|
|
||||||
}
|
|
||||||
|
|
||||||
portalo_mode_zellij () {
|
|
||||||
layout_dir="$HOME/.config/zellij/layouts"
|
|
||||||
layouts=$(\ls -1 "$layout_dir")
|
|
||||||
layout=$(echo "$layouts" | $DMENU -p "layout")
|
|
||||||
if [ -n "$layout" ]; then
|
|
||||||
$TERMINAL -e zellij --layout="$layout_dir/$layout"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
mode=$(echo "$modes" | $DMENU -p "mode")
|
|
||||||
else
|
|
||||||
mode=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $mode in
|
|
||||||
"monitor-std") portalo_mode_monitor ;;
|
|
||||||
"monitor-"*) portalo_mode_monitor "$mode" ;;
|
|
||||||
"zellij") portalo_mode_zellij ;;
|
|
||||||
*) echo "'$mode' is not a valid mode (single, std)" ;;
|
|
||||||
esac
|
|
|
@ -9,7 +9,7 @@ autostart"
|
||||||
action=$(echo "$actions" | $DMENU)
|
action=$(echo "$actions" | $DMENU)
|
||||||
|
|
||||||
_menu_shutdown_backup() {
|
_menu_shutdown_backup() {
|
||||||
alacritty -e "host-backup"
|
alacritty -e sh -c "autorestic backup -av && sleep 3"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$action" ]; then
|
if [ -z "$action" ]; then
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
tool="grim"
|
tool="grim"
|
||||||
|
|
||||||
|
now=$(date '+%F_%H-%M-%S')
|
||||||
|
now_iso=$(date -Is)
|
||||||
|
expire_date=$(date -Is -d "+1hour")
|
||||||
rclone_remote="s3-serguzim-me:public/screenshots"
|
rclone_remote="s3-serguzim-me:public/screenshots"
|
||||||
screenshot_host="https://s3.serguzim.me/public/screenshots"
|
screenshot_host="https://s3.serguzim.me/public/screenshots"
|
||||||
screenshot_path="/tmp/screenshot.webp"
|
screenshot_path="/tmp/screenshot_$now.webp"
|
||||||
file="$(date '+%F_%H-%M-%S').webp"
|
file="$now.webp"
|
||||||
|
|
||||||
clip_image()
|
clip_image()
|
||||||
{
|
{
|
||||||
|
@ -19,18 +22,73 @@ clip_image()
|
||||||
|
|
||||||
upload_image()
|
upload_image()
|
||||||
{
|
{
|
||||||
|
share_url=$(upload_image_immich)
|
||||||
|
echo "$share_url"
|
||||||
|
|
||||||
|
if [ -n "$share_url" ]
|
||||||
|
then
|
||||||
|
notify-send "Screenshot" "Uploaded screenshot"
|
||||||
|
else
|
||||||
|
notify-send "Screenshot" "Failed to upload screenshot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
xdg-open "$share_url"
|
||||||
|
|
||||||
# to have link available in clipboard manager
|
# to have link available in clipboard manager
|
||||||
if [ -n "$WAYLAND_DISPLAY" ]
|
if [ -n "$WAYLAND_DISPLAY" ]
|
||||||
then
|
then
|
||||||
wl-copy "$screenshot_host/$file"
|
wl-copy "$share_url"
|
||||||
wl-copy -p "$screenshot_host/$file"
|
wl-copy -p "$share_url"
|
||||||
else
|
else
|
||||||
printf '%s' "$screenshot_host/$file" | xclip -selection clipboard
|
printf '%s' "$share_url" | xclip -selection clipboard
|
||||||
printf '%s' "$screenshot_host/$file" | xclip -selection primary
|
printf '%s' "$share_url" | xclip -selection primary
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
rclone copyto "$screenshot_path" "$rclone_remote/$file"
|
upload_image_rclone()
|
||||||
notify-send -a "Screenshot" "Uploaded screenshot to s3"
|
{
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rclone copyto "$screenshot_path" "$rclone_remote/$file" >/dev/null
|
||||||
|
echo "$screenshot_host/$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Immich url to get api key for service account (skip oauth)
|
||||||
|
# https://my.immich.app/auth/login?autoLaunch=0
|
||||||
|
upload_image_immich()
|
||||||
|
{
|
||||||
|
set -e
|
||||||
|
|
||||||
|
result_upload=$(curl -sSfL "$IMMICH_INSTANCE_URL/api/assets" \
|
||||||
|
-H 'Content-Type: multipart/form-data' \
|
||||||
|
-H 'Accept: application/json' \
|
||||||
|
-H "x-api-key: $IMMICH_API_KEY_SCREENSHOTS" \
|
||||||
|
-F 'deviceId="screenshots"' \
|
||||||
|
-F "deviceAssetId=\"screenshots-$screenshot_path\"" \
|
||||||
|
-F "fileModifiedAt=\"$now_iso\"" \
|
||||||
|
-F "fileCreatedAt=\"$now_iso\"" \
|
||||||
|
-F "assetData=@\"$screenshot_path\"")
|
||||||
|
asset_id=$(echo "$result_upload" | jq -r '.id')
|
||||||
|
|
||||||
|
result_share=$(curl -sSfL "$IMMICH_INSTANCE_URL/api/shared-links" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-H 'Accept: application/json' \
|
||||||
|
-H "x-api-key: $IMMICH_API_KEY_SCREENSHOTS" \
|
||||||
|
-d "{
|
||||||
|
\"allowDownload\": true,
|
||||||
|
\"allowUpload\": false,
|
||||||
|
\"assetIds\": [
|
||||||
|
\"$asset_id\"
|
||||||
|
],
|
||||||
|
\"expiresAt\": \"$expire_date\",
|
||||||
|
\"showMetadata\": true,
|
||||||
|
\"type\": \"INDIVIDUAL\"
|
||||||
|
}")
|
||||||
|
share_key=$(echo "$result_share" | jq -r '.key')
|
||||||
|
|
||||||
|
#share_url="$IMMICH_INSTANCE_URL/share/$share_key/photos/$asset_id"
|
||||||
|
share_url="$IMMICH_INSTANCE_URL/api/assets/$asset_id/original?key=$share_key"
|
||||||
|
echo "$share_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
call_screenshot_tool() {
|
call_screenshot_tool() {
|
||||||
|
@ -64,7 +122,7 @@ main()
|
||||||
{
|
{
|
||||||
if [ -n "$1" ] && [ -e "$1" ]
|
if [ -n "$1" ] && [ -e "$1" ]
|
||||||
then
|
then
|
||||||
convert "$1" "$screenshot_path"
|
magick "$1" "$screenshot_path"
|
||||||
upload_image
|
upload_image
|
||||||
clip_image
|
clip_image
|
||||||
else
|
else
|
||||||
|
|
|
@ -114,6 +114,12 @@ delay = 5
|
||||||
hosts = []
|
hosts = []
|
||||||
group = 'chat'
|
group = 'chat'
|
||||||
|
|
||||||
|
[apps.teamspeak-ntfy-events]
|
||||||
|
command = 'ts-control ntfy-events'
|
||||||
|
delay = 5
|
||||||
|
hosts = []
|
||||||
|
group = 'chat'
|
||||||
|
|
||||||
[apps.thunderbird]
|
[apps.thunderbird]
|
||||||
command = 'thunderbird'
|
command = 'thunderbird'
|
||||||
hosts = []
|
hosts = []
|
||||||
|
@ -133,3 +139,8 @@ group = 'x11'
|
||||||
command = 'waybar'
|
command = 'waybar'
|
||||||
hosts = []
|
hosts = []
|
||||||
group = 'hyprland'
|
group = 'hyprland'
|
||||||
|
|
||||||
|
[apps.webhook]
|
||||||
|
command = 'webhook -hooks $XDG_CONFIG_HOME/hooks.yaml -verbose -hotreload'
|
||||||
|
hosts = []
|
||||||
|
group = 'common'
|
||||||
|
|
|
@ -4,6 +4,8 @@ export DRONE_SERVER="https://ci.serguzim.me"
|
||||||
|
|
||||||
export HASTE_SERVER="https://haste.snrd.eu"
|
export HASTE_SERVER="https://haste.snrd.eu"
|
||||||
|
|
||||||
|
export IMMICH_INSTANCE_URL="https://gallery.serguzim.me"
|
||||||
|
|
||||||
export LINKWARDEN_URL="https://bookmarks.serguzim.me"
|
export LINKWARDEN_URL="https://bookmarks.serguzim.me"
|
||||||
|
|
||||||
export OPENFAAS_URL="https://faas.serguzim.me"
|
export OPENFAAS_URL="https://faas.serguzim.me"
|
||||||
|
|
|
@ -71,7 +71,7 @@ export VIMINIT="if has('nvim') | source $XDG_CONFIG_HOME/nvim/init.lua | else |
|
||||||
|
|
||||||
export XDG_DATA_DIRS="$XDG_CONFIG_HOME/xdg-data:$XDG_DATA_DIRS"
|
export XDG_DATA_DIRS="$XDG_CONFIG_HOME/xdg-data:$XDG_DATA_DIRS"
|
||||||
|
|
||||||
export YADM_OVERRIDE_ARCHIVE="$HOME/.password-store/yadm.gpg"
|
export YADM_OVERRIDE_ARCHIVE="$PASSWORD_STORE_DIR/yadm.gpg"
|
||||||
|
|
||||||
|
|
||||||
for additional_env in "$XDG_CONFIG_HOME/env.d/"*; do
|
for additional_env in "$XDG_CONFIG_HOME/env.d/"*; do
|
||||||
|
|
|
@ -13,10 +13,13 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
autorestic
|
||||||
|
cargo # rust
|
||||||
#ckb-next # corsair hardware control
|
#ckb-next # corsair hardware control
|
||||||
#rustdesk # remote desktop tool # disabled for nightly from aur
|
#rustdesk # remote desktop tool # disabled for nightly from aur
|
||||||
solaar # Logitech tool
|
solaar # Logitech tool
|
||||||
syncthing # file syncing tool
|
syncthing # file syncing tool
|
||||||
#flatpak
|
#flatpak
|
||||||
|
webhook
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,13 @@ get_collections() {
|
||||||
| jq -r '.response | map_values(.name)[]'
|
| jq -r '.response | map_values(.name)[]'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_collection_id() {
|
||||||
|
curl -H "Authorization: Bearer $LINKWARDEN_TOKEN" \
|
||||||
|
-H "Accept: application/json" \
|
||||||
|
"$LINKWARDEN_URL/api/v1/collections" 2>/dev/null \
|
||||||
|
| jq -r --arg c "$1" '.response[] | select(.name==$c).id'
|
||||||
|
}
|
||||||
|
|
||||||
collection=$(get_collections | $DMENU -p "Collection: ")
|
collection=$(get_collections | $DMENU -p "Collection: ")
|
||||||
url=$QUTE_URL
|
url=$QUTE_URL
|
||||||
name=$(echo "$QUTE_TITLE" | $DMENU -p "Title: ")
|
name=$(echo "$QUTE_TITLE" | $DMENU -p "Title: ")
|
||||||
|
@ -20,14 +27,21 @@ fi
|
||||||
payload=$(jq -n \
|
payload=$(jq -n \
|
||||||
--arg u "$url" \
|
--arg u "$url" \
|
||||||
--arg n "$name" \
|
--arg n "$name" \
|
||||||
--arg c "$collection" \
|
--arg cn "$collection" \
|
||||||
|
--argjson ci "$(get_collection_id $collection)" \
|
||||||
'{
|
'{
|
||||||
url: $u,
|
url: $u,
|
||||||
name: $n,
|
name: $n,
|
||||||
collection: {name: $c},
|
collection: {
|
||||||
|
name: $cn,
|
||||||
|
id: $ci
|
||||||
|
},
|
||||||
tags: []
|
tags: []
|
||||||
}')
|
}')
|
||||||
|
|
||||||
|
echo "$payload" > /tmp/linkwarden-payload.json
|
||||||
|
echo "$(get_collection_id "Werbung")" >> /tmp/linkwarden-payload.json
|
||||||
|
|
||||||
response=$(curl -sS --fail-with-body \
|
response=$(curl -sS --fail-with-body \
|
||||||
-H "Authorization: Bearer $LINKWARDEN_TOKEN" \
|
-H "Authorization: Bearer $LINKWARDEN_TOKEN" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
.bin/host-backup-portalo
|
.bin/host-backup-portalo
|
||||||
|
.config/autorestic/.autorestic.yml##hostname.portalo,default
|
||||||
.config/env.d/99-secrets
|
.config/env.d/99-secrets
|
||||||
.config/projectsrc
|
.config/projectsrc
|
||||||
.config/rclone/rclone.conf
|
.config/rclone/rclone.conf
|
||||||
|
|
4
.config/yadm/hooks/post_encrypt
Executable file
4
.config/yadm/hooks/post_encrypt
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
pass git add yadm.gpg
|
||||||
|
pass git ci -am 'Update yadm archive'
|
Loading…
Reference in a new issue