emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: idea for capture anywhere in x


From: Max Nikulin
Subject: Re: idea for capture anywhere in x
Date: Mon, 13 Jun 2022 14:46:37 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 10/06/2022 09:35, Samuel Wales wrote:
with the org capture firefox extension broken, i recalled this old
thread, thinking it might be a fix,  and i think i understand the
issue.  so i thought i would summarize here in this one post.

Samuel, have you managed to fix org-protocol setup? From other messages I am almost sure that the issue is not with the firefox add-on.

Anyway in this thread people suggested to use `org-capture' directly, so it may be a workaround for a while

    emacsclient --eval '(org-capture nil "c")'

You can add such command to your fluxbox menu. I have the following template:

     ("c" "Clipboard" entry
      (file "")
      "* %?%(org-get-x-clipboard 'CLIPBOARD)
" :empty-lines 1)

I do not remember why "%c" and "%x" substitutions did not work for me, perhaps too old org system package. 'PRIMARY should be even more convenient.

otoh, if there is such a thing as "a cli command that will ask firefox
for its current url" then it is possible.

It was you who found https://github.com/bitspook/spookfox I never tried it, but I do not see any way to fetch something from firefox besides this kind of extensions (KDE plasma integration or https://github.com/osnr/TabFS).

You can copy URL to clipboard, just select text and obtain both PRIMARY and CLIPBOARD from an org-capture template.

An idea for any application accordingly to the subject. It is possible to obtain window title, something like

 xdotool getactivewindow getwindowname

(untested), or more low level

    xprop -id "$(
        xprop -root -f _NET_ACTIVE_WINDOW 0x '=$0' _NET_ACTIVE_WINDOW |
        cut -f 2- -d =
    )" -f _NET_WM_NAME 8s '=$0' _NET_WM_NAME |
    cut -f 2- -d =

Finally a bonus for those who read mails till the end of the message. I have figured out how to get org markup from selection in firefox, libreoffice writer, etc. Unsure if such approach has some security issues, I never tried to evaluate to which degree pandoc is safe. It can be called from emacs to insert output into the current buffer or "| xclip -in" may be appended to replace selection buffer. More accurate script can check
"xclip -out -target TARGETS" for presence of "text/html" string

#!/bin/bash
set -o pipefail
selection=primary
xclip -selection "$selection" -out -target text/html 2>/dev/null |
     pandoc --from=html --to=org - ||
     xclip -selection "$selection" -out




reply via email to

[Prev in Thread] Current Thread [Next in Thread]