diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 147120c..743b238 100755 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -78,6 +78,7 @@ (pkgs.callPackage ../../modules/scripts/manix.nix {}) (pkgs.callPackage ../../modules/scripts/man.nix {}) (pkgs.callPackage ../../modules/scripts/trimmer.nix {}) + (pkgs.callPackage ../../modules/scripts/obsidianbackup.nix {}) # periodically syncs obsidian's note to kdrive (pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {}) (pkgs.callPackage ../../modules/scripts/QSnotifycache.nix {}) (pkgs.callPackage ../../modules/scripts/QSnotifyhistory.nix {}) diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index 2b8da63..c4485c2 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -203,6 +203,7 @@ in { "custom-mountkdrive" #"waybar" "custom-gitnotify" + "custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/) "QS-notifycache" # builds the cache that will be used for the notification history ######################### @@ -353,8 +354,8 @@ in { "2, layout:scrolling, layoutopt:direction:right" "name:special, layout:scrolling" # used for smart gaps along some windowrules - "w[tv1], gapsout:0, gapsin:0" - "f[1], gapsout:0, gapsin:0" + "w[tv1], gapsout:1, gapsin:1" + "f[1], gapsout:1, gapsin:1" ]; # █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀ @@ -415,10 +416,10 @@ in { "float on, size 400 175, match:class ^(custom-librewolfprofiles)$" "float on, size 600 600, match:initial_class ^(custom-pomodoro)$" "float on, size 1500 800, match:initial_class ^(custom-bottom)$" - "border_size 0, match:float 0, match:workspace w[tv1]" - "rounding 0, match:float 0, match:workspace w[tv1]" - "border_size 0, match:float 0, match:workspace f[1]" - "rounding 0, match:float 0, match:workspace f[1]" + "border_size 2, match:float 0, match:workspace w[tv1]" + "rounding 1, match:float 0, match:workspace w[tv1]" + "border_size 2, match:float 0, match:workspace f[1]" + "rounding 1, match:float 0, match:workspace f[1]" ]; # add a float for tomato when in kitty #"plugin:imgborders:noimgborders, tag:noborder" diff --git a/modules/home-manager/obsidian.nix b/modules/home-manager/obsidian.nix index c936f9e..5c0eacc 100644 --- a/modules/home-manager/obsidian.nix +++ b/modules/home-manager/obsidian.nix @@ -7,7 +7,14 @@ enable = true; vaults.miscellanious = { enable = true; - #target = "/kdrive/Notes/miscellanious"; #not directly to kdrive. It causes problems - }; + target = "/Documents/Notes/miscellanious"; # target is relative to ~ #not directly to kdrive. It causes problems + }; + vaults.work = { + enable = true; + target = "/Documents/Notes/work"; + }; + defaultSettings = { + + }; }; } diff --git a/modules/scripts/obsidianbackup.nix b/modules/scripts/obsidianbackup.nix new file mode 100644 index 0000000..1d500a3 --- /dev/null +++ b/modules/scripts/obsidianbackup.nix @@ -0,0 +1,64 @@ +{ + writeShellApplication, + rclone, + libnotify, + rsync, + ... +}: + +writeShellApplication { + name = "custom-obsidianbackup"; + runtimeInputs = [ + rclone + libnotify + rsync + ]; + text = '' + #!/usr/bin/env bash + + SOURCE_DIR="$HOME/Documents/Notes" + DEST_DIR="$HOME/kdrive/Notes" + BACKUP_DIR="$HOME/.Notes.backup" + + mkdir -p "$DEST_DIR" + mkdir -p "$BACKUP_DIR" + + while true; do + # Timestamp for this run + TIMESTAMP=$(date +%Y-%m-%d_%H-%M) + TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP" + mkdir -p "$TIMESTAMPED_BACKUP" + + echo "[$(date)] Starting Obsidian backup..." + + # Check rclone mount + status=$(rclone about kdrive: 2>&1 || true) + if [[ "$status" =~ .*CRITICAL.* ]]; then + echo "[$(date)] rclone failed:" + echo "$status" + notify-send -u critical "rclone failed" \ + "rclone might be broken or you need to deactivate this script in HomeManager." + else + # Run rsync with verbose debugging + echo "[$(date)] Running rsync..." + rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \ + --exclude='.obsidian/cache/**' \ + "$SOURCE_DIR/" "$DEST_DIR/" + + echo "[$(date)] Backup completed for this run." + fi + + # Safely remove backups older than 30 days + if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then + echo "[$(date)] Cleaning old backups..." + find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \; + else + echo "[$(date)] Backup directory not safe. Skipping cleanup." + fi + + # Wait 1 hour + echo "[$(date)] Sleeping for 1 hour..." + sleep 3600 + done + ''; +} diff --git a/todo b/todo index 40d6ef3..bbd38a9 100644 --- a/todo +++ b/todo @@ -1,20 +1,12 @@ audacity.x86_64 -biber.noarch dolphin.x86_64 may be customized or nautilus cust ollama.x86_64 plymouth.x86_64 -python3.x86_64 -qt6-qtwebsockets.x86_64 maybe copy from rivendel hy quickshell.x86_64 raylib-devel.x86_64 some notification daemon 0.12-32.fc43 -texlive.noarch -texlive-biblatex.noarch -texlive-bibtex.x86_64 -thunderbird.x86_64 tor.x86_64 torbrowser-launcher.noarch -replace sddm by ly maybe configure a bit ripgrep? majuscules @@ -61,6 +53,8 @@ with quickshell: maybe some kind of overview? + show battery percentage + see what people did with quickshell and take inspiration work on quickshell color palette to match gruvbox