A small script to switch between browser tabs.

  • Done
  • quality assurance status badge
Details
One participant
  • Nicolas Graves
Owner
unassigned
Submitted by
Nicolas Graves
Severity
normal
N
N
Nicolas Graves wrote on 29 Sep 2022 21:48
(address . guix-patches@gnu.org)
87edvuynaw.fsf@ngraves.fr
Hi!

4 patches to send a small rofi script to switch between chromium-based
browser tabs.

There are node packages in it and i didn't take care of packaging all
development dependencies (node bootstrapping).

The script should also work in firefox based browsers soon.

--
Best regards,
Nicolas Graves
N
N
Nicolas Graves wrote on 29 Sep 2022 21:52
[PATCH 1/4] gnu: Add node-ws.
(address . 58179@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20220929195227.11018-1-ngraves@ngraves.fr
* gnu/packages/node-xyz.scm (node-ws): New variable.
---
gnu/packages/node-xyz.scm | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

Toggle diff (42 lines)
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b14b407e19..4c92e07537 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1512,6 +1512,35 @@ (define-public node-serialport
projects. It combines a high-level Node.js stream interface with a useful
default set of parsers and bindings.")))
+(define-public node-ws
+ (package
+ (name "node-ws")
+ (version "8.8.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/websockets/ws")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1nwig6rxakd72nr1sbcl7qqwab3w5116s7dcblnz45fslf9lql8i"))))
+ (build-system node-build-system)
+ (arguments
+ '(#:tests? #f
+ #:phases (modify-phases %standard-phases
+ (replace 'configure
+ (lambda _
+ (invoke "npm" "--offline" "--ignore-scripts" "install"
+ "--production"))))))
+ (home-page "https://github.com/websockets/ws")
+ (synopsis "Websocket client and server for Node.js")
+ (description "This package provides a simple websocket client and server
+for Node.js. It doesn't work in a browser. It can send and receive data,
+authenticate clients, broadwast to other websocket clients, use external
+APIs...")
+ (license license:expat)))
+
(define-public node-yazl
(package
(name "node-yazl")
--
2.37.3
N
N
Nicolas Graves wrote on 29 Sep 2022 21:52
[PATCH 2/4] gnu: Add node-commander.
(address . 58179@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20220929195227.11018-2-ngraves@ngraves.fr
* gnu/packages/node-xyz.scm (node-commander): New variable.
---
gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

Toggle diff (41 lines)
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4c92e07537..c14ff7f421 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -106,6 +106,34 @@ (define-public node-color-name
"This package provides a JSON list with color names and their values.")
(license license:expat)))
+(define-public node-commander
+ (package
+ (name "node-commander")
+ (version "9.3.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tj/commander.js")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1yvm0qjirxxdrf7dng0h770n8abz83ymzv4r0wa8ww5x2l2xzsvz"))))
+ (build-system node-build-system)
+ (arguments
+ '(#:tests? #f
+ #:phases (modify-phases %standard-phases
+ (replace 'configure
+ (lambda _
+ (invoke "npm" "--offline" "--ignore-scripts" "install"
+ "--production"))))))
+ (home-page "https://github.com/tj/commander.js")
+ (synopsis "Complete solution for Node.js command-line interfaces")
+ (description "This package can parse arguments into options and
+command-arguments, disaply usage errors for problems, and implements a help
+system.")
+ (license license:expat)))
+
(define-public node-crx3
(package
(name "node-crx3")
--
2.37.3
N
N
Nicolas Graves wrote on 29 Sep 2022 21:52
[PATCH 3/4] gnu: Add node-chrome-remote-interface.
(address . 58179@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20220929195227.11018-3-ngraves@ngraves.fr
* gnu/packages/node-xyz.scm (node-chrome-remote-interface): New variable.
---
gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)

Toggle diff (43 lines)
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c14ff7f421..8dd11333ef 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -85,6 +85,36 @@ (define-public node-buffer-crc32
and fancy character sets, signed or unsigned data and has tests, for Node.")
(license license:expat)))
+(define-public node-chrome-remote-interface
+ (package
+ (name "node-chrome-remote-interface")
+ (version "0.31.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cyrus-and/chrome-remote-interface")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0gbz8cj6s1mxvzaa9wpvdky2mcrdaz3ql552rkzzi6xlziqsrx69"))))
+ (build-system node-build-system)
+ (arguments
+ '(#:tests? #f
+ #:phases (modify-phases %standard-phases
+ (replace 'configure
+ (lambda _
+ (invoke "npm" "--offline" "--ignore-scripts" "install"
+ "--production"))))))
+ (inputs (list node-ws node-commander))
+ (home-page "https://github.com/cyrus-and/chrome-remote-interface")
+ (synopsis "Chrome Debugging Protocol interface")
+ (description "This package is a Chrome Debugging Protocol interface that
+helps to instrument Chrome (or any other suitable implementation) by providing
+a simple abstraction of commands and notifications using a straightforward
+JavaScript API.")
+ (license license:expat)))
+
(define-public node-color-name
(package
(name "node-color-name")
--
2.37.3
N
N
Nicolas Graves wrote on 29 Sep 2022 21:52
[PATCH 4/4] gnu: Add rofi-switch-browser-tabs/chromium.
(address . 58179@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20220929195227.11018-4-ngraves@ngraves.fr
* gnu/packages/xdisorg.scm (rofi-switch-browser-tabs/chromium): New variable.
---
gnu/packages/xdisorg.scm | 42 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)

Toggle diff (76 lines)
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 9908f29191..2fa12ba220 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -56,6 +56,7 @@
;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
;;; Copyright © 2022 Derek Chuank <derekchuank@outlook.com>
;;; Copyright © 2022 Wamm K. D. <jaft.r@outlook.com>
+;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -118,6 +119,7 @@ (define-module (gnu packages xdisorg)
#:use-module (gnu packages man)
#:use-module (gnu packages maths)
#:use-module (gnu packages ncurses)
+ #:use-module (gnu packages node-xyz)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
@@ -128,6 +130,7 @@ (define-module (gnu packages xdisorg)
#:use-module (gnu packages terminals)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
+ #:use-module (gnu packages web)
#:use-module (gnu packages)
#:use-module (ice-9 match))
@@ -1905,6 +1908,45 @@ (define-public rofi-calc
natural language input and provide results.")
(license license:expat)))
+(define-public rofi-switch-browser-tabs/chromium
+ (let* ((commit "788cce881ba8c3891175fbbe62b9c799aa47652b")
+ (revision "0"))
+ (package
+ (name "rofi-switch-browser-tabs-chromium")
+ (version (git-version "0.0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kevinmorio/rofi-switch-browser-tabs")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0m4vldx9k6wxx7s7zkkwbj11r7vckvdky8fypf73qzmgl0yn4vmi"))
+ ;; The firefox version is strongly outdated.
+ ;; Firefox and firefox-based browsers will soon (and partially do)
+ ;; support this feature using this same package.
+ ;; Not working for firefox v105.0
+ (modules '((guix build utils)))
+ (snippet '(delete-file-recursively "firefox-switch-tabs"))))
+ (build-system copy-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'chmod
+ (lambda _
+ (chmod "chrome-switch-tabs/chrome-switch-tabs" #o555))))
+ #:install-plan
+ (list '("chrome-switch-tabs/chrome-switch-tabs" "bin/"))))
+ (propagated-inputs (list jq node-chrome-remote-interface))
+ (home-page "https://github.com/kevinmorio/rofi-switch-browser-tabs")
+ (synopsis "Use rofi to switch between browser tabs")
+ (description "This packages provides a simple rofi mode to switch between
+tabs in Chromium-based browsers. It also has experimental support for
+firefox-based browsers. Once installed, simply run
+@code{rofi -modi 'chrome:chrome-switch-tabs' -show chrome}.")
+ (license license:expat))))
+
(define-public tint2
(package
(name "tint2")
--
2.37.3
N
N
Nicolas Graves wrote on 2 Oct 2022 21:16
[PATCH] gnu: Add rofi-switch-browser-tabs.
(address . 58179@debbugs.gnu.org)
87tu4mvxx6.fsf@ngraves.fr
* gnu/packages/xdisorg.scm (rofi-switch-browser-tabs): New variable.
---
gnu/packages/xdisorg.scm | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

Toggle diff (52 lines)
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 9908f29191..aa673ce84d 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -1905,6 +1905,38 @@ (define-public rofi-calc
natural language input and provide results.")
(license license:expat)))
+(define-public rofi-switch-browser-tabs
+ (let* ((commit "e1516cc2cb824fb9bdfe45680429e36d6e3789c5")
+ (revision "0"))
+ (package
+ (name "rofi-switch-browser-tabs")
+ (version (git-version "0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nicolas-graves/rofi-switch-browser-tabs")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "15r3ajf60vgirrlapqf10xlklmwpj4k39sii9ji6djm16anpqwsm"))))
+ (build-system copy-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'exe
+ (lambda _ (chmod "switch-browser-tabs" #o555))))
+ #:install-plan
+ (list '("switch-browser-tabs" "bin/"))))
+ (propagated-inputs (list wget jq))
+ (home-page "https://github.com/nicolas-graves/rofi-switch-browser-tabs")
+ (synopsis "Use rofi to switch between browser tabs")
+ (description "This packages provides a simple rofi mode to switch between
+tabs in Chromium-based browsers. Once installed, just run your browser with
+@code{--remote-debugging-port=9222} and use
+@code{rofi -modi 'switch-tabs:switch-browser-tabs' -show switch-tabs}.")
+ (license license:expat))))
+
(define-public tint2
(package
(name "tint2")
--
2.37.3


<#secure method=pgpmime mode=sign>

--
Best regards,
Nicolas Graves
N
N
Nicolas Graves wrote on 2 Oct 2022 21:22
(address . 58179@debbugs.gnu.org)
87r0zqvxmh.fsf@ngraves.fr
* gnu/packages/xdisorg.scm (rofi-switch-browser-tabs): New variable.
---
gnu/packages/xdisorg.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (59 lines)
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 9908f29191..e8c201f375 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -56,6 +56,7 @@
;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
;;; Copyright © 2022 Derek Chuank <derekchuank@outlook.com>
;;; Copyright © 2022 Wamm K. D. <jaft.r@outlook.com>
+;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -126,6 +127,7 @@ (define-module (gnu packages xdisorg)
#:use-module (gnu packages sphinx)
#:use-module (gnu packages tcl)
#:use-module (gnu packages terminals)
+ #:use-module (gnu packages wget)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
#:use-module (gnu packages)
@@ -1905,6 +1907,38 @@ (define-public rofi-calc
natural language input and provide results.")
(license license:expat)))

+(define-public rofi-switch-browser-tabs
+ (let* ((commit "e1516cc2cb824fb9bdfe45680429e36d6e3789c5")
+ (revision "0"))
+ (package
+ (name "rofi-switch-browser-tabs")
+ (version (git-version "0.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nicolas-graves/rofi-switch-browser-tabs")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "15r3ajf60vgirrlapqf10xlklmwpj4k39sii9ji6djm16anpqwsm"))))
+ (build-system copy-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-before 'install 'exe
+ (lambda _ (chmod "switch-browser-tabs" #o555))))
+ #:install-plan
+ (list '("switch-browser-tabs" "bin/"))))
+ (propagated-inputs (list wget jq))
+ (home-page "https://github.com/nicolas-graves/rofi-switch-browser-tabs")
+ (synopsis "Use rofi to switch between browser tabs")
+ (description "This packages provides a simple rofi mode to switch between
+tabs in Chromium-based browsers. Once installed, just run your browser with
+@code{--remote-debugging-port=9222} and use
+@code{rofi -modi 'switch-tabs:switch-browser-tabs' -show switch-tabs}.")
+ (license license:expat))))
+
(define-public tint2
(package
(name "tint2")
--
2.37.3

Sorry for the double send.
In a few words, I forked the project and made it work with minimal
changes without node-chrome-remote-interface. The first commits aren't
useful for this final package anymore, although they are correct and
could still be added if wanted.

--
Best regards,
Nicolas Graves
N
N
Nicolas Graves wrote on 15 Apr 08:06 +0200
control message for bug #58179
(address . control@debbugs.gnu.org)
87il0jp3bl.fsf@ngraves.fr
close 58179
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 58179@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 58179
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch