♻️ refactor(hypr): focused monitor script changed from python to bash
This commit is contained in:
parent
f5428b9a0e
commit
b9234e1469
1 changed files with 12 additions and 10 deletions
|
@ -1,16 +1,18 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/bash
|
||||||
import subprocess
|
|
||||||
|
|
||||||
monitor_data = subprocess.check_output(["hyprctl", "monitors"], text=True)
|
MONITOR_DATA=$(hyprctl monitors)
|
||||||
lines = monitor_data.split("\n")
|
readarray -t LINES <<<"$MONITOR_DATA"
|
||||||
|
|
||||||
current_monitor = ""
|
CURRENT_MONITOR=""
|
||||||
|
|
||||||
# Recorrer las líneas y buscar el nombre y el estado enfocado
|
# Recorrer las líneas y buscar el nombre y el estado enfocado
|
||||||
for line in lines:
|
for LINE in "${LINES[@]}"; do
|
||||||
if "Monitor" in line:
|
if [[ $LINE == *"Monitor"* ]]; then
|
||||||
current_monitor = line.split(" ", 1)[1].split(" ")[0]
|
CURRENT_MONITOR=$(echo $LINE | awk '{print $2}')
|
||||||
|
fi
|
||||||
|
|
||||||
if "focused: yes" in line:
|
if [[ $LINE == *"focused: yes"* ]]; then
|
||||||
print(current_monitor)
|
echo $CURRENT_MONITOR
|
||||||
break
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue