aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts/neomutt-sync
diff options
context:
space:
mode:
Diffstat (limited to 'modules/scripts/neomutt-sync')
-rw-r--r--modules/scripts/neomutt-sync/assertions.nix7
-rw-r--r--modules/scripts/neomutt-sync/default.nix31
-rw-r--r--modules/scripts/neomutt-sync/script.sh62
3 files changed, 0 insertions, 100 deletions
diff --git a/modules/scripts/neomutt-sync/assertions.nix b/modules/scripts/neomutt-sync/assertions.nix
deleted file mode 100644
index 38f48e4..0000000
--- a/modules/scripts/neomutt-sync/assertions.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ config, ... }:
-[
- {
- assertion = !config.scripts.neomutt-sync.enable || config.communication.neomutt.enable;
- message = "scripts.neomutt-sync is enabled but requires `communication.neomutt.enable`.";
- }
-]
diff --git a/modules/scripts/neomutt-sync/default.nix b/modules/scripts/neomutt-sync/default.nix
deleted file mode 100644
index d990210..0000000
--- a/modules/scripts/neomutt-sync/default.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- config,
- lib,
- pkgs,
- ...
-}:
-let
- inherit ((import ../lib.nix { inherit lib pkgs; })) mkScriptModule;
- base = mkScriptModule {
- name = "neomutt-sync";
- path = ./script.sh;
- description = "Neomutt-sync - Interactive mail sync with dialog progress bar";
- deps = [
- pkgs.bash
- pkgs.dialog
- pkgs.coreutils
- pkgs.gawk
- pkgs.gnused
- pkgs.util-linux
- config.programs.mbsync.package
- config.programs.notmuch.package
- ];
- inherit config;
- };
-in
-{
- options = base.options;
- config = base.moduleConfig // {
- assertions = base.moduleConfig.assertions ++ (import ./assertions.nix { inherit config lib; });
- };
-}
diff --git a/modules/scripts/neomutt-sync/script.sh b/modules/scripts/neomutt-sync/script.sh
deleted file mode 100644
index d0dac63..0000000
--- a/modules/scripts/neomutt-sync/script.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env bash
-DIALOGRC=$(mktemp)
-NOTMUCH_LOG=$(mktemp)
-TITLE="[󰇮 SYNCING MAIL]"
-export DIALOGRC
-trap 'rm -f "$DIALOGRC" "$NOTMUCH_LOG"' EXIT # Clean up everything on exit
-
-cat << 'EOF' > "$DIALOGRC"
-use_shadow = ON
-use_colors = ON
-screen_color = (WHITE,BLACK,OFF)
-dialog_color = (WHITE,BLACK,ON)
-title_color = (YELLOW,BLACK,ON)
-gauge_color = (GREEN,BLACK,ON)
-border_color = (CYAN,BLACK,ON)
-border2_color = (BLUE,BLACK,ON)
-shadow_color = (BLACK,BLACK,ON)
-
-# Active buttons: magenta emphasis, matching Base16 base0E
-button_active_color = (MAGENTA,BLACK,ON)
-button_key_active_color = (MAGENTA,BLACK,ON)
-button_label_active_color = (MAGENTA,BLACK,ON)
-
-# Inactive buttons: cyan secondary emphasis, matching Base16 base0C
-button_inactive_color = (CYAN,BLACK,OFF)
-button_key_inactive_color = (CYAN,BLACK,OFF)
-button_label_inactive_color = (CYAN,BLACK,OFF)
-EOF
-
-# Run the sync and indexing progress bar
-(
- # mbsync phase
- script -q -e -c "mbsync -a" /dev/null | awk -v RS='\r' '
- {
- c_str = ""
- b_str = ""
- for(i=1; i<=NF; i++) {
- if ($i == "C:") c_str = $(i+1)
- if ($i == "B:") b_str = $(i+1)
- }
- if (b_str != "") {
- split(b_str, arr, "/")
- if (arr[2] > 0) {
- percent = int((arr[1] / arr[2]) * 100)
- printf "XXX\n%d\nSyncing | Channel: %s | Mailbox: %s\nXXX\n", percent, c_str, b_str
- }
- }
- fflush()
- }'
-
- # notmuch phase
- printf "XXX\n100\nIndexing new mail with notmuch...\nXXX\n"
- notmuch new > "$NOTMUCH_LOG" 2>&1
-) | dialog --title "$TITLE" --gauge "Initializing..." 8 80 0
-
-# Format the captured notmuch output into a single clean line
-CLEAN_OUT=$(tr '\n' ' ' < "$NOTMUCH_LOG" | sed 's/ */ /g')
-
-# Display final results and wait for user input
-dialog --title "$TITLE" --msgbox "Done!\n$CLEAN_OUT" 8 80
-
-clear