bug#46704: X clipboard is always empty with emacs server without emacsclient running

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#46704: X clipboard is always empty with emacs server without emacsclient running

Parvesh Monu

I have this template which captures clipboard content in file. It works fine when emacsclient is running, but if no client is running then server adds empty entry.

(add-to-list 'org-capture-templates
       '("x" "Clips" entry (file+headline "/home/user/desktop/clips" "Clips")
         "** %x" :immediate-finish t :prepend t))


System: 5.10.16-arch1-1
Desktop Environment: xfce
GNU Emacs 27.1

Reply | Threaded
Open this post in threaded view
|

bug#46704: X clipboard is always empty with emacs server without emacsclient running

Lars Ingebrigtsen
Parvesh Monu <[hidden email]> writes:

> I have this template which captures clipboard content in file. It works fine when
> emacsclient is running, but if no client is running then server adds empty entry.
>
> (add-to-list 'org-capture-templates
>        '("x" "Clips" entry (file+headline "/home/user/desktop/clips" "Clips")
>          "** %x" :immediate-finish t :prepend t))

I'm not quite sure I understand you correctly here -- but I think you're
saying that if you start "emacs --daemon", then that daemonised Emacs
can't communicate with the X clipboard?

I'm not sure, but doesn't that sound quite natural?  If you don't have
an X window open, then you can't talk to the X server, so you can't
access the clipboard, either.

I don't know how Org is talking to the clipboard, though.  Anybody?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#46704: X clipboard is always empty with emacs server without emacsclient running

Parvesh Monu
I don't know if it will help, but I found workaround to capture X-clipboard.

Since %x doesn't work with daemon, I used %i and passed X-clipboard's content using xsel. Like,

xdg-open "org-protocol://capture?template=h&body=`xsel`"

On Mon, Feb 22, 2021, 8:25 PM Lars Ingebrigtsen <[hidden email]> wrote:
Parvesh Monu <[hidden email]> writes:

> I have this template which captures clipboard content in file. It works fine when
> emacsclient is running, but if no client is running then server adds empty entry.
>
> (add-to-list 'org-capture-templates
>        '("x" "Clips" entry (file+headline "/home/user/desktop/clips" "Clips")
>          "** %x" :immediate-finish t :prepend t))

I'm not quite sure I understand you correctly here -- but I think you're
saying that if you start "emacs --daemon", then that daemonised Emacs
can't communicate with the X clipboard?

I'm not sure, but doesn't that sound quite natural?  If you don't have
an X window open, then you can't talk to the X server, so you can't
access the clipboard, either.

I don't know how Org is talking to the clipboard, though.  Anybody?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no