Added new configs and hyprvirtmon.py
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
# Set the directory where your dotfiles are located
|
||||
DOTFILES_DIR="${HOME}/.dotfiles"
|
||||
|
||||
# Use fzf to select a file
|
||||
file=$(find "$DOTFILES_DIR" -type f -name "*.*" | \
|
||||
fzf --delimiter / --with-nth=-1 --keep-right \
|
||||
--prompt="Dotfiles " \
|
||||
|
||||
63
home/.local/usr/bin/hyprvirtmon.py
Executable file
63
home/.local/usr/bin/hyprvirtmon.py
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import json
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
result = subprocess.run(
|
||||
['hyprctl', '-j', 'monitors'],
|
||||
capture_output=True, text=True, check=True
|
||||
)
|
||||
monitors = json.loads(result.stdout)
|
||||
monitor_names = []
|
||||
for monitor in monitors:
|
||||
if 'name' in monitor:
|
||||
monitor_names.append(monitor['name'])
|
||||
if "Virtual-1" in monitor_names:
|
||||
result = subprocess.run(
|
||||
["hyprctl", "keyword", "monitor", "Virtual-1,disable"],
|
||||
capture_output=True, text=True, check=True
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("Failed to disable monitor Virtual-1", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
else:
|
||||
result = subprocess.run(["pkill", "-x", "wayvnc"],
|
||||
capture_output=True, text=True)
|
||||
if result.returncode != 0:
|
||||
print("Failed to stop wayvnc", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
else:
|
||||
sys.exit(0)
|
||||
else:
|
||||
result = subprocess.run(
|
||||
["hyprctl", "keyword", "monitor",
|
||||
"Virtual-1, 2800x1752@120,1920x0,2"],
|
||||
capture_output=True, text=True, check=True
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("Failed to set monitor Virtual-1", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
else:
|
||||
result = subprocess.run(
|
||||
["hyprctl", "output", "create", "headless", "Virtual-1"],
|
||||
capture_output=True, text=True, check=True
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("Failed to create headless monitor Virtual-1",
|
||||
file=sys.stderr)
|
||||
sys.exit(1)
|
||||
else:
|
||||
result = subprocess.Popen(
|
||||
["wayvnc", "--output=Virtual-1", "0.0.0.0", "5900", "&"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error executing hyprctl: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(f"An unexpected error occurred: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
fastfetch --logo small --structure "title:os:kernel:cpu:memory:disk:uptime"
|
||||
misfortune|cowsay|lolcat
|
||||
fortune|cowsay|lolcat
|
||||
|
||||
exec zsh
|
||||
|
||||
Reference in New Issue
Block a user