diff options
author | jao <jao@gnu.org> | 2022-05-21 03:45:12 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-05-21 03:45:54 +0100 |
commit | 843c9aa4edf0f7eaa7807dd7bfc6735c40d19024 (patch) | |
tree | 3681e5aa5e3f3eb7cf9654f6c9815cfad4008e7c | |
parent | 5f87eb37b6bd0fe273c24f6678a99ce1f846ed06 (diff) | |
download | elibs-843c9aa4edf0f7eaa7807dd7bfc6735c40d19024.tar.gz elibs-843c9aa4edf0f7eaa7807dd7bfc6735c40d19024.tar.bz2 |
attic
-rw-r--r-- | attic/misc.org | 148 | ||||
-rw-r--r-- | init.org | 169 |
2 files changed, 157 insertions, 160 deletions
diff --git a/attic/misc.org b/attic/misc.org index e84cad0..fdfc193 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -1,3 +1,151 @@ +* erc +*** package + #+begin_src emacs-lisp + (use-package erc + :init + (setq erc-modules + '(autojoin + button + dcc + fill + irccontrols + match + move-to-prompt + netsplit + networks + noncommands + notify + pcomplete + ring + services + stamp + track + truncate)) + + (setq erc-auto-query 'bury + erc-autojoin-channels-alist `(("libera.chat" ,@jao-libera-channels)) + erc-away-nickname "jao" + erc-button-buttonize-nicks t + erc-common-server-suffixes '(("libera.chat$" . "lb")) + erc-current-nick-highlight-type 'nick-or-keyword + erc-email-userid (car jao-mails) + erc-fill-column 84 + erc-fill-prefix " " + erc-format-nick-function 'erc-format-@nick + erc-header-line-face-method t + erc-header-line-format nil ;; "%l %o" + erc-header-line-uses-tabbar-p nil + erc-hide-list '("JOIN" "PART" "QUIT") + erc-hide-timestamps nil + erc-input-line-position -1 + erc-insert-timestamp-function 'erc-insert-timestamp-right + erc-join-buffer 'bury + erc-kill-buffer-on-part t + erc-kill-queries-on-quit t + erc-log-channels-directory nil + erc-mode-line-away-status-format "(a)" + erc-mode-line-format "%t" + erc-nick "jao" + erc-notice-highlight-type 'all + erc-notice-prefix "- " + erc-notify-signoff-hook 'erc-notify-signoff + erc-notify-signon-hook 'erc-notify-signon + erc-pcomplete-nick-postfix "," + erc-rename-buffers t + erc-server-send-ping-timeout 60 + erc-prompt ":" + erc-prompt-for-nickserv-password nil + erc-use-auth-source-for-nickserv-password t + erc-prompt-for-password nil + erc-public-away-p t + erc-server "irc.libera.chat" + erc-server-coding-system '(utf-8 . undecided) + erc-server-reconnect-attempts 10 + erc-server-reconnect-timeout 10 + erc-timestamp-format "%H:%M" + erc-timestamp-only-if-changed-flag t + erc-timestamp-right-column 84 + erc-user-full-name "https://jao.io" + erc-user-mode "+i" + erc-whowas-on-nosuchnick t) + + :config + + (define-minor-mode ncm-erc-mode "" nil + (:eval (format " [%s]" (hash-table-count erc-channel-users)))) + + (add-hook 'erc-mode-hook (lambda () (ncm-erc-mode 1))) + (add-hook 'erc-mode-hook (lambda () (auto-fill-mode -1)))) + #+end_src +*** no angles + #+begin_src emacs-lisp + (defun jao-erc--no-angles (old-func &rest args) + (let ((msg (apply old-func args))) + (replace-regexp-in-string "^<\\([^>]+\\)>" "(\\1)" msg))) + + (with-eval-after-load "erc" + (modify-syntax-entry ?\( "." erc-mode-syntax-table) + (modify-syntax-entry ?\) "." erc-mode-syntax-table) + (advice-add 'erc-format-privmessage :around #'jao-erc--no-angles) + (advice-add 'erc-format-my-nick :around #'jao-erc--no-angles)) + #+end_src +*** tracking + #+begin_src emacs-lisp + (defun jao-erc-track-shorten (names) + (let ((names (erc-track-shorten-names names))) + (mapcar (lambda (n) (string-remove-prefix "#" n)) names))) + + (setq erc-track-exclude-server-buffer t + erc-track-exclude-types '("NICK" "JOIN" "PART" "QUIT" "MODE" "KICK") + erc-track-remove-disconnected-buffers t + erc-track-shorten-aggressively t ;; 'max + erc-track-shorten-function #'jao-erc-track-shorten + erc-track-switch-direction 'importance + erc-track-visibility nil ;; t all, nil only selected frame + erc-track-position-in-mode-line nil + erc-track-enable-keybindings nil ;; 'ask + erc-track-faces-priority-list '(erc-error-face + erc-current-nick-face + erc-pal-face + erc-direct-msg-face + erc-nick-msg-face + erc-default-face + erc-action-face + erc-notice-face)) + (defun jao-track-erc-buffers () + (dolist (e erc-modified-channels-alist) + (tracking-add-buffer (car e) (list (cddr e))))) + + (with-eval-after-load "erc-track" + (require 'tracking nil t) + (add-hook 'exwm-workspace-switch-hook #'erc-modified-channels-update) + (add-hook 'erc-track-list-changed-hook #'jao-track-erc-buffers)) + + (jao-shorten-modes 'erc-mode) + (jao-tracking-faces 'erc-error-face + 'erc-pal-face + 'erc-current-nick-face + 'erc-direct-msg-face) + #+end_src +*** commands (/recover &co.) + #+begin_src emacs-lisp + (defun erc-cmd-RECOVER (&rest ignore) + "Recover nick" + (let ((fn (jao--get-user/password "freenode"))) + (erc-cmd-MSG (format "nickserv IDENTIFY %s %s" (car fn) (cadr fn))) + (erc-cmd-MSG (format "nickserv GHOST %s" (car fn))) + (erc-cmd-MSG (format "nickserv RELEASE %s" (car fn))) + (erc-cmd-NICK (car fn)))) + #+end_src +*** startup + #+begin_src emacs-lisp + (defun jao-erc (&optional yes) + (interactive "P") + ;; (when (or yes (y-or-n-p "Connect to bitlbee using ERC? ")) + ;; (erc-select :server "localhost")) + (when (or yes (y-or-n-p "Connect to libera using ERC? ")) + (erc-select :server "irc.libera.chat"))) + #+end_src * dtache #+begin_src emacs-lisp (use-package dtache @@ -526,12 +526,12 @@ (jao-swaymsg (format "workspace %s" (or ws 2))) (start-process-shell-command cmd nil cmd))) - (defun jao-sway-run-or-focus-deezer () + (defun jao-sway-run-or-focus-tidal () (interactive) - (if (jao-shell-running-p "deezer-desktop") - (jao-swaymsg "[app_id=Deezer] scratchpad show") - (start-process-shell-command "deezer" nil "deezer &") - (jao-sway-run-or-focus-deezer))) + (if (jao-shell-running-p "tidal-hifi") + (jao-swaymsg "[app_id=tidal-hifi] scratchpad show") + (start-process-shell-command "tidal-hifi" nil "tidal-hifi &") + (jao-sway-run-or-focus-tidal))) (defun jao-sway-run-or-focus-firefox () (interactive) @@ -545,6 +545,7 @@ (jao-themes-setup) ;; (display-time-mode 1) (global-set-key (kbd "s-f") #'jao-sway-run-or-focus-firefox) + (defalias 'jao-streaming-list #'jao-sway-run-or-focus-tidal) (message "Welcome to sway")) (when jao-sway-enabled @@ -2922,154 +2923,6 @@ (jao-exec-in-term (format "ssh %s" h) (format "*ssh %s*" h)))) #+end_src * Chats -*** erc -**** package - #+begin_src emacs-lisp - (use-package erc - :init - (setq erc-modules - '(autojoin - button - dcc - fill - irccontrols - match - move-to-prompt - netsplit - networks - noncommands - notify - pcomplete - ring - services - stamp - track - truncate)) - - (setq erc-auto-query 'bury - erc-autojoin-channels-alist `(("libera.chat" ,@jao-libera-channels)) - erc-away-nickname "jao" - erc-button-buttonize-nicks t - erc-common-server-suffixes '(("libera.chat$" . "lb")) - erc-current-nick-highlight-type 'nick-or-keyword - erc-email-userid (car jao-mails) - erc-fill-column 84 - erc-fill-prefix " " - erc-format-nick-function 'erc-format-@nick - erc-header-line-face-method t - erc-header-line-format nil ;; "%l %o" - erc-header-line-uses-tabbar-p nil - erc-hide-list '("JOIN" "PART" "QUIT") - erc-hide-timestamps nil - erc-input-line-position -1 - erc-insert-timestamp-function 'erc-insert-timestamp-right - erc-join-buffer 'bury - erc-kill-buffer-on-part t - erc-kill-queries-on-quit t - erc-log-channels-directory nil - erc-mode-line-away-status-format "(a)" - erc-mode-line-format "%t" - erc-nick "jao" - erc-notice-highlight-type 'all - erc-notice-prefix "- " - erc-notify-signoff-hook 'erc-notify-signoff - erc-notify-signon-hook 'erc-notify-signon - erc-pcomplete-nick-postfix "," - erc-rename-buffers t - erc-server-send-ping-timeout 60 - erc-prompt ":" - erc-prompt-for-nickserv-password nil - erc-use-auth-source-for-nickserv-password t - erc-prompt-for-password nil - erc-public-away-p t - erc-server "irc.libera.chat" - erc-server-coding-system '(utf-8 . undecided) - erc-server-reconnect-attempts 10 - erc-server-reconnect-timeout 10 - erc-timestamp-format "%H:%M" - erc-timestamp-only-if-changed-flag t - erc-timestamp-right-column 84 - erc-user-full-name "https://jao.io" - erc-user-mode "+i" - erc-whowas-on-nosuchnick t) - - :config - - (define-minor-mode ncm-erc-mode "" nil - (:eval (format " [%s]" (hash-table-count erc-channel-users)))) - - (add-hook 'erc-mode-hook (lambda () (ncm-erc-mode 1))) - (add-hook 'erc-mode-hook (lambda () (auto-fill-mode -1)))) - #+end_src -**** no angles - #+begin_src emacs-lisp - (defun jao-erc--no-angles (old-func &rest args) - (let ((msg (apply old-func args))) - (replace-regexp-in-string "^<\\([^>]+\\)>" "(\\1)" msg))) - - (with-eval-after-load "erc" - (modify-syntax-entry ?\( "." erc-mode-syntax-table) - (modify-syntax-entry ?\) "." erc-mode-syntax-table) - (advice-add 'erc-format-privmessage :around #'jao-erc--no-angles) - (advice-add 'erc-format-my-nick :around #'jao-erc--no-angles)) - #+end_src -**** tracking - #+begin_src emacs-lisp - (defun jao-erc-track-shorten (names) - (let ((names (erc-track-shorten-names names))) - (mapcar (lambda (n) (string-remove-prefix "#" n)) names))) - - (setq erc-track-exclude-server-buffer t - erc-track-exclude-types '("NICK" "JOIN" "PART" "QUIT" "MODE" "KICK") - erc-track-remove-disconnected-buffers t - erc-track-shorten-aggressively t ;; 'max - erc-track-shorten-function #'jao-erc-track-shorten - erc-track-switch-direction 'importance - erc-track-visibility nil ;; t all, nil only selected frame - erc-track-position-in-mode-line nil - erc-track-enable-keybindings nil ;; 'ask - erc-track-faces-priority-list '(erc-error-face - erc-current-nick-face - erc-pal-face - erc-direct-msg-face - erc-nick-msg-face - erc-default-face - erc-action-face - erc-notice-face)) - (defun jao-track-erc-buffers () - (dolist (e erc-modified-channels-alist) - (tracking-add-buffer (car e) (list (cddr e))))) - - (with-eval-after-load "erc-track" - (require 'tracking nil t) - (add-hook 'exwm-workspace-switch-hook #'erc-modified-channels-update) - (add-hook 'erc-track-list-changed-hook #'jao-track-erc-buffers)) - - (jao-shorten-modes 'erc-mode) - (jao-tracking-faces 'erc-error-face - 'erc-pal-face - 'erc-current-nick-face - 'erc-direct-msg-face) - #+end_src -**** commands (/recover &co.) - #+begin_src emacs-lisp - (defun erc-cmd-RECOVER (&rest ignore) - "Recover nick" - (let ((fn (jao--get-user/password "freenode"))) - (erc-cmd-MSG (format "nickserv IDENTIFY %s %s" (car fn) (cadr fn))) - (erc-cmd-MSG (format "nickserv GHOST %s" (car fn))) - (erc-cmd-MSG (format "nickserv RELEASE %s" (car fn))) - (erc-cmd-NICK (car fn)))) - #+end_src -**** startup - #+begin_src emacs-lisp - (defun jao-erc (&optional yes) - (interactive "P") - ;; (when (or yes (y-or-n-p "Connect to bitlbee using ERC? ")) - ;; (erc-select :server "localhost")) - (when (or yes (y-or-n-p "Connect to libera using ERC? ")) - (erc-select :server "irc.libera.chat"))) - #+end_src *** circe #+begin_src emacs-lisp (defvar jao-libera-channels '()) @@ -3235,11 +3088,8 @@ (when (or p (y-or-n-p "Connect to telegram? ")) (telega)) (when (or p (y-or-n-p "Connect to libera? ")) - ;; (unless (get-buffer "irc.libera.chat:6697") - ;; (circe "Libera Chat")) - ;; (unless (get-buffer "Libera.Chat") - ;; (jao-erc t)) - )) + (unless (get-buffer "irc.libera.chat:6697") + (circe "Libera Chat")))) (defun jao-all-chats () (interactive) (jao-chats t)) @@ -3312,8 +3162,7 @@ (use-package jao-mpris :demand t) - (defalias 'jao-streaming-list - (if jao-sway-enabled #'jao-sway-run-or-focus-deezer #'ignore)) + (defalias 'jao-streaming-list #'ignore) (defalias 'jao-streaming-like #'ignore) (defalias 'jao-streaming-dislike #'ignore) (defalias 'jao-streaming-lyrics #'jao-mpris-lyrics) |