HYPRPY ist eine Bibliothek, die Python -Bindungen für den HypRland Wayland Compositor bereitstellt.
Mit HYPRPY können Sie in einer laufenden Hyprland -Instanz Informationen zu Windows, Arbeitsbereichen und Monitoren sehr einfach abrufen. Es bietet außerdem einen Event -Monitor, mit dem Sie Ihre eigenen Rückruffunktionen schreiben können, die als Antwort auf Hyprland -Ereignisse ausgeführt werden.
HYPRPY verwendet Unix -Sockets, um mit Hyprland zu kommunizieren, was es schnell und effizient macht.
Bitte schauen Sie sich die Dokumentation an! Hyprpy ist vollständig typisiert und umfassend dokumentiert. Frohe Hacking?
Installieren Sie Hyprpy mit PIP durch Ausführen:
pip install hyprpy Hyprpy ist in der AUR als python-hyprpy erhältlich.
Wenn Sie einen AUR -Helfer wie Paru verwenden, installieren Sie ihn einfach durch Ausführen:
paru -S python-hyprpy from hyprpy import Hyprland
instance = Hyprland ()
# Fetch active window and display information:
window = instance . get_active_window ()
print ( window . wm_class )
print ( window . width )
print ( window . position_x )
# Print information about the windows on the active workspace
workspace = instance . get_active_workspace ()
for window in workspace . windows :
print ( f" { window . address } : { window . title } [ { window . wm_class } ]" )
# Get the resolution of the first monitor
monitor = instance . get_monitor_by_id ( 0 )
if monitor :
print ( f" { monitor . width } x { monitor . height } " )
# Get all windows currently on the special workspace
special_workspace = instance . get_workspace_by_name ( "special" )
if special_workspace :
special_windows = special_workspace . windows
for window in special_windows :
print ( window . title )
# Show a desktop notification every time we switch to workspace 6
from hyprpy . utils . shell import run_or_fail
def workspace_changed ( sender , ** kwargs ):
current_workspace_id = kwargs . get ( 'active_workspace_id' )
if current_workspace_id == 6 :
run_or_fail ([ "notify-send" , "We are on workspace 6." ])
instance . signal_active_workspace_changed . connect ( workspace_changed )
instance . watch ()Hyprpy ist in aktiver Entwicklung! Bitte stellen Sie ein Problem ein, wenn Sie Fehler finden oder eine Funktionsanforderung haben.
Ihre Beiträge werden sehr geschätzt.