2 Incheckningar 717c03f120 ... f74d4b2696

Upphovsman SHA1 Meddelande Datum
  bfgeshka f74d4b2696 dbus-independent new tab for browser (faster too) 10 månader sedan
  bfgeshka d74b0b1337 foobar controls 10 månader sedan
3 ändrade filer med 52 tillägg och 0 borttagningar
  1. 13 0
      ishell/browser-new-tab
  2. 19 0
      ishell/foobar_control.sh
  3. 20 0
      shell/firefox-socket

+ 13 - 0
ishell/browser-new-tab

@@ -0,0 +1,13 @@
+#! /bin/sh
+
+# SocketControl browser extension https://github.com/karabaja4/firefox-socket-control
+if [ -S /tmp/firefox.sock ];
+then
+	OPENLINK="$1"
+	printf "%s" "nt|$OPENLINK" | nc -NU /tmp/firefox.sock
+	exit 0
+fi
+
+# Failsafe
+$BROWSER -new-tab "$1"
+exit 0

+ 19 - 0
ishell/foobar_control.sh

@@ -0,0 +1,19 @@
+#! /bin/sh
+
+## Dependencies: foo_beefweb for foobar2000, wmctrl, coreutils, grep, curl
+## +x rights for this file
+
+case "$1" in
+	"--help"|"-h")              cat $0 ;;
+	"--pause-toggle"|"-pt")     curl -d "" "http://localhost:8880/api/player/pause/toggle" ;;
+	"--play"|"-pl")             curl -d "" "http://localhost:8880/api/player/play" ;;
+	"--stop"|"-st")             curl -d "" "http://localhost:8880/api/player/stop" ;;
+	"--previous"|"-pv")         curl -d "" "http://localhost:8880/api/player/previous" ;;
+	"--next"|"-nx")             curl -d "" "http://localhost:8880/api/player/next" ;;
+	"--volume"|"-v")            curl -d "{\"volume\":-`echo "100.0 - $2" | bc -l`}" "http://localhost:8880/api/player" ;;  #Volume is in 1000db - XdB.
+#	"--title"|"-t")             xwininfo -root -children | grep "\[foobar2000\]" ;; ## Alternative
+	"--title"|"-t")             wmctrl -l | grep "\[foobar2000\]" | cut --complement -d' ' -f 1,2,3,4 | awk 'NF{NF--;};1' ;;
+	*)                          echo "Invalid arguments, exitting..." && exit 1 ;;
+esac
+
+exit 0

+ 20 - 0
shell/firefox-socket

@@ -0,0 +1,20 @@
+#!/bin/sh
+
+BROWSERPATH="LibreWolf"
+
+_sock="/tmp/firefox.sock"
+
+if [ -S "${_sock}" ]
+then
+    if [ ${#} -eq 0 ]
+    then
+        printf 'nw' | nc -NU "${_sock}"
+    else
+        printf '%s' "nw$(printf '|%s' "${@}")" | nc -NU "${_sock}"
+    fi
+else
+    if ! pgrep -f '$BROWSERPATH' > /dev/null
+    then
+        exec $BROWSERPATH "${@}"
+    fi
+fi