Set Fallback to prevent lockscreen from crashing
This commit is contained in:
1 parent
463ef0cc49
commit
a0f54979a0
1 file changed
+6
-1
@@ -60,6 +60,9 @@ class ContentBox(CenterBox):
|
|||||||
on_activate=on_activate,
|
on_activate=on_activate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
face_icon = os.path.expanduser("~/.face.icon")
|
||||||
|
if not os.path.exists(face_icon):
|
||||||
|
face_icon = get_relative_path("./assets/default.png")
|
||||||
self.password_entry.set_property("xalign", 0.5)
|
self.password_entry.set_property("xalign", 0.5)
|
||||||
self.username_label = Label(
|
self.username_label = Label(
|
||||||
label=f"{getpass.getuser().title()}",
|
label=f"{getpass.getuser().title()}",
|
||||||
@@ -99,7 +102,7 @@ class ContentBox(CenterBox):
|
|||||||
children=[
|
children=[
|
||||||
Image(
|
Image(
|
||||||
name="face-icon",
|
name="face-icon",
|
||||||
image_file=os.path.expanduser("~/.face.icon"),
|
image_file=face_icon,
|
||||||
size=64,
|
size=64,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -149,6 +152,8 @@ class LockScreen(Window):
|
|||||||
self.connect("key-press-event", self._on_keypress)
|
self.connect("key-press-event", self._on_keypress)
|
||||||
|
|
||||||
bg = os.path.expanduser("~/.current.wall")
|
bg = os.path.expanduser("~/.current.wall")
|
||||||
|
if not os.path.exists(bg):
|
||||||
|
bg = get_relative_path("./assets/wallpapers_example/example-1.png")
|
||||||
self.set_style(f"background-image: url('{bg}');")
|
self.set_style(f"background-image: url('{bg}');")
|
||||||
|
|
||||||
def _on_keypress(self, widget, event):
|
def _on_keypress(self, widget, event):
|
||||||
|
|||||||
Reference in new issue
Block a user