Enhance LockScreen
This commit is contained in:
1 parent
746d6df1c8
commit
1f9f25c2c4
2 files changed
+26
-12
No files matched your search
@@ -1,7 +1,14 @@
|
||||
import gi, pam, fabric
|
||||
import gi, pam
|
||||
|
||||
gi.require_version("Gdk", "3.0")
|
||||
gi.require_version("Gtk", "3.0")
|
||||
|
||||
|
||||
gi.require_version("GtkSessionLock", "0.1")
|
||||
from gi.repository import Gdk, GtkSessionLock
|
||||
from gi.repository import (
|
||||
Gdk, # pyright: ignore[reportMissingModuleSource]
|
||||
GtkSessionLock, # pyright: ignore[reportAttributeAccessIssue]
|
||||
)
|
||||
|
||||
from fabric.widgets.window import Window
|
||||
|
||||
@@ -30,8 +37,8 @@ class IndicatorBox(Box):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(
|
||||
h_align="end",
|
||||
name="indicatorbox",
|
||||
spacing=5,
|
||||
name="indicator-box",
|
||||
spacing=9,
|
||||
h_expand=True,
|
||||
children=[
|
||||
BatteryIndicator(show_window=False),
|
||||
@@ -50,7 +57,7 @@ class ContentBox(CenterBox):
|
||||
v_align="center",
|
||||
visible=False,
|
||||
password=True,
|
||||
# on_activate=on_activate,
|
||||
on_activate=on_activate,
|
||||
)
|
||||
|
||||
self.password_entry.set_property("xalign", 0.5)
|
||||
@@ -92,7 +99,7 @@ class ContentBox(CenterBox):
|
||||
children=[
|
||||
Image(
|
||||
name="face-icon",
|
||||
image_file="/home/saumya/.face.icon",
|
||||
image_file=os.path.expanduser("~/.face.icon"),
|
||||
size=64,
|
||||
),
|
||||
],
|
||||
@@ -131,7 +138,7 @@ class LockScreen(Window):
|
||||
self.content = ContentBox(self.on_activate)
|
||||
super().__init__(
|
||||
title="lock",
|
||||
visible=True,
|
||||
visible=False,
|
||||
all_visible=False,
|
||||
name="lockscreen-bg",
|
||||
anchor="center",
|
||||
@@ -183,9 +190,12 @@ class LockScreen(Window):
|
||||
|
||||
def on_activate(self, entry: Entry, *args):
|
||||
if not pam.authenticate(getpass.getuser(), (entry.get_text() or "").strip()):
|
||||
entry.set_text("")
|
||||
entry.set_placeholder_text("Wrong Password")
|
||||
return
|
||||
self.lock.unlock_and_destroy()
|
||||
self.destroy()
|
||||
GLib.idle_add(app.quit) # schedules quit after unlock
|
||||
|
||||
|
||||
def initialize():
|
||||
@@ -194,15 +204,15 @@ def initialize():
|
||||
lockscreen = LockScreen(lock)
|
||||
lock.new_surface(
|
||||
lockscreen,
|
||||
Gdk.Display.get_default().get_monitor(
|
||||
Gdk.Display.get_default().get_monitor( # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess]
|
||||
0
|
||||
), # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess]
|
||||
),
|
||||
)
|
||||
lockscreen.show_all()
|
||||
lockscreen.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# initialize()
|
||||
initialize()
|
||||
lockscreen = LockScreen(GtkSessionLock.Lock())
|
||||
|
||||
app = Application("lock", lockscreen)
|
||||
|
||||
+5
-1
@@ -1,6 +1,10 @@
|
||||
#lockscreen-bg {
|
||||
background-size: cover;
|
||||
}
|
||||
#indicator-box {
|
||||
margin-right: 10px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
#container-box {
|
||||
min-height: 50px;
|
||||
min-width: 250px;
|
||||
@@ -42,7 +46,7 @@
|
||||
font-family: "SF Pro Rounded ";
|
||||
border: none;
|
||||
/* font-family: "SF Pro Rounded"; */
|
||||
font-size: 130px;
|
||||
font-size: 120px;
|
||||
margin-top: -20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user