Huge Updates
This commit is contained in:
30 files changed
+1421
-1260
No files matched your search
@@ -1,14 +1,14 @@
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.label import Label
|
||||
from fabric.widgets.button import Button
|
||||
from gi.repository import GLib
|
||||
|
||||
from snippets import MaterialIcon
|
||||
from fabric.utils.helpers import exec_shell_command_async
|
||||
import snippets.iconss as icons
|
||||
|
||||
|
||||
class PowerMenu(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(
|
||||
name="powermenu",
|
||||
name="power-menu",
|
||||
orientation="h",
|
||||
spacing=10,
|
||||
v_align="center",
|
||||
@@ -22,32 +22,32 @@ class PowerMenu(Box):
|
||||
self.launcher = kwargs["launcher"]
|
||||
|
||||
self.btn_lock = Button(
|
||||
name="powermenu-button",
|
||||
child=MaterialIcon("lock", 45),
|
||||
name="power-menu-button",
|
||||
child=Label(name="button-label", markup=icons.lock),
|
||||
on_clicked=self.lock,
|
||||
)
|
||||
|
||||
self.btn_suspend = Button(
|
||||
name="powermenu-button",
|
||||
child=MaterialIcon("sleep", 45),
|
||||
name="power-menu-button",
|
||||
child=Label(name="button-label", markup=icons.suspend),
|
||||
on_clicked=self.suspend,
|
||||
)
|
||||
|
||||
self.btn_logout = Button(
|
||||
name="powermenu-button",
|
||||
child=MaterialIcon("logout", 45),
|
||||
name="power-menu-button",
|
||||
child=Label(name="button-label", markup=icons.logout),
|
||||
on_clicked=self.logout,
|
||||
)
|
||||
|
||||
self.btn_reboot = Button(
|
||||
name="powermenu-button",
|
||||
child=MaterialIcon("restart_alt", 45),
|
||||
name="power-menu-button",
|
||||
child=Label(name="button-label", markup=icons.reboot),
|
||||
on_clicked=self.reboot,
|
||||
)
|
||||
|
||||
self.btn_shutdown = Button(
|
||||
name="powermenu-button",
|
||||
child=MaterialIcon("power_settings_new", 45),
|
||||
name="power-menu-button",
|
||||
child=Label(name="button-label", markup=icons.shutdown),
|
||||
on_clicked=self.poweroff,
|
||||
)
|
||||
|
||||
@@ -67,22 +67,23 @@ class PowerMenu(Box):
|
||||
def close_menu(self):
|
||||
self.launcher.close()
|
||||
|
||||
def lock(self, *_):
|
||||
GLib.spawn_command_line_async("hyprlock --immediate")
|
||||
def lock(self, *args):
|
||||
exec_shell_command_async("hyprlock --immediate")
|
||||
self.close_menu()
|
||||
|
||||
def suspend(self, *_):
|
||||
GLib.spawn_command_line_async("systemctl suspend")
|
||||
def suspend(self, *args):
|
||||
exec_shell_command_async("systemctl suspend")
|
||||
self.close_menu()
|
||||
|
||||
def logout(self, *_):
|
||||
GLib.spawn_command_line_async("hyprctl dispatch exit")
|
||||
def logout(self, *args):
|
||||
exec_shell_command_async("hyprctl dispatch exit")
|
||||
self.close_menu()
|
||||
|
||||
def reboot(self, *_):
|
||||
GLib.spawn_command_line_async("systemctl reboot")
|
||||
def reboot(self, *args):
|
||||
exec_shell_command_async("systemctl reboot")
|
||||
self.close_menu()
|
||||
|
||||
def poweroff(self, *_):
|
||||
GLib.spawn_command_line_async("systemctl poweroff")
|
||||
def poweroff(self, *args):
|
||||
exec_shell_command_async("systemctl poweroff")
|
||||
self.close_menu()
|
||||
|
||||
Reference in new issue
Block a user