aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules/attachments/hypr-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/homeModules/attachments/hypr-scripts')
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/bitwarden-float.sh21
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/hshot.sh45
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/switch-sink.py49
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/toggle-tg.sh14
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh93
5 files changed, 0 insertions, 222 deletions
diff --git a/home-manager/homeModules/attachments/hypr-scripts/bitwarden-float.sh b/home-manager/homeModules/attachments/hypr-scripts/bitwarden-float.sh
deleted file mode 100755
index 7edd5f2..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/bitwarden-float.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-windowtitlev2() {
- IFS=',' read -r -a args <<< "$1"
- args[0]="${args[0]#*>>}"
-
- if [[ ${args[1]} =~ "Extension: (Bitwarden Password Manager)" ]]; then
- hyprctl --batch "\
- dispatch setfloating address:0x${args[0]}; \
- dispatch resizewindowpixel exact 20% 50%, address:0x${args[0]}; \
- dispatch centerwindow; \
- "
- fi
-}
-
-handle() {
- case $1 in
- windowtitlev2\>*) windowtitlev2 "$1" ;;
- esac
-}
-
-socat -U - UNIX-CONNECT:"/$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" \
- | while read -r line; do handle "$line"; done
diff --git a/home-manager/homeModules/attachments/hypr-scripts/hshot.sh b/home-manager/homeModules/attachments/hypr-scripts/hshot.sh
deleted file mode 100755
index 0d02b9c..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/hshot.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-declare -a cmd
-
-usage() {
- echo -e "-m | monitor\n-s | slurp\n-w | active window\n-c | add copy"
-}
-
-monitor() {
- cmd=("grim -o \"\$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')\"")
-}
-
-slurp() {
- cmd=("grim -g \"\$(slurp)\"")
-}
-
-window() {
- cmd=("grim -g \"\$(hyprctl activewindow -j | jq -j '\"\(.at | .[0]),\(.at | .[1]) \(.size | .[0])x\(.size | .[1])\"')\"")
-}
-
-copy() {
- if [[ -n ${cmd[0]} ]]; then
- cmd+=("- | wl-copy")
- else
- usage
- fi
-}
-
-while getopts ":mswc" opt; do
- case ${opt} in
- m) monitor;;
- s) slurp;;
- w) window;;
- c) copy;;
- *) usage
- exit 1;;
- esac
-done
-
-if [[ -z $1 ]]; then
- usage
- exit 1
-fi
-
-bash -c "${cmd[*]}"
diff --git a/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py b/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
deleted file mode 100755
index aa7eec1..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python3
-
-import subprocess
-
-status = subprocess.run(["wpctl", "status"], stdout=subprocess.PIPE).stdout.decode('utf-8')
-status_lines = status.split('\n')
-sink_line = 0
-sinks = []
-sink_names = []
-
-# Get sink line
-for i in range(len(status_lines) - 1):
- if 'Sinks:' in status_lines[i]:
- sink_line = i + 1
- break
-
-# Find unused sinks
-for line in status_lines[sink_line:]:
- if line == ' │ ':
- break
- line = line.split('.')
- nums = line[0]
- name = line[1]
- end_name = line[1].index('[')
- sink = nums[2:].strip()
- if nums[4] == '*':
- continue
-
- sinks.append(sink)
- sink_names.append(name[:end_name].strip())
-
-if (len(sinks) == 0):
- subprocess.run(["notify-send", "Pipewire sink", "No sinks to switch to"])
- exit(0)
-
-selected_sink = subprocess.run(["rofi", "-dmenu"], input="\n".join(sink_names), capture_output=True, text=True).stdout[:-1]
-
-if len(selected_sink) == 0:
- exit(0)
-
-try:
- next_sink = sink_names.index(selected_sink)
-except Exception:
- subprocess.run(["notify-send", "Pipewire sink", "Sink not found"])
- exit(1)
-
-subprocess.run(["wpctl", "set-default", sinks[next_sink]])
-
-subprocess.run(["notify-send", "Pipewire sink", "Selected " + selected_sink])
diff --git a/home-manager/homeModules/attachments/hypr-scripts/toggle-tg.sh b/home-manager/homeModules/attachments/hypr-scripts/toggle-tg.sh
deleted file mode 100755
index 44ed52d..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/toggle-tg.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-TG_CLASS=org.telegram.desktop
-
-tg_workspace=$(hyprctl clients -j | jq -e ".[] | select((.class | contains(\"${TG_CLASS}\"))) | .workspace.id")
-if [[ -z $tg_workspace ]]; then
- telegram-desktop
-elif [[ $tg_workspace -eq $(hyprctl activeworkspace -j | jq -e '.id') ]]; then
- hyprctl dispatch pin class:$TG_CLASS
- hyprctl dispatch movetoworkspacesilent special:magic,class:$TG_CLASS
-else
- hyprctl dispatch movetoworkspacesilent +0,class:$TG_CLASS
- hyprctl dispatch pin class:$TG_CLASS
- hyprctl dispatch focuswindow
-fi
diff --git a/home-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh b/home-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh
deleted file mode 100755
index 8775f39..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-
-ROFI_CMD="rofi -dmenu -theme-str listview{enabled:false;} -p"
-LOCAL_STORAGE=~/.local/share/toggle
-TMP_PATH=/tmp/vpn-status
-V2RAYA_URL="http://localhost:2017"
-
-DBUS_INTERFACE="com.vpn_status"
-DBUS_MEMBER="StatusChanged"
-
-set_token() {
- login=$(echo "" | $ROFI_CMD "Enter login > ")
- password=$(echo "" | $ROFI_CMD "Enter password > " -theme-str 'entry {enabled: false;}')
- response=$(curl -s -X POST \
- "${V2RAYA_URL}/api/login" \
- -d "{\"username\": \"${login}\", \"password\": \"${password}\"}")
-
- code=$(echo $response | jq -r ".code")
- echo "${response}" | jq ".data.token" -r > "${LOCAL_STORAGE}/token"
-}
-
-get_status() {
- token=$1
- response=$(curl -s -X GET \
- "${V2RAYA_URL}/api/touch" \
- -H "Authorization: ${token}")
- echo $response | jq ".data.running" -r
-}
-
-toggle() {
- token=$1
- method=$2
- response=$(curl -s -X ${method} \
- "${V2RAYA_URL}/api/v2ray" \
- -H "Authorization: ${token}")
- code=$(echo $response | jq ".code" -r)
- echo $response | jq ".data.running" -r
-}
-
-check_status() {
- case $(cat $TMP_PATH) in
- true)
- output='{"text": "󰠥"}'
- ;;
- *)
- output='{"text": ""}'
- ;;
- esac
- echo $output | jq --unbuffered --compact-output
-}
-
-
-if [[ ! -d "${LOCAL_STORAGE}" ]]; then
- mkdir "${LOCAL_STORAGE}"
-fi
-
-if [[ ! -e "${LOCAL_STORAGE}/token" ]]; then
- touch "${LOCAL_STORAGE}/token"
-fi
-
-TOKEN=$(cat "${LOCAL_STORAGE}/token")
-if [[ -z "${TOKEN}" ]]; then
- set_token
- TOKEN=$(cat "${LOCAL_STORAGE}/token")
-fi
-
-STATUS=$(get_status $TOKEN)
-
-if [[ $1 == "waybar" ]]; then
- echo $STATUS > $TMP_PATH
- check_status
-
- dbus-monitor --profile "interface='${DBUS_INTERFACE}',member='${DBUS_MEMBER}'" |
- while read -r line; do
- check_status
- done
-else
- if [[ $STATUS == "true" ]]; then
- NEW_STATUS=$(toggle $TOKEN DELETE)
- else
- NEW_STATUS=$(toggle $TOKEN POST)
- fi
-
- if [[ $NEW_STATUS == "null" ]]; then
- set_token
- exit 0
- fi
-
- echo $NEW_STATUS > $TMP_PATH
- dbus-send --type=signal / "${DBUS_INTERFACE}.${DBUS_MEMBER}"
-
- notify-send v2rayA "running: ${NEW_STATUS}"
-fi