summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-29 14:28:39 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-01-29 14:28:39 +0900
commitcd12c95fbb657a20f256cde65a736ab0ab53e0e6 (patch)
tree6e1d11fd064404d0055d74868697dec942455320
parentb1d3b945408f8553f181f2e36c0936d65ca599e8 (diff)
modified bin/dmenuman, created bin/dmenuconnections, created bin/dmenugithub
-rwxr-xr-xar/.local/bin/dmenuconnections36
-rwxr-xr-xar/.local/bin/dmenugithub25
-rwxr-xr-xar/.local/bin/dmenuman3
3 files changed, 62 insertions, 2 deletions
diff --git a/ar/.local/bin/dmenuconnections b/ar/.local/bin/dmenuconnections
new file mode 100755
index 0000000..024e7da
--- /dev/null
+++ b/ar/.local/bin/dmenuconnections
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# initial configuration
+# sudo pacman --noconfirm -S bluez-utils pulseaudio-bluetooth pulseaudio-alsa blueman
+# sudo ln -vsf ${PWD}/etc/bluetooth/main.conf /etc/bluetooth/main.conf
+# sudo systemctl start bluetooth.service
+# sudo systemctl enable bluetooth.service
+
+# Requires:
+# blueman
+# bluez-utils
+# networkmanager_dmenu (https://github.com/firecat53/networkmanager-dmenu)
+# btmenu (https://github.com/cdown/btmenu)
+
+[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
+[ -z "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
+
+wifi=$(printf "%s %s" "${wifiicon}" "$(cat /sys/class/net/w*/operstate | sed "s/down/❎/;s/up/🌐/")")
+
+if [ -n "${wifi}" ]; then
+ choice=$(printf 'bluetooth\nnetwork' | dmenu -i -p "${wifi}")
+else
+ choice=$(printf 'bluetooth\nnetwork' | dmenu -i -p 'Connect:')
+fi
+
+case "${choice}" in
+bluetooth)
+ [ -z "$(pgrep blueman)" ] && blueman-applet &
+ case "$(printf 'connect\ndisable\nmanage\nnew' | dmenu -i -p 'bluetooth:')" in
+ connect) btmenu ;;
+ disable) sudo rkill block bluetooth ;;
+ manage | new) $TERMINAL bluetoothctl ;;
+ esac
+ ;;
+network) networkmanager_dmenu ;;
+esac
diff --git a/ar/.local/bin/dmenugithub b/ar/.local/bin/dmenugithub
new file mode 100755
index 0000000..db9d5d8
--- /dev/null
+++ b/ar/.local/bin/dmenugithub
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Clone a repository into the current directory
+clone_repo() {
+ repository=$1
+ if [ -z "${repository}" ]; then
+ echo "ERROR: You need to enter the name of the repository you wish to clone."
+ else
+ git clone "${url}${repository}"
+ fi
+}
+
+# Get all the repositories for the user with curl and GitHub API and filter only
+# the repository name from the output with sed substitution
+all_repos() {
+ curl -s "https://api.github.com/users/${user}/repos?per_page=1000" | grep -o 'git@[^"]*' |
+ sed "s/git@github.com:${user}\///g"
+}
+
+select_repo() { dmenu -p "Select a repository >" -l 10; }
+
+user="${TheSiahxyz:-$1}"
+url="https://github.com/${user}/"
+
+clone_repo "$(all_repos | select_repo)"
diff --git a/ar/.local/bin/dmenuman b/ar/.local/bin/dmenuman
index d571e60..6da7501 100755
--- a/ar/.local/bin/dmenuman
+++ b/ar/.local/bin/dmenuman
@@ -1,5 +1,4 @@
#!/bin/sh
-cmd=$(echo | dmenu -p "Enter command for man page:")
-
+cmd="$(man -k . | dmenu -i -l 20 -p "Select Program " | cut -d" " -f1)"
[ -n "$cmd" ] && man_path=$(man -w "$cmd" 2>/dev/null) && [ -n "$man_path" ] && setsid -f "${TERMINAL:-st}" -e man "$cmd"