From d4b818029e8c0293f4d629fa25b94f4c9ec37dfc Mon Sep 17 00:00:00 2001 From: Ezri Brimhall Date: Fri, 14 Feb 2025 17:41:28 -0700 Subject: [PATCH] idk --- README.md | 0 VoidShell/entrypoints/app.py | 5 - pyproject.toml | 3 + voidshell/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 143 bytes .../__pycache__/__init__.cpython-313.pyc | Bin 0 -> 143 bytes .../__pycache__/versions.cpython-312.pyc | Bin 0 -> 753 bytes voidshell/dbus_clients/__init__.py | 0 .../__pycache__/__init__.cpython-313.pyc | Bin 0 -> 156 bytes .../dbus_clients/systemd_networkd/__init__.py | 6 + .../__pycache__/link.cpython-313.pyc | Bin 0 -> 8125 bytes .../__pycache__/network1.cpython-313.pyc | Bin 0 -> 9306 bytes .../dbus_clients/systemd_networkd/link.py | 267 +++++++++++++++ .../dbus_clients/systemd_networkd/network1.py | 318 ++++++++++++++++++ voidshell/entrypoints/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 155 bytes .../__pycache__/shell.cpython-312.pyc | Bin 0 -> 2968 bytes voidshell/entrypoints/shell.py | 49 +++ voidshell/services/__init__.py | 0 voidshell/services/network/service.py | 11 + .../services/sway/config.py | 0 .../services/sway/sway.py | 0 .../services/sway/tree.py | 0 voidshell/services/workspaces/__init__.py | 0 .../services/workspaces/backend.py | 9 + .../services/workspaces/config.py | 0 .../services/workspaces/scoring.py | 0 .../services/workspaces/tree.py | 125 ++++++- .../__pycache__/config.cpython-312.pyc | Bin 0 -> 1784 bytes voidshell/utilities/config.py | 32 ++ voidshell/versions.py | 13 + 31 files changed, 828 insertions(+), 10 deletions(-) create mode 100644 README.md delete mode 100644 VoidShell/entrypoints/app.py create mode 100644 voidshell/__init__.py create mode 100644 voidshell/__pycache__/__init__.cpython-312.pyc create mode 100644 voidshell/__pycache__/__init__.cpython-313.pyc create mode 100644 voidshell/__pycache__/versions.cpython-312.pyc create mode 100644 voidshell/dbus_clients/__init__.py create mode 100644 voidshell/dbus_clients/__pycache__/__init__.cpython-313.pyc create mode 100644 voidshell/dbus_clients/systemd_networkd/__init__.py create mode 100644 voidshell/dbus_clients/systemd_networkd/__pycache__/link.cpython-313.pyc create mode 100644 voidshell/dbus_clients/systemd_networkd/__pycache__/network1.cpython-313.pyc create mode 100644 voidshell/dbus_clients/systemd_networkd/link.py create mode 100644 voidshell/dbus_clients/systemd_networkd/network1.py create mode 100644 voidshell/entrypoints/__init__.py create mode 100644 voidshell/entrypoints/__pycache__/__init__.cpython-312.pyc create mode 100644 voidshell/entrypoints/__pycache__/shell.cpython-312.pyc create mode 100644 voidshell/entrypoints/shell.py create mode 100644 voidshell/services/__init__.py create mode 100644 voidshell/services/network/service.py rename {VoidShell => voidshell}/services/sway/config.py (100%) rename {VoidShell => voidshell}/services/sway/sway.py (100%) rename {VoidShell => voidshell}/services/sway/tree.py (100%) create mode 100644 voidshell/services/workspaces/__init__.py rename {VoidShell => voidshell}/services/workspaces/backend.py (94%) rename {VoidShell => voidshell}/services/workspaces/config.py (100%) rename {VoidShell => voidshell}/services/workspaces/scoring.py (100%) rename {VoidShell => voidshell}/services/workspaces/tree.py (74%) create mode 100644 voidshell/utilities/__pycache__/config.cpython-312.pyc create mode 100644 voidshell/utilities/config.py create mode 100644 voidshell/versions.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/VoidShell/entrypoints/app.py b/VoidShell/entrypoints/app.py deleted file mode 100644 index ecd42f5..0000000 --- a/VoidShell/entrypoints/app.py +++ /dev/null @@ -1,5 +0,0 @@ -import gi -gi.require_version('Gtk', '3.0') -from gi.repository import GLib, Gtk - - diff --git a/pyproject.toml b/pyproject.toml index 31dc340..ff19105 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,3 +23,6 @@ black = "^24.10.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +VoidShell = 'voidshell.entrypoints.shell:main' diff --git a/voidshell/__init__.py b/voidshell/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/voidshell/__pycache__/__init__.cpython-312.pyc b/voidshell/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d6dc835fa15922de8a60b0472380ab3fee90ed9 GIT binary patch literal 143 zcmX@j%ge<81ecBnq=V?kAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxdrKg{fpPQ;*!K1PyZ@r13klAtYBUhv$3AREoS$UY#@;WA~N%< zn2ms9?C$!s$|+4P$d)d1_HWQGQxxPHOQjrtktymRn5enYZ|hQVUBni&EpuQj3Z+^Yd8!F;EdFq9Q`sNs~Ez97*ecP zPg1%8k}#ih&4D}XA!%|A~r*GM)8c)3AGDS Rud?WTWM<$IFA@d14*+zFsH6Y@ literal 0 HcmV?d00001 diff --git a/voidshell/dbus_clients/__init__.py b/voidshell/dbus_clients/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/voidshell/dbus_clients/__pycache__/__init__.cpython-313.pyc b/voidshell/dbus_clients/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac6a7e6739fc92eab514a5d06a8904754c369321 GIT binary patch literal 156 zcmey&%ge<81bV5f(n0iN5CH>>P{wB#AY&>+I)f&o-%5reCLr%KNa~igenx(7s(xx! zQKo)zQL=tmer8H=Mruxuei@Ke3}&Syl@`Y*=VYell@#m8$7kkcmc+;F6;$5hu*uC& bDa}c>D`Ewj1+uFc#Q4a}$jDg43}gWSliVfz literal 0 HcmV?d00001 diff --git a/voidshell/dbus_clients/systemd_networkd/__init__.py b/voidshell/dbus_clients/systemd_networkd/__init__.py new file mode 100644 index 0000000..280109c --- /dev/null +++ b/voidshell/dbus_clients/systemd_networkd/__init__.py @@ -0,0 +1,6 @@ +from .link import ( + OrgFreedesktopNetwork1DHCPv4ClientInterface as DHCPv4ClientInterface, + OrgFreedesktopNetwork1DHCPv6ClientInterface as DHCPv6ClientInterface, + OrgFreedesktopNetwork1LinkInterface as LinkInterface, +) +from .network1 import OrgFreedesktopNetwork1ManagerInterface as NetworkManagerInterface diff --git a/voidshell/dbus_clients/systemd_networkd/__pycache__/link.cpython-313.pyc b/voidshell/dbus_clients/systemd_networkd/__pycache__/link.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4140521814e2e0170260844353c1df353a3aa17c GIT binary patch literal 8125 zcmdT}U2Gd!6`rv@Cl}} zJ`CY}1R{A2w7d?wu!rwN^D&6!;}Fj$Ad&BbzI+mr`F`lnry!M2LpnbI1NjVO@`Es# zRYsI4#fY3#3~f1X=tlHf1crnyhPF7`62dktY<*};qOD)pj+Iln^iz_VQ~f^6aa_;x zY}etrh#$W0Z1|ByyWsheyEgZH?d`Q%h2{GE!Nrv|zQ}683YN!;H!D`zA0gXq$74{k z3T(lxR$b>h-*5_knmkMHS6QvHA*jd5a1Y!X18-viU*-w(*nabks_pTGRm&+e;hgMn z-geflid__PTMC+wz45qKu?u$aBSDBlFeii|(<+}aZJ-gn{A{Nk;Jd+S#hDmHVxy@Gu@jPbt8w?h8lo=&07 zTLb26C9DfxP#Z6yA4-Sur=G&Z6XibH#KqJtb!kiWhn8ILb`@*3iZ5ct8vrh#Il@_` z#3?%K-t89*Kf<4EfF!!!&7mZa`sm!foii?yex`I&4=lBNqShZ+6L0*b;72A0< zTift8jtz|Y^9RWCtO&urrPQgbeMfngP|{Psk4@Go8(Yc}mW2)s^Y8d!?!i{fkC~=p zRhen}3Dc~)#kC5hlcxFJnpJ6d(xzFmfqSToIj(6!2A>8=f=LAbm}%0B?Sg4}9@r~u z9^=S5LxfidvIJBe0w__Zz#l5RF-0HU9-G)s<#x5OuGeF#HdT)|Q$aNGH_y0Go-MVi zezs9w^RxRaAG>DCZuTsZvHxKMywctPvnU*n6P!TkwW+}vMT`?nAO!6yC_+)%pVT1Q zB?JvZ)WI}8P^73{mf%&o&k?lM6Ln4?$WmgCK!lO$Mb*%Fzf|Zt#^I&bzkz+LTdz05 z*zY6P!V^mHX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zOY+l-$RWq#F8IX~Hh0 io=wEnsqM)4_R#15p<(jbNc;WQ!wtgax<+YHK>q~*e`wkO literal 0 HcmV?d00001 diff --git a/voidshell/dbus_clients/systemd_networkd/__pycache__/network1.cpython-313.pyc b/voidshell/dbus_clients/systemd_networkd/__pycache__/network1.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e995ac788ddce21bcbf2fb05e57421a718c517f0 GIT binary patch literal 9306 zcmds7OKcm*8QvwAPw_2T*2^*_`Ni0l>bI5HZe3e0OuI^uZ37gRyIqk(YVGANGqaLI z6)l1UNKqgNdg%M!0`9T*-g_*Ni?Be80zDMIS!IBrJrw=_S-ysPk+cl7CG4NWneUtV z=HHq5XJ%E8$D&ry$Xq+NvfpE52Uw% zQk4lw4Xi}epc-0K=x{lli@d<*bFw?6TbAwUj$vCYr?~#xR?SuJ8U@Ey9vaMX1K(P& znj|;mX6~-8v%929NkMl=@t&!d-7(C&Z#jgP^a8nKS1Pu3o7Jp>o5Yf3`(08sYaDt6 zGv1+gl~AX42O4vD_GD-FQpIrCoi*Jm6J9v8qwv19p_@jL%WW%YR=e~;)ier*SMvyx zzim~iv0<2`+)$h@LatUJ&YE4+bS`z6XH^^08kruB8D&d1y{rN{todm@yeA4iycLPc zsziONO#LegINYcDR|2ZC=%1FRCH1-*n2??*R~l>@alWGcZX|LT@t#7Fr0UP1i;a#ye)DZz2<=7*;VsEOW0(OXFkM4@S zrH%>M7{`w9iv6lOAz76E`d1M)t(b3AiJB;!X&-(LHe|1>8}N!_jwY(Z|Q~9rd(;7;DrN zRL^vc<-2N5K#p^yhilHECG`yfGqExW^DMYBrJh~%sY~iPq4Zc+>3N}ax~p_vC_Ua) zx*(KhyGp+zl+JXOUJy!WdFjQKIj;GhdPyif!AmczR~BXUo_bX%JE^AVsq(elH{4Ti z)ABt^NRhCoj$K_Q&NG`nz3@%l(#wRl*5VfVd;>dp#sbGd_WAN>DVlH~d*B<7?nta^`H#YDd5FUim4 z<>#_Hylgx7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^+ba?Kx8`k)JqNce~O@p)ax=A1%)3o>3 zbrVMm{7PzC$)L=^Nov`eMpLLNiDm}PIW(8hETXxE<~EuoG{1l9PMB}T9QP6b9 zflUkCWH9K!RRmx_;`=U&cjnw+g8e8UNuNmDVJUcYYkX#F;>1>Bb~~g5gD<20!0cZm zbM*jx*N2)p+fhW0O>T`J+nP9!;79<#F$KVh^veKzzYI#z@p=eS^?0*vJJvyaL!_lg z4x&L*Q*B)VXbL&-4NYYxUxqLhmZFJz1X2yHklIf0Mxj@GvPaGy#Gc!aedQo_b{}@; z%t7p_ec0(Eufk4d{(sr~jh58-LH(W-e2&AqV|*sOVeQQZC~FPt&Jp%M&+$4F@WZ?g z^F<);Edr5dPJ0o65jwZ$Y>w}`2#hy59ji=imsMtbYjS!kk=sTc^{@;R+iM?E+d(P# zUtc`8pYmF z{CF7TfhmJ|Jc@{s#SP!^V(KmW8-T!eOJbM7y!6Ym{AX$Q?^5n_DfguklYL)GO|y-u VFQyGep50QWwuZ0N1DNK%_zw>yqay$S literal 0 HcmV?d00001 diff --git a/voidshell/dbus_clients/systemd_networkd/link.py b/voidshell/dbus_clients/systemd_networkd/link.py new file mode 100644 index 0000000..c289b20 --- /dev/null +++ b/voidshell/dbus_clients/systemd_networkd/link.py @@ -0,0 +1,267 @@ +from __future__ import annotations + +from typing import Any, Dict, List, Tuple + +from sdbus import ( + DbusDeprecatedFlag, + DbusInterfaceCommonAsync, + DbusNoReplyFlag, + DbusPropertyConstFlag, + DbusPropertyEmitsChangeFlag, + DbusPropertyEmitsInvalidationFlag, + DbusPropertyExplicitFlag, + DbusUnprivilegedFlag, + dbus_method_async, + dbus_property_async, + dbus_signal_async, +) + + +class OrgFreedesktopNetwork1DHCPv6ClientInterface( + DbusInterfaceCommonAsync, + interface_name="org.freedesktop.network1.DHCPv6Client", +): + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def state(self) -> str: + raise NotImplementedError + + +class OrgFreedesktopNetwork1DHCPv4ClientInterface( + DbusInterfaceCommonAsync, + interface_name="org.freedesktop.network1.DHCPv4Client", +): + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def state(self) -> str: + raise NotImplementedError + + +class OrgFreedesktopNetwork1LinkInterface( + DbusInterfaceCommonAsync, + interface_name="org.freedesktop.network1.Link", +): + @dbus_method_async( + input_signature="as", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_ntp( + self, + servers: List[str], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="a(iay)", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_dns( + self, + addresses: List[Tuple[int, bytes]], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="a(iayqs)", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_dnsex( + self, + addresses: List[Tuple[int, bytes, int, str]], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="a(sb)", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_domains( + self, + domains: List[Tuple[str, bool]], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="b", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_default_route( + self, + enable: bool, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="s", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_llmnr( + self, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="s", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_multicast_dns( + self, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="s", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_dnsover_tls( + self, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="s", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_dnssec( + self, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="as", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_dnssecnegative_trust_anchors( + self, + names: List[str], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def revert_ntp( + self, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def revert_dns( + self, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def renew( + self, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def force_renew( + self, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def reconfigure( + self, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_signature="s", + result_args_names=('json',), + flags=DbusUnprivilegedFlag, + ) + async def describe( + self, + ) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def operational_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def carrier_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def address_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def ipv4_address_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def ipv6_address_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def online_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def administrative_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="(tt)", + ) + def bit_rates(self) -> Tuple[int, int]: + raise NotImplementedError + diff --git a/voidshell/dbus_clients/systemd_networkd/network1.py b/voidshell/dbus_clients/systemd_networkd/network1.py new file mode 100644 index 0000000..7bc7d8c --- /dev/null +++ b/voidshell/dbus_clients/systemd_networkd/network1.py @@ -0,0 +1,318 @@ +from __future__ import annotations + +from typing import Any, Dict, List, Tuple + +from sdbus import ( + DbusDeprecatedFlag, + DbusInterfaceCommonAsync, + DbusNoReplyFlag, + DbusPropertyConstFlag, + DbusPropertyEmitsChangeFlag, + DbusPropertyEmitsInvalidationFlag, + DbusPropertyExplicitFlag, + DbusUnprivilegedFlag, + dbus_method_async, + dbus_property_async, + dbus_signal_async, +) + + +class OrgFreedesktopNetwork1ManagerInterface( + DbusInterfaceCommonAsync, + interface_name="org.freedesktop.network1.Manager", +): + @dbus_method_async( + result_signature="a(iso)", + result_args_names=('links',), + flags=DbusUnprivilegedFlag, + ) + async def list_links( + self, + ) -> List[Tuple[int, str, str]]: + raise NotImplementedError + + @dbus_method_async( + input_signature="s", + result_signature="io", + result_args_names=('ifindex', 'path'), + flags=DbusUnprivilegedFlag, + ) + async def get_link_by_name( + self, + name: str, + ) -> Tuple[int, str]: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_signature="so", + result_args_names=('name', 'path'), + flags=DbusUnprivilegedFlag, + ) + async def get_link_by_index( + self, + ifindex: int, + ) -> Tuple[str, str]: + raise NotImplementedError + + @dbus_method_async( + input_signature="ias", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_ntp( + self, + ifindex: int, + servers: List[str], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="ia(iay)", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_dns( + self, + ifindex: int, + addresses: List[Tuple[int, bytes]], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="ia(iayqs)", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_dnsex( + self, + ifindex: int, + addresses: List[Tuple[int, bytes, int, str]], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="ia(sb)", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_domains( + self, + ifindex: int, + domains: List[Tuple[str, bool]], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="ib", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_default_route( + self, + ifindex: int, + enable: bool, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="is", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_llmnr( + self, + ifindex: int, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="is", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_multicast_dns( + self, + ifindex: int, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="is", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_dnsover_tls( + self, + ifindex: int, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="is", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_dnssec( + self, + ifindex: int, + mode: str, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="ias", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def set_link_dnssecnegative_trust_anchors( + self, + ifindex: int, + names: List[str], + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def revert_link_ntp( + self, + ifindex: int, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def revert_link_dns( + self, + ifindex: int, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def renew_link( + self, + ifindex: int, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def force_renew_link( + self, + ifindex: int, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def reconfigure_link( + self, + ifindex: int, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + result_args_names=(), + flags=DbusUnprivilegedFlag, + ) + async def reload( + self, + ) -> None: + raise NotImplementedError + + @dbus_method_async( + input_signature="i", + result_signature="s", + result_args_names=('json',), + flags=DbusUnprivilegedFlag, + ) + async def describe_link( + self, + ifindex: int, + ) -> str: + raise NotImplementedError + + @dbus_method_async( + result_signature="s", + result_args_names=('json',), + flags=DbusUnprivilegedFlag, + ) + async def describe( + self, + ) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def operational_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def carrier_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def address_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def ipv4_address_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def ipv6_address_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="s", + flags=DbusPropertyEmitsChangeFlag, + ) + def online_state(self) -> str: + raise NotImplementedError + + @dbus_property_async( + property_signature="t", + flags=DbusPropertyConstFlag, + ) + def namespace_id(self) -> int: + raise NotImplementedError + + @dbus_property_async( + property_signature="u", + ) + def namespace_nsid(self) -> int: + raise NotImplementedError + diff --git a/voidshell/entrypoints/__init__.py b/voidshell/entrypoints/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/voidshell/entrypoints/__pycache__/__init__.cpython-312.pyc b/voidshell/entrypoints/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 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=QKr-=mcdTKNGT-OTjR(GEPbzwFMQ+d=1lFlV->d*)2XoO$p{*F3SQALwJ! h+3gp5*(06okpl#ay_Xbe^4__91k-+Am!`y#{tFv2hwK0V literal 0 HcmV?d00001 diff --git a/voidshell/entrypoints/shell.py b/voidshell/entrypoints/shell.py new file mode 100644 index 0000000..df5940c --- /dev/null +++ b/voidshell/entrypoints/shell.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +from .. import versions +from ..utilities.config import Configuration +from gi.repository import Astal, Gio, AstalIO +from gi.events import GLibEventLoopPolicy +from pathlib import Path +import sys +import logging +import asyncio +from sdbus import request_default_bus_name_async, sd_bus_open_user, set_default_bus + +asyncio.set_event_loop_policy(GLibEventLoopPolicy()) + +logger = logging.getLogger(__name__) + + +class App(Astal.Application): + + def do_astal_application_request(self, msg: str, conn: Gio.SocketConnection): + print(msg) + AstalIO.write_sock(conn, "hello") + + def do_activate(self) -> None: + self.hold() + logger.info("Loading configuration") + config = Configuration(Path("~/.config/VoidShell/config").expanduser()) + self.apply_css(str(config.css_file), True) + set_default_bus(sd_bus_open_user()) + asyncio.get_event_loop().create_task( + request_default_bus_name_async("dev.ezri.VoidShell") + ) + logger.info("VoidShell up and running") + # TODO: implement application startup logic + + +def doStartup(app: App): + logging.basicConfig(level=logging.INFO) + app.acquire_socket() + app.run(None) + + +def main(): + app = App(instance_name="VoidShell") + try: + doStartup(app) + except Exception: + print("Error: VoidShell is already running") + sys.exit(1) diff --git a/voidshell/services/__init__.py b/voidshell/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/voidshell/services/network/service.py b/voidshell/services/network/service.py new file mode 100644 index 0000000..f671be2 --- /dev/null +++ b/voidshell/services/network/service.py @@ -0,0 +1,11 @@ +from gi.repository import GObject +from voidshell.dbus_clients.systemd_networkd import ( + NetworkManagerInterface, + LinkInterface, +) + + +class NetworkService(GObject): + """ + Collects and formats network data from a variety of sources + """ diff --git a/VoidShell/services/sway/config.py b/voidshell/services/sway/config.py similarity index 100% rename from VoidShell/services/sway/config.py rename to voidshell/services/sway/config.py diff --git a/VoidShell/services/sway/sway.py b/voidshell/services/sway/sway.py similarity index 100% rename from VoidShell/services/sway/sway.py rename to voidshell/services/sway/sway.py diff --git a/VoidShell/services/sway/tree.py b/voidshell/services/sway/tree.py similarity index 100% rename from VoidShell/services/sway/tree.py rename to voidshell/services/sway/tree.py diff --git a/voidshell/services/workspaces/__init__.py b/voidshell/services/workspaces/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/VoidShell/services/workspaces/backend.py b/voidshell/services/workspaces/backend.py similarity index 94% rename from VoidShell/services/workspaces/backend.py rename to voidshell/services/workspaces/backend.py index 13c80cc..a8674ed 100644 --- a/VoidShell/services/workspaces/backend.py +++ b/voidshell/services/workspaces/backend.py @@ -47,6 +47,11 @@ class AbstractWorkspaceBackend(ABC): """Configure an output""" pass + @abstractmethod + async def disableOutput(self, output: str): + """Disable an output""" + pass + @abstractmethod def onWorkspaceChange(self, callback): """Register a callback to be called when the workspace changes""" @@ -62,6 +67,10 @@ class AbstractWorkspaceBackend(ABC): """Register a callback to be called when the binding mode changes, in compositors that support it""" pass + @abstractmethod + async def getOutputs(self) -> list[OutputAdapter]: + """Get the currently connected outputs""" + @abstractmethod @property def name(self) -> str: diff --git a/VoidShell/services/workspaces/config.py b/voidshell/services/workspaces/config.py similarity index 100% rename from VoidShell/services/workspaces/config.py rename to voidshell/services/workspaces/config.py diff --git a/VoidShell/services/workspaces/scoring.py b/voidshell/services/workspaces/scoring.py similarity index 100% rename from VoidShell/services/workspaces/scoring.py rename to voidshell/services/workspaces/scoring.py diff --git a/VoidShell/services/workspaces/tree.py b/voidshell/services/workspaces/tree.py similarity index 74% rename from VoidShell/services/workspaces/tree.py rename to voidshell/services/workspaces/tree.py index 7410bfe..92c9850 100644 --- a/VoidShell/services/workspaces/tree.py +++ b/voidshell/services/workspaces/tree.py @@ -5,8 +5,9 @@ from sdbus import ( dbus_property_async, dbus_signal_async, ) -from .config import WorkspaceConfig, GroupConfig, ContextConfig, Config -from .backend import getBackend, WorkspaceAdapter +from .config import WorkspaceConfig, GroupConfig, Context as ContextConfig, Config +from .backend import getBackend, WorkspaceAdapter, OutputAdapter +from . import scoring import logging logger = logging.getLogger(__name__) @@ -292,9 +293,11 @@ class Group(GObject.Object): def __init__(self, name: str): super().__init__() if "/" in name: - self._proxify(name) + self._proxify("dev.ezri.voidshell", name) else: - self._proxify(f"/dev/ezri/voidshell/workspaces/group/{name}") + self._proxify( + "dev.ezri.voidshell", f"/dev/ezri/voidshell/workspaces/group/{name}" + ) def __init__(self, definition: GroupConfig): super().__init__() @@ -305,12 +308,124 @@ class Group(GObject.Object): manager._getWorkspaceByCompositorIndex(ws) for ws in definition.get("workspaces") ] + for workspace in self.workspaces: + workspace.addGroup(self) self.output_name = None self.focused = False self._focused_workspace = None self.context = None self._dbusObject = Group.DBusObject(self) + async def configure(self, output: str = None) -> str: + """Configure the group. If no output is provided, the group will be reconfigured on its + current output. If it is not currently active, an output is required.""" + adapter = getBackend() + if output is None: + if self.output_name is None: + return "Output required for inactive group" + output = self.output_name + + self.output_name = output + try: + await adapter.configureOutput(output, self.definition) + except Exception as e: + self.output_name = None + return str(e) + return "OK" + + async def focus(self): + """Focus the group.""" + adapter = getBackend() + if self.output_name is None: + return "Group not active, cannot focus" + try: + await adapter.focusOutput(self.output_name) + except Exception as e: + return str(e) + return "OK" + + async def disable(self): + """Disable the group.""" + adapter = getBackend() + if self.output_name is None: + return "Don't have an output name, cannot disable group." + try: + await adapter.disableOutput(self.output_name) + except Exception as e: + return str(e) + return "OK" + + +class Context( + GObject.Object, +): + + class DBusInterface( + DbusInterfaceCommonAsync, + interface_name="dev.ezri.voidshell.workspaces.Context", + ): + def __init__(self, context: "Context" = None): + super().__init__() + self.context = context + + @dbus_signal_async() + async def Activated(self): + raise NotImplementedError + + @dbus_signal_async() + async def Deactivated(self): + raise NotImplementedError + + @dbus_method_async(input_signature="", result_signature="i") + async def GetCompatabilityScore(self): + raise NotImplementedError + + @dbus_property_async("b") + def Active(self): + raise NotImplementedError + + @dbus_property_async("ao") + def Groups(self): + raise NotImplementedError + + class DBusObject(DBusInterface): + + def __init__(self, context: "Context"): + super().__init__(context) + self.export_to_dbus( + f"/dev/ezri/voidshell/workspaces/context/{context.name}" + ) + + class DBusProxy(DBusInterface): + + def __init__(self, name: str): + super().__init__() + if "/" in name: + self._proxify("dev.ezri.voidshell", name) + else: + self._proxify( + "dev.ezri.voidshell", + f"/dev/ezri/voidshell/workspaces/context/{name}", + ) + + def __init__(self, definition: ContextConfig): + super().__init__() + self.definition = definition + self.name = definition["name"] + self.groups = {group["name"]: Group(group) for group in definition["groups"]} + self.priority = int(self.definition.get("priority", 0)) + + async def score(self, outputs: list[OutputAdapter] = None): + + if outputs is None: + adapter = getBackend() + outputs = await adapter.getOutputs() + + return scoring.computePerfectScore(self.definition, outputs) + + async def activate(self): + pass + class Manager( GObject.Object, @@ -326,7 +441,7 @@ class Manager( self.tree = tree @dbus_signal_async() - def Updated(self): + async def Updated(self): raise NotImplementedError @dbus_method_async(input_signature="s", result_signature="s") diff --git a/voidshell/utilities/__pycache__/config.cpython-312.pyc b/voidshell/utilities/__pycache__/config.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ffcf008fb386b26655bebad63fab8f3e407b0281 GIT binary patch literal 1784 zcmZuxU1%Fe5T3msN!Fd?zu^AK@!54r8i#4_ZEA{vgX?j)aj(z&~5 zHx?=h)CC(_>_WlhDSmWtpy^Zc*g~PuzEpLL#L`F&z+q~!0~u{y7;~b@H_vAhSXB_&ZDvhCgi{*rr?kq!C7>KvX~PIw@HpvmUA)z z0p0~uUIa6?DTL9v*n*IbSI;EhaVrJ8I7bc7b}L%hs2D}7Y*jq1;8N|TYn#_*EXPUy z$-}17#FwTGZwBZ1CFU8YX zQ(AgFxReA&8f<>!5od6Xt_g|~`XPJ!|K+P~wO8Mka@tSYrL zjOH`@oz2W+j~VZAX3n!6+p{f}$p@qun_ckLyjz~dq6g)#zTDQ8vBPU!n1)?OaTl6O z*UH55L_-;_E5lEfk>Aw5mF#l1p$^s6q4n{HZ)|wq+<9+Hl2ecxUG@z(dZwk}=! zW%&BGdSh1v^|d|R1$-q05wtwtVl7_)8UI0}Kft4{fwxbB(qXT_6(DNvr$S9A@yH{i zMh?ntlA16N^puIdCV2@x@#}>e@p#>X5!s`dDmK3c`aW$c$r|3kqgEsa@5qr+3T}A2 z(Ud+q13)hyAAyYobo12k{qnssE@qo4?SA%NwvjqlPn~-r zZ>28skfz$*PzUPjz_vQL8wYii_98HRAtG#AI}+1xDwRN z@6vUnQgOZDk!HG1d6noOiU$yE7F30Db_9Y`i@l2CbJ*!Vx$1qTY)P*)PxO8^^;{C< zn`Af9DQoMKe*;coJP$=gaa}jvJSO1m_v5qp);soxA&AbRJw~lrm)V|67lP*}%s7I+ v2Ppi+`S2(gDRLS3?PMJ3u1E;^OAv^(mjH6|8NB!mhW?556YV*m2sZc+;k$(@ literal 0 HcmV?d00001 diff --git a/voidshell/utilities/config.py b/voidshell/utilities/config.py new file mode 100644 index 0000000..8bccfd5 --- /dev/null +++ b/voidshell/utilities/config.py @@ -0,0 +1,32 @@ +""" +Configuration management for VoidShell +""" + +import configparser +from pathlib import Path +from gi.repository import AstalIO + + +class Configuration: + + _scss_file: Path | None + css_file: Path + + def compile_scss(self): + if self._scss_file.is_file(): + AstalIO.Process.execv(["sass", str(self._scss_file), str(self.css_file)]) + + def __init__(self, config_file: Path): + + parser = configparser.ConfigParser() + parser.read(config_file) + + if "style" in parser and "stylesheet" in parser["style"]: + self.css_file = config_file / Path(parser["style"]) + else: + self.css_file = config_file / "style.css" + + if self.css_file.suffix == "scss": + self._scss_file = self.css_file + self.css_file = self._scss_file.with_suffix("css") + self.compile_scss() diff --git a/voidshell/versions.py b/voidshell/versions.py new file mode 100644 index 0000000..f09d7e6 --- /dev/null +++ b/voidshell/versions.py @@ -0,0 +1,13 @@ +import gi + +gi.require_version("AstalIO", "0.1") +gi.require_version("Astal", "3.0") +gi.require_version("Gtk", "3.0") +gi.require_version("Gdk", "3.0") +gi.require_version("Gio", "2.0") +gi.require_version("GObject", "2.0") + +_astal_libs = ["Apps", "Battery", "Bluetooth", "Mpris", "Notifd", "PowerProfiles", "Wp"] + +for lib in _astal_libs: + gi.require_version(f"Astal{lib}", "0.1")