[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#74781: [PATCH] Add `browse-url-qutebrowser'
From: |
Robert Pluim |
Subject: |
bug#74781: [PATCH] Add `browse-url-qutebrowser' |
Date: |
Wed, 11 Dec 2024 09:27:48 +0100 |
>>>>> On Wed, 11 Dec 2024 08:04:29 +0100, Daniel Mendler via "Bug reports for
>>>>> GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>>>> said:
Daniel> +(defcustom browse-url-qutebrowser-program "qutebrowser"
Daniel> + "The name by which to invoke Qutebrowser."
Daniel> + :type 'string)
Daniel> +
Daniel> +(defcustom browse-url-qutebrowser-arguments nil
Daniel> + "A list of strings to pass to Qutebrowser when it starts up."
Daniel> + :type '(repeat (string :tag "Argument")))
Daniel> +
:version tags please
Daniel> (defcustom browse-url-webpositive-program "WebPositive"
Daniel> "The name by which to invoke WebPositive."
Daniel> :type 'string
Daniel> @@ -387,6 +395,12 @@ browse-url-epiphany-new-window-is-tab
Daniel> `browse-url-epiphany' is asked to open it in a new window."
Daniel> :type 'boolean)
Daniel> +(defcustom browse-url-qutebrowser-new-window-is-tab nil
Daniel> + "Whether to open up new windows in a tab or a new window.
Daniel> +If non-nil, then open the URL in a new tab rather than a new
window if
Daniel> +`browse-url-qutebrowser' is asked to open it in a new window."
Daniel> + :type 'boolean)
Daniel> +
And here
Daniel> (defcustom browse-url-new-window-flag nil
Daniel> "Non-nil means always open a new browser window with appropriate
browsers.
Daniel> Passing an interactive argument to \\[browse-url], or specific
browser
Daniel> @@ -1294,6 +1308,60 @@ browse-url-epiphany-sentinel
Daniel> browse-url-epiphany-program
Daniel> (append browse-url-epiphany-startup-arguments (list
url))))))
Daniel> +(defun browse-url-qutebrowser-send (cmd)
Daniel> + "Send CMD to Qutebrowser via IPC."
Daniel> + (let* ((dir (getenv "XDG_RUNTIME_DIR"))
We have `xdg-runtime-dir' in xdg.el
Daniel> + (sock (and dir (expand-file-name
Daniel> + (format "qutebrowser/ipc-%s" (md5
(user-login-name)))
Daniel> + dir))))
Daniel> + (unless (file-exists-p sock)
Daniel> + (error "No Qutebrowser IPC socket found"))
Daniel> + (let ((proc
Daniel> + (make-network-process
Daniel> + :name "qutebrowser"
Daniel> + :family 'local
Daniel> + :service sock
Daniel> + :coding 'utf-8)))
Daniel> + (unwind-protect
Daniel> + (process-send-string
Daniel> + proc
Daniel> + (concat
Daniel> + (json-serialize `( :args [,cmd]
Daniel> + :target_arg :null
Daniel> + :protocol_version 1))
Daniel> + "\n"))
Daniel> + (delete-process proc)))))
Daniel> +
Perhaps Iʼm being paranoid, but maybe you should check the status of
`proc' before sending it a string.
Robert
--
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Daniel Mendler, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser',
Robert Pluim <=
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Daniel Mendler, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Robert Pluim, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Daniel Mendler, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Björn Bidar, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Daniel Mendler, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Eli Zaretskii, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Eli Zaretskii, 2024/12/11
- bug#74781: [PATCH] Add `browse-url-qutebrowser', Daniel Mendler, 2024/12/11
bug#74781: [PATCH] Add `browse-url-qutebrowser', Eli Zaretskii, 2024/12/11