From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CBmTMmK0K2L/AgEAgWs5BA (envelope-from ) for ; Fri, 11 Mar 2022 21:43:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cDtXL2K0K2JdiQAAauVa8A (envelope-from ) for ; Fri, 11 Mar 2022 21:43:14 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E6A831D440 for ; Fri, 11 Mar 2022 21:43:13 +0100 (CET) Received: from localhost ([::1]:49106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nSm6R-0005EA-OC for larch@yhetil.org; Fri, 11 Mar 2022 15:43:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSm63-0005Dy-BZ for emacs-orgmode@gnu.org; Fri, 11 Mar 2022 15:42:47 -0500 Received: from mail.wmeyer.eu ([95.216.196.112]:36180) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nSm60-0000wm-Rx for emacs-orgmode@gnu.org; Fri, 11 Mar 2022 15:42:46 -0500 References: <20220310193517.ofifkwv2bmhmqpad@not-a-pinebook> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wmeyer.eu; s=mail; t=1647031360; bh=btvXIWN4sJJIdNBdnLC8mU4uPr56T6mUcroO9Ti4znY=; h=References:From:To:Subject:Date:In-reply-to; b=IDpINj4qScDEaFoMdr0M2HhDcBG0fuwYEh7R5r8m3GrdEetnfGa47y30kd1YG79TE lAM3/kLBjjx3QRfH52vlDFhN0qoji5n8CMaFo4IM+xIBtTPKIc6NaC9FtHwWVajT8S WEYbcZcgWt4wx3gGBgYKMljQA/5uBfBb64eTFcww= From: "Wilko Meyer" To: emacs-orgmode@gnu.org Subject: Re: [PATCH] org-protocol.org: updated Linux setup (Gnome) section Date: Fri, 11 Mar 2022 20:37:26 +0100 In-reply-to: Message-ID: <87mthwrzk0.fsf@wmeyer.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=95.216.196.112; envelope-from=w@wmeyer.eu; helo=mail.wmeyer.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647031394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=s6hmVSL0z9SicYoJnCZF+cbHJw6Kog3vPBGZUe5UuZU=; b=OeNQNvPy/5jSWfce5EcEsvRQQGekChw/NP4vRsTBkcUhzpDntTCaGdBA9yTisEFlThcgx/ KUIUu9A5nnMb1w6asXqLfvFWKNaZL1+GCRDagsOiNa11Wt+PQfXFfM4AEA7VcJq0KB8tGw iMKusuvM43J3wkSYCKzy/dojTz/IX+HxGRAxPvcsBNRMrnINSA6lJAfFp3HnZE7X2DP0sJ ud8lGTRFow92Ww5k3iZbFJL4Bjm4FIszxbvllY7hM9WeH38JnQajDJqIJiZjXwQnsZ+C8D EaQXVXKyzFNUZYm4jtY/90YKHu469Xv/bD4bSBbnNta4CD8FjDZwDvi/rldjNw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647031394; a=rsa-sha256; cv=none; b=Qi65K71Flj15XfInO5j9SHxA7/k6vLthFkl3HPTBb2H8vLRXHXWZvDRdFsxFwwYB43DBTG YFz7YXHRnwIzmjuGE2lnlBir9nAUS/n8cFiJy4YqYV20jD/Wki0nnlospqFOLO0CXJNoLn fE+BvGaLRH0ZyXuRCg5uCLODMiALLXumsIpm6mX97YHdMTmf1ovWdmVC4JNLfbASorIU9p mDU2du0jJChk4pdzgWtxaRHX1dH7whqNwxso7UTrGlfHyBm0zteFgoVRnfXW2Jd3eK8gbk N0F/7q0eTKlI2Uxl/udg6NE4pqYeoyPsrda7yidjPLlCAuQwMBo9XFK0GUUlug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=wmeyer.eu header.s=mail header.b=IDpINj4q; dmarc=pass (policy=none) header.from=wmeyer.eu; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -9.19 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=wmeyer.eu header.s=mail header.b=IDpINj4q; dmarc=pass (policy=none) header.from=wmeyer.eu; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: E6A831D440 X-Spam-Score: -9.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: j4ml+pcebjm4 --=-=-= Content-Type: text/plain Thanks for reviewing my patch and adding remarks! I'll attach an updated version of my patch to this mail based on these. > It seems, the approach with the .desktop file works for KDE as well > and even for minimal setup with simple window manager (no real desktop > environment). What do you think concerning marking existing sections > obsolete and adding new universal one for GNU/Linux? As the XDG Desktop Entry Specification should be a de facto standard by now, adding a new universal GNU/Linux section seems to be a good idea. It should work with KDE and other DEs as well (though I have only tested Mate and Gnome 3 so far). > Since the entry may appear in UI (menu) I would consider adding > "Comment" field as well to make it self-descriptive. For the same > reason I would add "Icon=emacs" (it is unlikely that Org Mode icons > are available in the system in all necessary sizes). I am unsure if > "GenericName" and "Keywords" should be defined and what they may contain. > > For additional security I would add "--" separator to avoid treating > passed argument as an option: > > Exec=emacsclient -- %u > These are excellent points. I second that it'll be a good approach to set expected defaults (such as Icon, Comment, and alike). GenericName is not required per specification, neither are Keywords. Keywords seem to be KDE-specific, as it is stated in the Desktop Entry Specification that those may be prefixed with X-KDE- in future versions. > I can not suggest a better category, e.g. Utility is hardly better > that System, but it is not really a system application as well. Having considered this I'd advocate to use the "Other" category here. Utility or System would make sense as well, but as users most likely won't interact with said .desktop entry via their application menu, it probably would be beneficial to put it in a more generic place. > Looking into > http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/emacsclient.desktop > I noticed > > StartupWMClass=Emacs > > that might give a hint when a new window is created. Yes, the startup notification spec says: > StartupWMClass=STRING > If true, it is KNOWN that the application will map at least one > window with the given string as its WM class or WM name hint. > When I was setting org-protocol for the first time, I experienced > various problems. I have seen various recipes, so I think it may be > helpful to explicitly state that such commands are obsolete instead of > removing them completely. The intention is to make users aware that > such approach should not be tried even if they notice it on some other > web site. I do not insist though. I added a sentence stating that formerly mentioned commands may be seen as obsolote. I'd appreciate feedback/suggestions on how to phrase this exactly, as I'm not sure if my wording fits. > Side note: I believe, currently the best setup guide is > https://github.com/sprig/org-capture-extension/ Agreed. Something I'm unsure of is, wether using the update-desktop-database command can be seen as universal. It is part of the package desktop-file-utils in arch linux (emacs has it as a dependency, so it'll be installed anyways) but I cannot see KDE/plasma depending on it. I have verified it to be working in a Mate DE, but wasn't able to verify it using KDE yet. The org-capture guide uses a different approach than update-desktop-database, so this is something which should be verified. > A note unrelated to your patch. With simple "emacsclient %u" handler a > problem may happen when a browser is started from command line instead > of clicking on the icon or from menu. If emacs has no frames then it > may create a new one in the terminal instead of opening a graphical > window (Emacs frame). Have you managed to adjust emacs server or > general buffer settings to ensure new graphical frame (on the same > virtual desktop) in such cases? I haven't put much thought into this yet. I ran a quick test by starting firefox from command line and tried bookmarking a random page via org-capture. Besides having emacsclient printing some output to STDOUT I haven't experienced an issues, as the capture frame has been opened in my running emacs instance. I'll look into this further over this weekend. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-protocol.org-updated-GNU-Linux-setup-section.patch Content-Description: [PATCH] org-protocol.org >From 26d34283506cda58ca3e93457ca0d228c40ab3b0 Mon Sep 17 00:00:00 2001 From: Wilko Meyer Date: Thu, 11 Mar 2022 21:30:45 +0100 Subject: [PATCH] org-protocol.org: updated GNU/Linux setup section --- org-contrib/org-protocol.org | 56 +++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/org-contrib/org-protocol.org b/org-contrib/org-protocol.org index 57cab17f..935366f7 100644 --- a/org-contrib/org-protocol.org +++ b/org-contrib/org-protocol.org @@ -80,41 +80,43 @@ actions. Just register your custom sub-protocol and handler with the variable * Browser / system setup - - [[Linux setup (Gnome)]] - - [[Linux setup (KDE)]] + - [[GNU/Linux setup]] - [[Windows setup]] - [[Mac OS X setup]] - [[*Applications][Applications]] - [[*Verify the installation][Verify the installation]] -*** Linux setup (Gnome) - - For this to work, you'll need the Gnome-Libraries to be installed. - - : gconftool-2 -s /desktop/gnome/url-handlers/org-protocol/command '/usr/local/bin/emacsclient %s' --type String - : gconftool-2 -s /desktop/gnome/url-handlers/org-protocol/enabled --type Boolean true - -*** Linux setup (KDE) - - Add a file =org.protocol= to =~/.kde/share/kde4/services/=: - - #+begin_example - # -*- conf -*- - [Protocol] - protocol=org-protocol - exec=/usr/bin/emacsclient '%u' - input=none - output=none - helper=true - listing= - reading=false - writing=false - makedir=false - deleting=false +*** GNU/Linux setup + + Most more common desktop environments (Gnome, KDE et al) comply with the [[https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html][XDG Desktop Entry Specification]]. + This means setting up =emacsclient= as the =org-protocol= handler using a .desktop file can be regarded + as a, in most cases, standard way to set this up in most common desktop environments. + + Some environments, e.g. Gnome as of Gnome 3, have deprecated other configuration methods, + e.g. =gconftool-2= to set-up protocol handling. + + Create a =org-protocol.desktop= file either in =~/.local/share/applications/= to set-up =emacsclient= as the + =org-protocol= handler for the current user or in =/usr/share/applications= to set-up a system-wide + configuration: + + #+begin_example + [Desktop Entry] + Name=org-protocol + Comment= Intercept calls from emacsclient to trigger custom actions + Categories=Other; + Keywords=org-protocol; Icon=emacs - Description=A protocol for org-mode + Type=Application + Exec=emacsclient -- %u + Terminal=false + StartupWMClass=Emacs + MimeType=x-scheme-handler/org-protocol; #+end_example + Update the cache database of MIME types handled by desktop files via: + + : update-desktop-database ~/.local/share/applications/ + *** Windows setup Windows users may register the "=org-protocol=" once for all by adjusting the -- 2.35.1 --=-=-=--