]> jfr.im git - irc/weechat/scripts.git/commitdiff
urlgrab.py 3.2: Use xdg-open as default local command
authorMarco Trevisan <redacted>
Thu, 15 Dec 2022 15:08:41 +0000 (16:08 +0100)
committerSébastien Helleu <redacted>
Sat, 17 Dec 2022 10:44:12 +0000 (11:44 +0100)
It will automatically open the URI in the default browser for the system,
without having users to change it to their browser.

python/urlgrab.py

index 6030fc1dbbf7e873a0b293c6b37555e10436bb66..58938843f2809a0702893657528a0e786aaa4a62 100644 (file)
@@ -39,7 +39,7 @@
 #   localcmd
 #     The command to run on the local host to launch URLs in 'local' mode.
 #     The string '%s' will be replaced with the URL.  The default is
-#     'firefox %s'.
+#     'xdg-open %s'.
 #
 #   remotessh
 #     The command (and arguments) used to connect to the remote host for
@@ -53,9 +53,9 @@
 #
 #   remotecmd
 #     The command to execute on the remote host for 'remote' mode.  The
-#     default is 'bash -c "DISPLAY=:0.0 firefox '%s'"'  Which runs bash, sets
+#     default is 'bash -c "DISPLAY=:0.0 xdg-open '%s'"'  Which runs bash, sets
 #     up the environment to display on the remote host's main X display,
-#     and runs firefox.  As with 'localcmd', the string '%s' will be
+#     and runs the default browser.  As with 'localcmd', the string '%s' will be
 #     replaced with the URL.
 #
 #   cmdoutput
 #           - Fix python 3 compatibility (replace "has_key" by "in")
 #  - V3.1 Ron Alleva <ron.alleva@gmail.com>:
 #           - Add 'use_full_name' setting, to allow storing URLs by full name of buffer
+#  - V3.2 Marco Trevisan <mail@3v1n0.net>:
+#           - Use xdg-open as default 'localcmd'
 #
 # Copyright (C) 2005 David Rubin <drubin AT smartcube dot co dot za>
 #
@@ -185,7 +187,7 @@ urlRe = re.compile(r'(\w+://(?:%s|%s)(?::\d+)?(?:/[^\]>\s]*)?)' % (domain, ipAdd
 
 SCRIPT_NAME    = "urlgrab"
 SCRIPT_AUTHOR  = "David Rubin <drubin [At] smartcube [dot] co [dot] za>"
-SCRIPT_VERSION = "3.1"
+SCRIPT_VERSION = "3.2"
 SCRIPT_LICENSE = "GPL"
 SCRIPT_DESC    = "Url functionality Loggin, opening of browser, selectable links"
 CONFIG_FILE_NAME= "urlgrab"
@@ -300,9 +302,9 @@ class UrlGrabSettings(UserDict):
         self.data['localcmd']=weechat.config_new_option(
             self.config_file, section_default,
             "localcmd", "string", """Local command to execute""", "", 0, 0,
-            "firefox '%s'", "firefox '%s'", 0, "", "", "", "", "", "")
+            "xdg-open '%s'", "xdg-open '%s'", 0, "", "", "", "", "", "")
 
-        remotecmd="ssh -x localhost -i ~/.ssh/id_rsa -C \"export DISPLAY=\":0.0\" &&  firefox '%s'\""
+        remotecmd="ssh -x localhost -i ~/.ssh/id_rsa -C \"export DISPLAY=\":0.0\" && xdg-open '%s'\""
         self.data['remotecmd']=weechat.config_new_option(
             self.config_file, section_default,
             "remotecmd", "string", remotecmd, "", 0, 0,