summaryrefslogtreecommitdiff
path: root/emacs/site-lisp
diff options
context:
space:
mode:
authorTCCQ <thomasmulmer02@gmail.com>2025-04-09 19:53:47 -0700
committerTCCQ <thomasmulmer02@gmail.com>2025-04-09 19:53:47 -0700
commitaacd40d6adbf9bfb510e40b7ddb93678e7cecbcd (patch)
tree4efb7ef976d7e6fd1a9c72647f2b40cf6b804565 /emacs/site-lisp
parent729e4d189c2d25a551a77a77276c75f42fbc4faa (diff)
emacs to add single top header and move some (global) info there
Diffstat (limited to 'emacs/site-lisp')
-rw-r--r--emacs/site-lisp/exwm-pref.el38
-rw-r--r--emacs/site-lisp/modeline-config.el30
-rw-r--r--emacs/site-lisp/my-funcs.el13
-rwxr-xr-xemacs/site-lisp/single-header.el42
4 files changed, 36 insertions, 87 deletions
diff --git a/emacs/site-lisp/exwm-pref.el b/emacs/site-lisp/exwm-pref.el
index f03711c..c6d51d1 100644
--- a/emacs/site-lisp/exwm-pref.el
+++ b/emacs/site-lisp/exwm-pref.el
@@ -27,29 +27,20 @@
(setq exwm-manage-force-tiling t)
+
(defun b3n-exwm-set-buffer-name ()
- (if (and exwm-title (string-match "\\`http[^ ]+" exwm-title))
- (let ((url (match-string 0 exwm-title)))
- (setq-local buffer-file-name url)
- (setq-local exwm-title (replace-regexp-in-string
- (concat (regexp-quote url) " - ")
- ""
- exwm-title))
- (setq-local exwm-title (replace-regexp-in-string
- " - Mozilla Firefox"
- ""
- exwm-title))))
-
- (setq-local exwm-title
- (concat
- exwm-class-name
- "<"
- ;; (if (<= (length exwm-title) exwm-title-length)
- exwm-title
- ;; (concat (substring exwm-title 0 exwm-title-length) "…"))
- ">"))
-
- (exwm-workspace-rename-buffer exwm-title))
+ (if exwm-title
+ (let* ((shortened-title (replace-regexp-in-string
+ " - Mozilla Firefox"
+ ""
+ exwm-title))
+ (class-and-title (concat
+ exwm-class-name
+ "<"
+ shortened-title
+ ">")))
+ (setq-local exwm-title class-and-title)
+ (exwm-workspace-rename-buffer exwm-title))))
(add-hook 'exwm-update-class-hook 'b3n-exwm-set-buffer-name)
(add-hook 'exwm-update-title-hook 'b3n-exwm-set-buffer-name)
@@ -190,6 +181,9 @@
;; browser
([?\s-e] . (lambda ()
(interactive)
+ (start-process-shell-command "vimb" nil "vimb")))
+ ([?\s-E] . (lambda ()
+ (interactive)
(start-process-shell-command "firefox" nil "firefox")))
;; ([?\M-e] . (lambda ()
;; (interactive)
diff --git a/emacs/site-lisp/modeline-config.el b/emacs/site-lisp/modeline-config.el
index b74a15d..5b1f7e5 100644
--- a/emacs/site-lisp/modeline-config.el
+++ b/emacs/site-lisp/modeline-config.el
@@ -2,9 +2,6 @@
(provide 'modeline-config)
-;; (require 'battery)
-;; (display-battery-mode 1)
-
(use-package doom-modeline
:init
(doom-modeline-mode 1))
@@ -14,30 +11,9 @@
:custom
(minions-prominent-modes '(persp-mode auto-fill-mode eldoc-mode eglot-mode lsp-mode)))
-(require 'time)
-(setq display-time-day-and-date t)
-;; Set up the time timer.
-(defun enable-display-time-backend ()
- "Do the internal bit of `display-time-mode` but without adding it to the
-global mode string"
- (and display-time-timer (cancel-timer display-time-timer))
- (setq display-time-timer nil)
- (setq display-time-string "")
- (setq display-time-load-average display-time-default-load-average)
- (progn
- ;; (or (memq 'display-time-string global-mode-string)
- ;; (setq global-mode-string
- ;; (append global-mode-string '(display-time-string))))
- ;; Set up the time timer.
- (setq display-time-timer
- (run-at-time t display-time-interval
- 'display-time-event-handler))
- ;; Make the time appear right away.
- (display-time-update)))
-
-;; (enable-display-time-backend)
-(display-time-mode 1)
-;; there is more in the single-header file
+(setq-default global-mode-string '("" (:eval (concat (with-face (format " [%s] " (shorten-path default-directory))
+ :weight 'bold
+ :foreground "green2")))))
;; -----------------------------------------------------------------------------
;; telephone line stuff
diff --git a/emacs/site-lisp/my-funcs.el b/emacs/site-lisp/my-funcs.el
index 8bed290..01bf5cc 100644
--- a/emacs/site-lisp/my-funcs.el
+++ b/emacs/site-lisp/my-funcs.el
@@ -143,3 +143,16 @@ BEG and END define the region."
(defun dired-do-find-marked-files ()
(interactive)
(seq-do 'find-file (dired-get-marked-files)))
+
+(defun shorten-path (path)
+ "Shortens each directory in PATH except for the last directory to its first character."
+ (let* ((components (split-string path "/")) ; Split the path into components
+ (last-component (-last (lambda (s) (not (string-empty-p s))) components)) ; Extract the last component
+ (shortened-components ; Shorten all components except the last
+ (mapcar (lambda (comp)
+ (if (or (string-equal comp last-component) (string-empty-p comp))
+ comp
+ (substring comp 0 1)))
+ components)))
+ (mapconcat 'identity shortened-components "/"))) ; Recombine components into a path
+
diff --git a/emacs/site-lisp/single-header.el b/emacs/site-lisp/single-header.el
index 1196ea0..796a637 100755
--- a/emacs/site-lisp/single-header.el
+++ b/emacs/site-lisp/single-header.el
@@ -1,3 +1,5 @@
+(provide 'single-header)
+
(defvar single-header--current-header-buffer nil "Read the name")
(defvar single-header-format '(make-header-info-string) "evaluated to fill the header")
@@ -9,23 +11,6 @@
(add-face-text-property 0 (length str) face-plist t str)
str)
-;; disable normal emms-state and move it to the header
-;; (require 'emms-state)
-;; (setq single-header-emms-state-format-string
-;; '(emms-state
-;; (" " emms-state
-;; (emms-state-current-playing-time
-;; (" "
-;; (:propertize emms-state-current-playing-time
-;; face emms-state-current-playing-time)))
-;; (emms-state-total-playing-time
-;; ("("
-;; (:propertize emms-state-total-playing-time
-;; face emms-state-total-playing-time)
-;; ")"))
-;; emms-mode-line-string)))
-;; (setq emms-state-mode-line-string "")
-
(defun make-header-info-string ()
"generates the mode line string that contains all the info to the right"
(let ((win (when (buffer-live-p single-header--current-header-buffer)
@@ -45,7 +30,6 @@
:foreground "#00ced1")
(with-face (battery-format "[%b%p%%] " (and battery-status-function (funcall battery-status-function)))
:weight 'bold)
- ;; (format-mode-line single-header-emms-state-format-string)
)))
(setq str (concat str
(cond (win (make-string
@@ -54,23 +38,6 @@
))
(with-face str 'single-header)))
-
-(defun shorten-path (path)
- "Shortens each directory in PATH except for the last directory to its first character."
- (let* ((components (split-string path "/")) ; Split the path into components
- (last-component (-last (lambda (s) (not (string-empty-p s))) components)) ; Extract the last component
- (shortened-components ; Shorten all components except the last
- (mapcar (lambda (comp)
- (if (or (string-equal comp last-component) (string-empty-p comp))
- comp
- (substring comp 0 1)))
- components)))
- (mapconcat 'identity shortened-components "/"))) ; Recombine components into a path
-
-;; (setq global-mode-string '("" (:eval (concat (with-face (format " [%s] " (shorten-path default-directory))
-;; :weight 'bold
-;; :foreground "green2")))))
-
(defun single-header-init-buffer (buf)
(with-current-buffer buf
(insert "header test")
@@ -138,6 +105,5 @@
;; (single-header-show single-header--current-header-buffer))))
;; do init frame seperately
-;; (single-header-show single-header--current-header-buffer)
-;; (run-with-timer 0 1 'single-header-update)
-
+(single-header-show single-header--current-header-buffer)
+(run-with-timer 0 1 'single-header-update)