]>
Commit | Line | Data |
---|---|---|
51c1ed38 JN |
1 | ;;; nimcoon.el -*- lexical-binding: t; -*- |
2 | ;;; | |
3 | ;;; Usage in Doom Emacs | |
4 | ;;; Place or symlink the file into ~/.doom.d/ | |
5 | ;;; (load! "nimcoon") | |
6 | ||
7 | ;;; Non-interactive functions to respond to URL clicks | |
8 | (defun nimcoon-play-url (url) | |
9 | "Play given url in NimCoon" | |
10 | (start-process "nimcoon" nil "nimcoon" url)) | |
11 | ||
12 | ;; Play all YouTube URLs in NimCoon | |
13 | (setq browse-url-browser-function | |
14 | (quote | |
15 | (("youtu\\.?be" . nimcoon-play-url) | |
16 | ("." . browse-url-default-browser)))) | |
17 | ||
18 | ;;; Interactive functions | |
19 | (defun nimcoon-feeling-lucky-music(query) | |
20 | (interactive "sSearch query: ") | |
21 | (call-process "nimcoon" nil 0 nil "-m" "-l" (format "'%s'" query))) | |
22 | ||
23 | (defun nimcoon-feeling-lucky-video(query) | |
24 | (interactive "sSearch query: ") | |
25 | (call-process "nimcoon" nil 0 nil "-l" (format "'%s'" query))) | |
26 | ||
27 | (defun nimcoon-download-video(query) | |
28 | (interactive "sSearch query: ") | |
29 | (call-process "nimcoon" nil 0 nil "-d" "-l" (format "'%s'" query))) | |
30 | ||
31 | (defun nimcoon-download-music(query) | |
32 | (interactive "sSearch query: ") | |
33 | (call-process "nimcoon" nil 0 nil "-d" "-l" "-m" (format "'%s'" query))) | |
34 | ||
35 | ;;; Keybindings | |
36 | (map! :leader | |
37 | ;;; <leader> N --- NimCoon | |
38 | (:prefix-map ("N" . "NimCoon") | |
39 | (:prefix ("d" . "Download") | |
40 | :desc "Video" "v" #'nimcoon-download-video | |
41 | :desc "Music" "m" #'nimcoon-download-music) | |
42 | :desc "Video" "v" #'nimcoon-feeling-lucky-video | |
43 | :desc "Music" "m" #'nimcoon-feeling-lucky-music)) |