aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules/attachments
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/homeModules/attachments')
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/battery-level.sh22
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/hshot.sh (renamed from home-manager/homeModules/attachments/hypr-scripts/hshot)0
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/kill7
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/rofi-modes20
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/switch-sink.py (renamed from home-manager/homeModules/attachments/hypr-scripts/switch_sink.py)24
-rwxr-xr-xhome-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh (renamed from home-manager/homeModules/attachments/hypr-scripts/toggle_vpn.sh)0
6 files changed, 16 insertions, 57 deletions
diff --git a/home-manager/homeModules/attachments/hypr-scripts/battery-level.sh b/home-manager/homeModules/attachments/hypr-scripts/battery-level.sh
deleted file mode 100755
index cc2d5cd..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/battery-level.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-while true; do
- # Check the battery level and charging status
- battery_info=$(acpi -b)
-
- # Extract the battery level from the output of `acpi`
- battery_level=$(echo $battery_info | grep -o "[0-9]*%" | sed "s/%//")
-
- # Check if the laptop is charging
- if [[ $battery_info == *"Charging"* ]]; then
- # If the laptop is charging, do nothing
- :
- else
- # If the battery level is less than 15%, send a notification
- if [ "$battery_level" -lt 15 ]; then
- notify-send "Battery Low" "Battery level is at $battery_level%. Charge your laptop."
- fi
- fi
-
- # Sleep for 5 minutes before checking the battery level again
- sleep 300
-done
diff --git a/home-manager/homeModules/attachments/hypr-scripts/hshot b/home-manager/homeModules/attachments/hypr-scripts/hshot.sh
index 0d02b9c..0d02b9c 100755
--- a/home-manager/homeModules/attachments/hypr-scripts/hshot
+++ b/home-manager/homeModules/attachments/hypr-scripts/hshot.sh
diff --git a/home-manager/homeModules/attachments/hypr-scripts/kill b/home-manager/homeModules/attachments/hypr-scripts/kill
deleted file mode 100755
index 40ab4a9..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/kill
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [[ $(hyprctl activewindow -j | jq -r '.class') =~ (kitty) ]]; then
- kill $(hyprctl activewindow -j | jq '.pid') -s 9
-else
- hyprctl dispatch killactive
-fi
diff --git a/home-manager/homeModules/attachments/hypr-scripts/rofi-modes b/home-manager/homeModules/attachments/hypr-scripts/rofi-modes
deleted file mode 100755
index 2d52802..0000000
--- a/home-manager/homeModules/attachments/hypr-scripts/rofi-modes
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-case $(echo -e "clipboard\nemoji\ncalc" | rofi -dmenu) in
- emoji) arg=emoji;;
- calc) arg=calc;;
- clipboard) cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy
- exit;;
- bitwarden) if [[ $XDG_BACKEND == "wayland" ]]; then
- typer=wtype
- clip=wl-copy
- else
- typer=xdotool
- clip=xclip
- fi
- rofi-rbw --typer $typer --clip $clip
- exit;;
- *)exit;;
-esac
-
-rofi -modi $arg -show $arg
diff --git a/home-manager/homeModules/attachments/hypr-scripts/switch_sink.py b/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
index ff554ae..a043238 100755
--- a/home-manager/homeModules/attachments/hypr-scripts/switch_sink.py
+++ b/home-manager/homeModules/attachments/hypr-scripts/switch-sink.py
@@ -5,7 +5,6 @@ import subprocess
status = subprocess.run(["wpctl", "status"], stdout=subprocess.PIPE).stdout.decode('utf-8')
status_lines = status.split('\n')
sink_line = 0
-selected_sink = 0
sinks = []
sink_names = []
@@ -25,17 +24,26 @@ for line in status_lines[sink_line:]:
end_name = line[1].index('[')
sink = nums[8:]
if nums[4] == '*':
- selected_sink = sink
+ continue
sinks.append(sink)
sink_names.append(name[:end_name].strip())
-next_sink = sinks.index(selected_sink) + 1
-if next_sink == len(sinks):
- next_sink = 0
+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)
-next_sink_name = sink_names[next_sink]
subprocess.run(["wpctl", "set-default", sinks[next_sink]])
-subprocess.run(["notify-send", "Pipewire sink", "Selected " + next_sink_name])
-
+subprocess.run(["notify-send", "Pipewire sink", "Selected " + selected_sink])
diff --git a/home-manager/homeModules/attachments/hypr-scripts/toggle_vpn.sh b/home-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh
index a712a1e..a712a1e 100755
--- a/home-manager/homeModules/attachments/hypr-scripts/toggle_vpn.sh
+++ b/home-manager/homeModules/attachments/hypr-scripts/toggle-vpn.sh