summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandria2020-12-25 11:00:49 -0800
committerAlexandria2020-12-25 11:00:49 -0800
commitb8d537ccdaef312a42c20c5240059a15f1b94e48 (patch)
treeaa2c8d16182a1ff81cd37e213d28713c377346d9
downloadaur-b8d537ccdaef312a42c20c5240059a15f1b94e48.tar.gz
first
-rw-r--r--.SRCINFO19
-rw-r--r--PKGBUILD33
-rw-r--r--counter.js37
-rw-r--r--icon.pngbin0 -> 118920 bytes
-rw-r--r--run.desktop8
5 files changed, 97 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..1393b1267e44
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = google-voice-nativefier
+ pkgdesc = Google Voice wrapped as a desktop application through Nativefier
+ pkgver = 1.0
+ pkgrel = 1
+ url = https://voice.google.com
+ arch = x86_64
+ license = MIT
+ makedepends = npm
+ makedepends = nodejs-nativefier
+ makedepends = nodejs
+ source = icon.png
+ source = run.desktop
+ source = counter.js
+ sha256sums = 44bd668b8f1e85909bb36ad6e464a95046854cb8c573e1343c03edebadc653cd
+ sha256sums = 60ea1946aab2c27dcef657afd6cadcf7f88415b4c0ecaaae9326f2ec6631451b
+ sha256sums = 8d0d2d0a9b2d59bac46d38ec4262f6b9979aed57d3d4f1d46fe91506d10b753b
+
+pkgname = google-voice-nativefier
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..600cfafa0c51
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Alexandria Pettit(alxpettit@gmail.com)
+pkgname='google-voice-nativefier'
+pkgbase=$pkgname
+pkgver=1.0
+pkgrel=1
+pkgdesc="Google Voice wrapped as a desktop application through Nativefier"
+arch=('x86_64')
+url=https://voice.google.com
+license=('MIT')
+makedepends=(npm nodejs-nativefier nodejs)
+source=('icon.png' 'run.desktop' 'counter.js')
+sha256sums=('44bd668b8f1e85909bb36ad6e464a95046854cb8c573e1343c03edebadc653cd'
+ '60ea1946aab2c27dcef657afd6cadcf7f88415b4c0ecaaae9326f2ec6631451b'
+ '8d0d2d0a9b2d59bac46d38ec4262f6b9979aed57d3d4f1d46fe91506d10b753b')
+
+appname=google-voice-desktop
+
+build() {
+ nativefier --name $appname \
+ --icon icon.png \
+ --user-agent "Mozilla/5.0 (Windows NT 10.0; rv:74.0) Gecko/20100101 Firefox/74.0" \
+ --counter --inject counter.js "https://voice.google.com/"
+}
+
+package() {
+ install -d "$pkgdir"/opt "$pkgdir"/usr/{bin,share/pixmaps}
+ install -Dm644 run.desktop "$pkgdir"/usr/share/applications/$appname.desktop
+
+ cp -rL $appname-linux-* "$pkgdir"/opt/$pkgname
+ ln -sf /opt/$pkgname/$appname "$pkgdir"/usr/bin/$appname
+ ln -sf /opt/$pkgname/resources/app/icon.png "$pkgdir"/usr/share/pixmaps/$appname.png
+ chmod 644 "$pkgdir"/opt/$pkgname/resources/app/nativefier.json
+}
diff --git a/counter.js b/counter.js
new file mode 100644
index 000000000000..ea4bea87fdec
--- /dev/null
+++ b/counter.js
@@ -0,0 +1,37 @@
+function updateBadgeCount()
+{
+ var targetNodes = document.getElementsByClassName("navItemBadge");
+
+ var count = 0;
+ for (var i = 0; i < targetNodes.length; ++i)
+ {
+ // ignore the unreads in spam
+ // previousElementSibling is of class navItemLabel and has the name of the section in it (e.g., " Spam ")
+ if (targetNodes[i].previousElementSibling.innerHTML.trim().toLowerCase().localeCompare("spam") == 0)
+ {
+ continue;
+ }
+ count += parseInt(targetNodes[i].innerHTML);
+ }
+ count /= 2; // because Google Voice has duplicate nodes for some reason
+
+ var newTitle = "Voice" + (count > 0 ? " (" + count + ")" : "");
+ if (document.title !== newTitle)
+ {
+ document.title = newTitle;
+ }
+}
+
+// Update the badge every 5 seconds
+setInterval(updateBadgeCount, 5000);
+
+// update the badge as user clicks in the app, because GV updates the title with selected item's phone number
+new MutationObserver(function(mutations) {
+ updateBadgeCount();
+}).observe(
+ document.querySelector('title'), {
+ subtree: true,
+ characterData: true,
+ childList: true
+ }
+);
diff --git a/icon.png b/icon.png
new file mode 100644
index 000000000000..a80b952c7934
--- /dev/null
+++ b/icon.png
Binary files differ
diff --git a/run.desktop b/run.desktop
new file mode 100644
index 000000000000..10cead01154d
--- /dev/null
+++ b/run.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Application
+Name=Google Voice
+Comment=VOIP app from Google
+Exec=google-voice-desktop
+Icon=/usr/share/pixmaps/google-voice-desktop.png
+Terminal=false
+Categories=Google;Productivity;Phone;