tweaks to empv and adding bluetooth?

This commit is contained in:
Chris Cochrun 2023-09-20 08:43:24 -05:00
parent 47e16a9f60
commit 1992fca849
2 changed files with 82 additions and 6 deletions

View file

@ -9,6 +9,7 @@
- [[#fix-nixos][Fix NixOS]]
- [[#spell-check][Spell Check]]
- [[#proced][Proced]]
- [[#bluetooth][Bluetooth]]
- [[#keep-folders-clean][Keep Folders Clean]]
- [[#ligatures][Ligatures]]
- [[#keybindings][Keybindings]]
@ -357,6 +358,16 @@ I am currently using NixOS. In order for emacs to have access to certain program
(setenv "CXX" "/run/current-system/sw/bin/g++")
(setenv "QT_AUTO_SCREEN_SCALE_FACTOR" "1")
(setenv "QT_SCALE_FACTOR" "1")
(defun chris/nix-reload ()
(interactive)
(let* ((query (shell-command-to-string "nix-store --query $(which emacs)"))
(store-path (expand-file-name "share/emacs" (string-trim query))))
(load-file (expand-file-name "site-lisp/subdirs.el" store-path))
(when (boundp 'native-comp-eln-load-path)
(add-to-list 'native-comp-eln-load-path (expand-file-name "native-lisp/" store-path)))))
(add-to-list 'native-comp-eln-load-path (expand-file-name "native-lisp/" "/nix/store/4fcbabjigcwvxv0idh2ik0ml80lq7m49-emacs-bluetooth-0.3.1/"))
#+end_src
Also due to using greetd, emacs isn't started with the environment from the system, so let's make sure it knows which wayland display we are using
@ -396,6 +407,14 @@ Let's turn auto update on for proced
(setq proced-auto-update-flag t)
#+end_src
** Bluetooth
I think I like this interface to controlling bluetooth the most
#+begin_src emacs-lisp
(use-package bluetooth
:general
(chris/leader-keys
"oT" 'bluetooth-list-devices))
#+end_src
** Keep Folders Clean
@ -3988,6 +4007,14 @@ With empv we can perhaps control mpv much more fine grainly and even search yout
(interactive)
(async-shell-command (concat "yt-dlp" " \"" (empv-youtube-results--current-video-url) "\"")))
(defun chris/empv-org-play-link (&optional link)
"Play link in empv from either supplied link or link at point in org-mode"
(interactive)
(let ((link (if link
link
(org-babel-read-link))))
(empv-play link)))
:general
(chris/leader-keys
:states 'normal
@ -3996,7 +4023,10 @@ With empv we can perhaps control mpv much more fine grainly and even search yout
"vt" 'empv-toggle
"vv" 'empv-play-video
"vx" 'empv-chapter-select
"vy" 'empv-youtube-tabulated)
"vy" 'empv-youtube-tabulated
"vn" 'empv-playlist-next
"vp" 'empv-playlist-prev
"vs" 'empv-playlist-select)
(general-def
:states 'normal
:keymaps 'empv-youtube-results-mode-map
@ -4090,6 +4120,20 @@ q quit-window
(defvar chris/elfeed-bongo-playlist "*Bongo-Elfeed Queue*"
"Name of the Elfeed+Bongo multimedia playlist.")
(defun chris/elfeed-empv-play ()
"Play elfeed video or podcast link in empv"
(interactive)
(let* ((entry (elfeed-search-selected :ignore-region))
(link (elfeed-entry-link entry))
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0))
(url (if (string-prefix-p "https://thumbnails" enclosure)
link
(if (string= enclosure nil)
link
enclosure)))
(title (elfeed-entry-title entry)))
(empv-play-or-enqueue url)))
(defun chris/elfeed-bongo-insert-item ()
"Insert `elfeed' multimedia links in `bongo' playlist buffer.
@ -4172,7 +4216,8 @@ interfere with the default `bongo-playlist-buffer'."
(defun chris/elfeed-ui-setup ()
(display-line-numbers-mode -1)
(toggle-truncate-lines +1))
(toggle-truncate-lines +1)
(elfeed-search-fetch))
(defun chris/elfeed-show-ui-setup ()
(display-line-numbers-mode -1)
@ -4207,7 +4252,7 @@ interfere with the default `bongo-playlist-buffer'."
"of" 'elfeed)
(general-def 'normal elfeed-search-mode-map
"v" 'chris/elfeed-bongo-insert-item
"v" 'chris/elfeed-empv-play
"h" 'chris/elfeed-bongo-switch-to-playlist
"b" 'chris/elfeed-eww-browse
"o" 'chris/elfeed-org-view)

37
init.el
View file

@ -162,6 +162,11 @@
(setq proced-auto-update-flag t)
(use-package bluetooth
:general
(chris/leader-keys
"oT" 'bluetooth-list-devices))
(use-package no-littering)
;; no-littering doesn't set this by default so we must place
@ -2906,6 +2911,14 @@ targets."
(interactive)
(async-shell-command (concat "yt-dlp" " \"" (empv-youtube-results--current-video-url) "\"")))
(defun chris/empv-org-play-link (&optional link)
"Play link in empv from either supplied link or link at point in org-mode"
(interactive)
(let ((link (if link
link
(org-babel-read-link))))
(empv-play link)))
:general
(chris/leader-keys
:states 'normal
@ -2914,7 +2927,10 @@ targets."
"vt" 'empv-toggle
"vv" 'empv-play-video
"vx" 'empv-chapter-select
"vy" 'empv-youtube-tabulated)
"vy" 'empv-youtube-tabulated
"vn" 'empv-playlist-next
"vp" 'empv-playlist-prev
"vs" 'empv-playlist-select)
(general-def
:states 'normal
:keymaps 'empv-youtube-results-mode-map
@ -2929,6 +2945,20 @@ targets."
(defvar chris/elfeed-bongo-playlist "*Bongo-Elfeed Queue*"
"Name of the Elfeed+Bongo multimedia playlist.")
(defun chris/elfeed-empv-play ()
"Play elfeed video or podcast link in empv"
(interactive)
(let* ((entry (elfeed-search-selected :ignore-region))
(link (elfeed-entry-link entry))
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0))
(url (if (string-prefix-p "https://thumbnails" enclosure)
link
(if (string= enclosure nil)
link
enclosure)))
(title (elfeed-entry-title entry)))
(empv-play-or-enqueue url)))
(defun chris/elfeed-bongo-insert-item ()
"Insert `elfeed' multimedia links in `bongo' playlist buffer.
@ -3011,7 +3041,8 @@ interfere with the default `bongo-playlist-buffer'."
(defun chris/elfeed-ui-setup ()
(display-line-numbers-mode -1)
(toggle-truncate-lines +1))
(toggle-truncate-lines +1)
(elfeed-search-fetch))
(defun chris/elfeed-show-ui-setup ()
(display-line-numbers-mode -1)
@ -3046,7 +3077,7 @@ interfere with the default `bongo-playlist-buffer'."
"of" 'elfeed)
(general-def 'normal elfeed-search-mode-map
"v" 'chris/elfeed-bongo-insert-item
"v" 'chris/elfeed-empv-play
"h" 'chris/elfeed-bongo-switch-to-playlist
"b" 'chris/elfeed-eww-browse
"o" 'chris/elfeed-org-view)