Re: Debugging firefox extension (Re: idea for capture anywhere in x)
On 17/11/2022 10:16, Samuel Wales wrote: On 11/16/22, Max Nikulin wrote: Since recently we were discussing desktop notifications and temporary rising emacs window, I am unsure if capture indication is related to the firefox extension, notification daemon, or emacs. my brain is not connecting the first part of your sentence with the second part [this has to do with my brain, not your english], I was writing about notify-send (or d-bus function) called in the case of successful capture and notification-daemon or dunst: Samuel Wales. Re: desktop notifications (Re: idea for capture anywhere in x) Wed, 26 Oct 2022 01:07:18 -0700. https://list.orgmode.org/CAJcAo8sp3dyUT0b8=3T1YeiQZzmDYS9Zah_6+LdczWHicnVX=w...@mail.gmail.com I am unsure if your managed to add such feature to your configuration. but i have been assuming that it is the firefox org-capture extension saying "i sent the request". Check browser console for warnings and try to call emacsclient with some org-protocol: URI from xterm or another terminal application (I would avoid Emacs shell buffers for such tests). pop up emacs frame for a fraction of a second, which then, in elisp, pops back down again. To raise and lower an existing window perhaps something like wmctrl, xdotool or fluxbox-remote should be used. Remaining withing Emacs I would consider temporary creating a new frame and dismissing it. I am unsure concerning focus stealing protection in window managers that may hide such window. A simple command that might be a substitute to notification windows: zenity --timeout 1 --info --title 'Title' --text 'Text' There are a number of dialog tools similar to zenity: lightweight or integrated with desktop environments. I have no idea which one you may have installed and if it has timeout feature or sleep workaround should be used instead. However I believe that not running some notification daemon may cause problems with various application. More robust approach is a native messaging application that is a bridge between sandboxed firefox extension and emacs. It makes setup more complicated however and no simple org-protocol extensions use this approach. not sure i understand what native or sandboxed mean here or why, and whether org-protocol is needed or if you are saying that there might be a non-simple-to-install extension for it or so. Browsers create sandboxes for web pages and extensions to isolate them from host system. There is an API that allows communication of an add-on with particular helper application running on host system: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging A dedicated naive messaging helper allows to check emacsclient exit code or stdout. The price is more complicated configuration. Of course, an extension should support such communication protocol.
Re: Debugging firefox extension (Re: idea for capture anywhere in x)
* Samuel Wales [2022-11-17 06:19]: > in other words, you click unicorn, it does some org-protocol call, and > then it flashes that nice but misleading message. That is why I am using Emacs to tell me audibly that bookmark was recorded. Forgive me for not using really Org to record what org-protocol extension does, but this example may help people by principle to people to get better notification: (defun hyperscope-org-protocol-store-link (query) (if (hyperscope-user-www-set) (let* ((splitparts (org-protocol-parse-parameters query t)) (uri (org-protocol-sanitize-uri (plist-get splitparts :url))) (title (plist-get splitparts :title)) (hlink-exist (hyperscope-link-exists-p uri 2))) (if hlink-exist (progn (rcd-warning-message "Link: %s already exists." uri) (rcd-speak "Link exists already") nil) (let* ((parent (hyperscope-user-www-set)) (id (hyperscope-add-generic title uri nil 2 nil parent))) (if id (progn (message "Added Hyperlink: %s to Hyperscope ID: %s" title id) (hyperscope-update-tokens id) (rcd-speak "Done") ;; speaking "Done" on my loud speaker tells me it was ;; made well nil) (progn (message "Could not insert: %s" query) (rcd-speak "Did not work") nil) (rcd-warning-message "Define WWW set for user `%s' in table `usersdefaults'" (rcd-db-current-user -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/
Re: Debugging firefox extension (Re: idea for capture anywhere in x)
more below. On 11/16/22, Max Nikulin wrote: > Since recently we were discussing desktop notifications and temporary > rising emacs window, I am unsure if capture indication is related to the > firefox extension, notification daemon, or emacs. my brain is not connecting the first part of your sentence with the second part [this has to do with my brain, not your english], but i have been assuming that it is the firefox org-capture extension saying "i sent the request". in other words, you click unicorn, it does some org-protocol call, and then it flashes that nice but misleading message. misleading because it only indicates sending, not [desirable] emacs receipt or [perhaps overkill?] emacs handling. > >> this is with or without selecting any text. >> >> could a kind soul remind me how to debug this again? > > Max Nikulin. Re: org-capture firefox extension broken [silently] Sat, 11 > Jun 2022 09:30:11 +0700. > https://list.orgmode.org/t80unm$7ud$1...@ciao.gmane.io and the earlier > message https://list.orgmode.org/t7vdnm$ddo$1...@ciao.gmane.io oh /very nice/ thanks. it is going to take me a long time to digest that but i want to start with trying "have you"'s. > > Launching org-protocol handler from browser is unreliable, there is > almost no way to detect an error. One indirect technique relies on > switching focus from firefox to another application, but it is not > applicable for your workflow. do you mean like popping up emacs frame? which would indeed undesirably require me to move ff to front again? but would at least prove that the capture worked as i can inspect the new subentry in my xyzzy-remember entry? at this point, ff capture is so needed for me that i'd consider something like the following: pop up emacs frame for a fraction of a second, which then, in elisp, pops back down again. it might be possible to make it tolerabie [visual overstimulation, cognitive burden] if the frame is full screen on width but only a few lines on height. i would have to try it to be sure but it seems worth trying. however, idk if it is possible in elisp. i think i can maybe figure out the frame dimensions part if there is a place to put it in capture template. > > More robust approach is a native messaging application that is a bridge > between sandboxed firefox extension and emacs. It makes setup more > complicated however and no simple org-protocol extensions use this > approach. not sure i understand what native or sandboxed mean here or why, and whether org-protocol is needed or if you are saying that there might be a non-simple-to-install extension for it or so. > > > > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com
Debugging firefox extension (Re: idea for capture anywhere in x)
On 16/11/2022 11:03, Samuel Wales wrote: right now, it seems org-capture is broken for me again. clicking on unicorn results in the momentary captured indication in huge text on the screen [i like this indicator], but it does not get captured to my org capture target. Since recently we were discussing desktop notifications and temporary rising emacs window, I am unsure if capture indication is related to the firefox extension, notification daemon, or emacs. this is with or without selecting any text. could a kind soul remind me how to debug this again? Max Nikulin. Re: org-capture firefox extension broken [silently] Sat, 11 Jun 2022 09:30:11 +0700. https://list.orgmode.org/t80unm$7ud$1...@ciao.gmane.io and the earlier message https://list.orgmode.org/t7vdnm$ddo$1...@ciao.gmane.io Launching org-protocol handler from browser is unreliable, there is almost no way to detect an error. One indirect technique relies on switching focus from firefox to another application, but it is not applicable for your workflow. More robust approach is a native messaging application that is a bridge between sandboxed firefox extension and emacs. It makes setup more complicated however and no simple org-protocol extensions use this approach.