huge updates

This commit is contained in:
sankalp committed 2025-02-21 21:03:31 +05:45
1 parent 0c595432bb
commit 348fba3f8d
14 files changed
+553 -612

No files matched your search

-27
View File
@@ -1,27 +0,0 @@
from fabric import Fabricator
from fabric.utils import exec_shell_command
from fabric.widgets.box import Box
from snippets import MaterialIcon
class IdleIndicator(Box):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.idle_icon = self.create_idle_icon()
self.fabricator = Fabricator(interval=1000, poll_from=self.check_idle_status)
self.children = [self.idle_icon]
def create_idle_icon(self):
return MaterialIcon("coffee", 16)
def check_idle_status(self, *_):
output = exec_shell_command("pidof wayland-idle-inhibitor.py")
is_idle = bool(str(output).strip())
self.update_idle_status(is_idle)
def update_idle_status(self, is_idle):
if is_idle:
self.idle_icon.set_visible(True)
else:
self.idle_icon.set_visible(False)
-44
View File
@@ -1,44 +0,0 @@
from fabric import Fabricator
from fabric.utils import exec_shell_command
from fabric.widgets.box import Box
from snippets import MaterialIcon
PROFILE_ICONS = {
"power-saver": "data_saver_on",
"balanced": None,
"performance": "mode_heat",
}
class PowerProfileIndicator(Box):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.profile_icon = None
self.fabricator = Fabricator(interval=1000, poll_from=self.update_power_profile)
def update_power_profile(self, *_):
profile = self.get_power_profile()
self.update_icon(profile)
return True
def get_power_profile(self):
result = exec_shell_command("powerprofilesctl get")
return result.strip() or "power-saver"
def update_icon(self, profile):
icon_name = PROFILE_ICONS.get(profile)
new_icon = MaterialIcon(icon_name, 16) if icon_name else None
if self.profile_icon:
self.remove(self.profile_icon)
if new_icon:
self.profile_icon = new_icon
self.add(self.profile_icon)
else:
if self.profile_icon:
self.profile_icon.hide()
self.profile_icon = None