commit 1704342bcb3fcdc65482c36e89098a6d2ee3d706
Author: Simon Watson <spw01@protonmail.com>
Date: Thu Nov 4 15:56:30 2021 -0400
Rudimentary email TUI + small updates for void
diff --git a/bashrc/bashrc-all b/bashrc/bashrc-all
index 7cbfe02..15b9cad 100644
--- a/bashrc/bashrc-all
+++ b/bashrc/bashrc-all
@@ -54,9 +54,10 @@ hnc() {
fi
}
-# open submission in browser
-
-
+export HIMALAYA_PATH=$(which himalaya)
+if [ ! -z $HIMALAYA_PATH ]; then
+ . ~/Repos/dotfiles/himalaya/himalaya_shell_ui.sh
+fi
# Case defines platform specific configs
# Platform agnostic configs above
case $(hostname) in
diff --git a/emacs/.emacs-all b/emacs/.emacs-all
index 7d33462..a8d8856 100644
--- a/emacs/.emacs-all
+++ b/emacs/.emacs-all
@@ -209,6 +209,11 @@
(load "~/Repos/dotfiles/emacs/elisp/helpers.el")
(global-set-key (kbd "C-c p") 'display-full-buffer-path)
+;; Disable bars
+(menu-bar-mode -1)
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+
;; Load for macOS
;;; Slime/etc
(if (eq system-type 'darwin)
@@ -254,17 +259,15 @@
(setq yas-snippet-dirs
'("~/Repos/dotfiles/emacs/yasnippets/"))
(yas-global-mode 1)
-
- (straight-use-package 'exwm)
- (require 'exwm)
-
- ;(require 'exwm-systemtray)
- ;(exwm-systemtray-enable)
-
- (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
+
+ (if (file-exists-p "~/.enable_exwm")
+ (progn
+ (straight-use-package 'exwm)
+ (require 'exwm)
+ (load "~/Repos/dotfiles/emacs/linux-load/exwm-config.el")
- (require 'exwm-config-spw)
- (exwm-config-spw)
+ (require 'exwm-config-spw)
+ (exwm-config-spw)))
(setq visible-bell 1)
(load "~/Repos/dotfiles/emacs/linux-load/customs.el")
diff --git a/emacs/linux-load/customs.el b/emacs/linux-load/customs.el
index da0a1fc..30d079f 100644
--- a/emacs/linux-load/customs.el
+++ b/emacs/linux-load/customs.el
@@ -12,4 +12,4 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
- '(default ((t (:family "Envy Code R" :foundry "UNKN" :slant normal :weight normal :height 83 :width normal)))))
+ '(default ((t (:family "Envy Code R" :foundry "UNKN" :slant normal :weight normal :height 120 :width normal)))))
diff --git a/himalaya/himalaya_shell_ui.sh b/himalaya/himalaya_shell_ui.sh
new file mode 100644
index 0000000..762d69f
--- /dev/null
+++ b/himalaya/himalaya_shell_ui.sh
@@ -0,0 +1,78 @@
+# Script to handle automating/interacting with himalaya email server
+
+# $BAT_PATH and $HIMALAYA_PATH are provided by .bashrc, where this
+# file is sourced from
+
+alias eml="$HIMALAYA_PATH list" # List emails in default inbox
+alias ems="$HIMALAYA_PATH send" # Provide email via stdin and send
+
+# Read email passed and page into bat/less
+function emr() {
+ READER="/bin/less"
+ if [ ! -z $BAT_PATH ]; then
+ READER=$BAT_PATH
+ fi
+ $HIMALAYA_PATH read $1 | $READER
+}
+
+# Generate template for new email reply and open in either emacs
+# or vim, depending on whether emacs server is running
+function emw() {
+ if [ -z $1 ]; then
+ echo "Must provide emw an emailID"
+ return 1
+ fi
+
+ EMAIL_FILE=$(mktemp)
+ $HIMALAYA_PATH template reply $1 > $EMAIL_FILE
+ email_file_editor $EMAIL_FILE
+ email_sender $EMAIL_FILE
+}
+
+# Generate template for a new email, as above
+function emn() {
+ EMAIL_FILE=$(mktemp)
+
+ $HIMALAYA_PATH template new > $EMAIL_FILE
+ email_file_editor $EMAIL_FILE
+ email_sender $EMAIL_FILE
+
+}
+
+function email_file_editor() {
+ EMAIL_FILE=$1
+
+ EMACS_SERVER_RUNNING=$(lsof -c emacs | grep server | wc -l)
+ if [ $EMACS_SERVER_RUNNING -gt 0 ]; then
+ emacsclient -c $EMAIL_FILE
+ else
+ $EDITOR $EMAIL_FILE
+ fi
+}
+
+function email_sender() {
+ EMAIL_FILE=$1
+ cat $EMAIL_FILE
+
+ echo -n "Do you want to send this email [y/n]: "
+ read USER_REPONSE
+
+ if [[ "$USER_REPONSE" == *"y"* ]]; then
+ echo "Sending email..."
+ cat -p $EMAIL_FILE | $HIMALAYA_PATH send
+ rm $EMAIL_FILE
+ else
+ echo "Aborting, email file at: $EMAIL_FILE"
+ fi
+}
+
+function clean_old_emails() {
+ EMAILS_MATCHING=$(grep Content /tmp/tmp.* | cut -d ":" -f 1 | wc -l)
+ echo -n "Delete $EMAILS_MATCHING old emails: [y/n]: "
+ read USER_REPONSE
+ if [[ "$USER_REPONSE" == *"y"* ]]; then
+ for file in $(grep Content /tmp/tmp.* | cut -d ":" -f 1); do rm $file; done
+ else
+ echo "Not deleting..."
+ fi
+}