From e871380bc072e1f3295320196c0bd4a726752169 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 10 Nov 2022 22:48:59 +0000 Subject: afio: a workspace of chats' own --- custom/jao-custom-exwm.el | 6 +++--- init.el | 37 +++++++++++++++++++------------------ lib/eos/jao-afio.el | 16 ++++++++++------ lib/eos/jao-tracking.el | 8 +++++++- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/custom/jao-custom-exwm.el b/custom/jao-custom-exwm.el index b6feaeb..1a5e4c2 100644 --- a/custom/jao-custom-exwm.el +++ b/custom/jao-custom-exwm.el @@ -4,7 +4,6 @@ ;;; Load and basic config (defvar jao-exwm--use-afio t) -(setq jao-tracking-use-scratch 1) (jao-load-path "exwm") @@ -278,8 +277,8 @@ (jao-def-exwm-runner jao-exwm-open-with-mupdf nil nil "mupdf" (buffer-file-name)) (jao-def-exwm-runner jao-exwm-xterm 0 nil "xterm") -(jao-def-exwm-toggler jao-exwm-tidal 5 "tidal-hifi" "tidal-hifi") -(defalias 'jao-streaming-list #'jao-exwm-tidal) +;; (jao-def-exwm-toggler jao-exwm-tidal 5 "tidal-hifi" "tidal-hifi") +;; (defalias 'jao-streaming-list #'jao-exwm-tidal) (defun jao-exwm-import-screen (&optional area) (interactive "P") @@ -494,6 +493,7 @@ ([?\s-2] . jao-afio-goto-mail) ([?\s-3] . jao-afio-goto-www) ([?\s-4] . jao-afio-goto-docs) + ([?\s-5] . jao-afio-goto-chats) ([?\s-A] . org-agenda-list) ([?\s-a] . jao-first-window) ([?\s-b] . jao-transient-org-blog) diff --git a/init.el b/init.el index 5f4a70e..8f1ae1e 100644 --- a/init.el +++ b/init.el @@ -540,9 +540,7 @@ (use-package jao-tracking :demand t - :init (setq jao-tracking-bkg - (if (jao-colors-scheme-dark-p) "grey20" "grey93") - jao-tracking-use-scratch t) + :init (setq jao-tracking-bkg (if (jao-colors-scheme-dark-p) "grey20" "grey93")) :config (jao-tracking-setup)) ;;;; tmr @@ -1038,6 +1036,7 @@ ("C-c g" . 'jao-afio-goto-mail) ("C-c w" . 'jao-afio-goto-www) ("C-c z" . 'jao-afio-goto-docs) + ("C-c t" . 'jao-afio-goto-chats) ("C-c 0" . 'jao-afio-goto-scratch) ("M-o" . 'jao-afio-toggle))) (add-hook 'jao-afio-switch-hook 'jao-minibuffer-refresh t) @@ -2546,7 +2545,7 @@ (defun jao-telega () (interactive) - (when jao-tracking-use-scratch (jao-afio-goto-scratch)) + (jao-tracking-go-to-chats) (if (get-buffer telega-root-buffer-name) (pop-to-buffer telega-root-buffer-name) (telega))) @@ -2584,18 +2583,19 @@ (setq mastodon-instance-url "https://mastodon.social" mastodon-active-user "jao@gnu.org") :config - (defun jao-mastodon-toot-url () - (interactive) - (when-let (url (jao-url-around-point t)) - (jao-afio-goto-scratch) - (mastodon-toot--compose-buffer nil nil nil url))) - - (defun jao-mastodon () - (interactive) - (jao-afio-goto-scratch) - (mastodon)) :bind (:map eww-mode-map ("T" . jao-mastodon-toot-url))) +(defun jao-mastodon-toot-url () + (interactive) + (when-let (url (jao-url-around-point t)) + (jao-tracking-go-to-chats) + (mastodon-toot--compose-buffer nil nil nil url))) + +(defun jao-mastodon () + (interactive) + (jao-afio-goto-scratch) + (mastodon)) + ;;;; startup (defun jao-chats (&optional p) (interactive "P") @@ -2613,7 +2613,7 @@ (defun jao-all-chats () (interactive) (when jao-tracking-use-scratch - (jao-afio-goto-scratch) + (jao-afio-goto-chats) (delete-other-windows)) (jao-chats t)) @@ -2793,7 +2793,6 @@ (use-package jao-spt :demand t :config - ;; (jao-spt-set-up) (defun jao-spt-setup-aliases () (setq espotify-play-uri-function #'jao-spt-play-uri) (defalias 'jao-streaming-list #'jao-term-spt) @@ -2810,10 +2809,10 @@ (defalias 'jao-streaming-dislike #'jao-spt-dislike) (defalias 'jao-streaming-toggle-shuffle #'jao-spt-toggle-shuffle))) -(defvar jao-spt-on t) +(defvar jao-spt-on nil) (defun jao-spt-on-p () jao-spt-on) -(jao-def-exec-in-term "spt" "spt" (jao-afio-goto-scratch t)) +(jao-def-exec-in-term "spt" "spt" (jao-afio-goto-scratch)) (defun jao-streaming-toggle-player () (interactive) @@ -2826,6 +2825,8 @@ (message "%s activated " (if (setq jao-spt-on (not jao-spt-on)) "spt" "mpris"))) +(jao-streaming-toggle-player) + ;;;; music transients (require 'jao-lyrics) (setq jao-lyrics-info-function #'jao-player-info) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index dcaa833..304ee64 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -30,7 +30,7 @@ (defvar jao-afio-auto-toggle nil) (defvar jao-afio-switch-hook nil) -(defvar jao-afio--configs '(?c ?w ?g ?p ?s)) +(defvar jao-afio--configs '(?c ?w ?g ?p ?s ?t)) (defvar jao-afio--previous-config (car jao-afio--configs)) (defun jao-afio--current-config (&optional c f) @@ -163,7 +163,7 @@ (?w (jao-afio-open-www)) (?g (jao-afio-open-mail)) (?p (jao-afio-open-doc)) - (?s (jao-afio-trisect)))) + (t (jao-afio-trisect)))) ;;; go to frame (defsubst jao-afio--find-frame (c) @@ -172,11 +172,11 @@ (defun jao-afio-frame-name (&optional c) (alist-get (or c (jao-afio--current-config)) '((?c . "main") (?s . "scratch") (?g . "mail") - (?p . "docs") (?w . "web")))) + (?p . "docs") (?w . "web") (?t . "chats")))) (defun jao-afio-frame-no (&optional c) (alist-get (or c (jao-afio--current-config)) - '((?s . 0) (?c . 1) (?g . 2) (?w . 3) (?p . 4)))) + '((?s . 0) (?c . 1) (?g . 2) (?w . 3) (?p . 4) (?t . 5)))) (defun jao-afio--goto-frame (next &optional reset) (jao-afio--check-frame) @@ -227,15 +227,19 @@ (jao-afio--goto-frame ?s nil) (when one-win (delete-other-windows))) +(defun jao-afio-goto-chats (&optional reset) + (interactive "P") + (jao-afio--goto-frame ?t reset)) + ;;;###autoload (defun jao-afio-goto-nth (n) (cl-case n + ((0) (jao-afio-goto-scratch)) ((1) (jao-afio-goto-main)) ((2) (jao-afio-goto-mail)) ((3) (jao-afio-goto-www)) ((4) (jao-afio-goto-docs)) - ((5) (jao-afio-goto-scratch t)) - ((0) (jao-afio-goto-scratch)))) + ((5) (jao-afio-goto-chats)))) ;;;###autoload (defun jao-afio-pop-to-buffer (n buff) diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el index fdb156b..5158fd6 100644 --- a/lib/eos/jao-tracking.el +++ b/lib/eos/jao-tracking.el @@ -126,13 +126,19 @@ (setq jao-tracking-string (jao-tracking-build-str new-val)) (jao-minibuffer-refresh)) -(defvar jao-tracking-use-scratch nil) +(defvar jao-tracking-use-scratch 5) (defvar jao-tracking--start-frame nil) (defun jao-tracking--remove-visible-buffers () (unless (and jao-afio-use-frames jao-tracking-use-scratch) (tracking-remove-visible-buffers))) +;;;###autoload +(defun jao-tracking-go-to-chats () + (interactive) + (when jao-tracking-use-scratch + (jao-afio-goto-nth jao-tracking-use-scratch))) + ;;;###autoload (defun jao-tracking-next-buffer () (interactive) -- cgit v1.2.3