diff --git a/init.example.el b/init.example.el index beede2341..f154f1b55 100644 --- a/init.example.el +++ b/init.example.el @@ -175,6 +175,7 @@ :app ;;calendar + ;;everywhere ; *leave* Emacs!? You must be joking ;;irc ; how neckbeards socialize ;;(rss +org) ; emacs as an RSS reader ;;twitter ; twitter client https://twitter.com/vnought diff --git a/modules/app/everywhere/README.org b/modules/app/everywhere/README.org new file mode 100644 index 000000000..2d75cf89b --- /dev/null +++ b/modules/app/everywhere/README.org @@ -0,0 +1,58 @@ +#+title: app/everywhere +#+date: February 7, 2021 +#+since: v3.0 +#+startup: inlineimages nofold + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#maintainers][Maintainers]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] +- [[#configuration][Configuration]] + +* Description +This module adds system-wide popup Emacs windows for quick edits. + +** Maintainers ++ [[https://github.com/tecosaur][@tecosaur]] + +** Module Flags + +This module provides no flags. + +** Plugins ++ [[https://github.com/tecosaur/emacs-everywhere][emacs-everywhere]] + +* Prerequisites + +On Linux =xclip=, =xdotool=, =xprop=, and =xwininfo= are needed. + +On MacOS, Emacs must be allowed to "control your computer" under *Settings > Accessibility*. + +* Features + +To use this, invoke the =emacs-everywhere= executable. This can be done in two +ways: ++ ~emacsclient --eval "(emacs-everywhere)"~ ++ ~doom everywhere~ + +It is recommended that you add a keybinding for this. + +From here, you can edit away to your hearts content in the created frame, then +return to the original window and paste the content with =C-c C-c= or =SPC q f=. +To exit without pasting, use =C-c C-k=. + +* Configuration + +=emacs-everywhere= likes to guess if you triggered it from an application which +supports markdown. Configure ~emacs-everywhere-markdown-windows~ and +~emacs-everywhere-markdown-apps~ to improve how accurate this is on your system. + +By default, when markdown is detected, ~markdown-mode~ is used. It is possible to +instead use pandoc to convert the content to Org (and export to markdown when +closing the frame) by setting ~emacs-everywhere-major-mode-function~ to +=#'org-mode=. + +Most other behaviour is implemented as hooks on ~emacs-everywhere-init-hooks~. diff --git a/modules/app/everywhere/cli.el b/modules/app/everywhere/cli.el new file mode 100644 index 000000000..819fdf4d3 --- /dev/null +++ b/modules/app/everywhere/cli.el @@ -0,0 +1,5 @@ +;;; app/everywhere/cli.el -*- lexical-binding: t; -*- + +(defcli! everywhere () + "Spawn an emacsclient window for quick edits." + (throw 'exit (list "emacsclient" "--eval" "(emacs-everywhere)"))) diff --git a/modules/app/everywhere/config.el b/modules/app/everywhere/config.el new file mode 100644 index 000000000..cfd7ecd9d --- /dev/null +++ b/modules/app/everywhere/config.el @@ -0,0 +1,30 @@ +;;; app/everywhere/config.el -*- lexical-binding: t; -*- + +(use-package! emacs-everywhere + :defer ; entry point is autoloaded + :config + (after! doom-modeline + (doom-modeline-def-segment emacs-everywhere + (concat (doom-modeline-spc) + (when (emacs-everywhere-markdown-p) + (concat + (all-the-icons-octicon "markdown" :face 'all-the-icons-green :v-adjust 0.02) + (doom-modeline-spc))) + (propertize emacs-everywhere-app-name + 'face 'doom-modeline-project-dir) + (doom-modeline-spc) + (propertize (truncate-string-to-width emacs-everywhere-window-title + 45 nil nil "…") + 'face 'doom-modeline-buffer-minor-mode))) + (doom-modeline-def-modeline 'emacs-everywhere + '(bar modals emacs-everywhere buffer-position word-count parrot selection-info) + '(input-method major-mode checker)) + (defun emacs-everywhere-set-modeline () + (doom-modeline-set-modeline 'emacs-everywhere)) + (add-hook 'emacs-everywhere-init-hooks #'emacs-everywhere-set-modeline)) + (when (featurep! :ui workspaces) + (defun emacs-everywhere-clear-persp-info () + (setq persp-emacsclient-init-frame-behaviour-override nil)) + (add-hook 'emacs-everywhere-init-hooks #'emacs-everywhere-clear-persp-info)) + (after! solaire-mode + (add-hook 'emacs-everywhere-init-hooks #'solaire-mode))) diff --git a/modules/app/everywhere/doctor.el b/modules/app/everywhere/doctor.el new file mode 100644 index 000000000..8e7223710 --- /dev/null +++ b/modules/app/everywhere/doctor.el @@ -0,0 +1,12 @@ +;;; app/everywhere/doctor.el -*- lexical-binding: t; -*- + +(when IS-WINDOWS + (error! "emacs-everywhere package does not support windows.")) + +(when IS-LINUX + (let (unmet-deps) + (dolist (dep '("xclip" "xdotool" "xprop" "xwininfo")) + (unless (executable-find dep) + (push dep unmet-deps))) + (when unmet-deps + (error! "Unmet dependencies: %s" (string-join unmet-deps ", "))))) diff --git a/modules/app/everywhere/packages.el b/modules/app/everywhere/packages.el new file mode 100644 index 000000000..7aee6df26 --- /dev/null +++ b/modules/app/everywhere/packages.el @@ -0,0 +1,6 @@ +;; -*- no-byte-compile: t; -*- +;;; app/everywhere/packages.el + +(package! emacs-everywhere + :recipe (:host github :repo "tecosaur/emacs-everywhere") + :pin "d84b397c9a82c2fea1b0c87740c395a2c7af3be8")