Hi community,
I'm writing a small applet for cinnamon and I need to prompt for password into the applet's configuration dialog.
Do it exist any option7property to set on the "entry" widget to hide text using a "password" character ?
Thanks for any hint on the topic and cheers,
NeD
Applet password input option
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Applet password input option
Last edited by SMG on Thu Dec 07, 2023 10:43 am, edited 1 time in total.
Reason: Moved from Software & Applications to Programming & Development because the question relates to writing an applet for Cinnamon.
Reason: Moved from Software & Applications to Programming & Development because the question relates to writing an applet for Cinnamon.
Re: Applet password input option
there is systemd-ask-password, see man 1, and plymouth for that matter as well.
-=t42=-
Re: Applet password input option
How are you building the configuration dialog? Is it using the default controls available through settings.json, or are you using some custom Python script(s)?
For the latter you can use Gtk.Entry's features. Example:
Code: Select all
cPass = Gtk.Entry(hexpand=True)
cPass.set_visibility(False)
cPass.set_invisible_char("●") # can be replaced with asterisk or anything else
cPass.set_input_purpose(Gtk.InputPurpose.PASSWORD)
password = cPass.get_text()
.You can also add a toggle button in case the user wants to see the actual password:
Code: Select all
cPasRev = Gtk.ToggleButton(label="👁") # pass revealer button
cPasRev.connect("toggled", passVisible, cPass)
def passVisible(self, button, passfield):
"""Password field visibility toggle."""
is_active = btn.get_active()
passfield.set_visibility(is_active)
I may be wrong - please someone correct me if so - but I think there is no way to add a password-type entry control to the configuration dialog using the currently available default options provided by settings.json.
Codeberg repo; old: @GitLab