mirror of https://github.com/fairyglade/ly.git
Add option to change enter key behaviour
This commit is contained in:
parent
4ee2b3ecc7
commit
96e089143b
|
|
@ -75,6 +75,10 @@
|
||||||
# File in which to save and load the default desktop and login
|
# File in which to save and load the default desktop and login
|
||||||
#save_file = /etc/ly/save
|
#save_file = /etc/ly/save
|
||||||
|
|
||||||
|
# If true, pressing enter will login regardless of current input box. If false, pressing enter will only login if the current
|
||||||
|
# input box is for the password. Otherwise it will go to next input box.
|
||||||
|
#enter_is_login = true
|
||||||
|
|
||||||
|
|
||||||
# Remove power management command hints
|
# Remove power management command hints
|
||||||
#hide_key_hints = false
|
#hide_key_hints = false
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,7 @@ void config_load(const char *cfg_path)
|
||||||
{"clock", &config.clock, config_handle_str},
|
{"clock", &config.clock, config_handle_str},
|
||||||
{"console_dev", &config.console_dev, config_handle_str},
|
{"console_dev", &config.console_dev, config_handle_str},
|
||||||
{"default_input", &config.default_input, config_handle_u8},
|
{"default_input", &config.default_input, config_handle_u8},
|
||||||
|
{"enter_is_login", &config.enter_is_login, config_handle_bool},
|
||||||
{"fg", &config.fg, config_handle_u8},
|
{"fg", &config.fg, config_handle_u8},
|
||||||
{"hide_borders", &config.hide_borders, config_handle_bool},
|
{"hide_borders", &config.hide_borders, config_handle_bool},
|
||||||
{"hide_key_hints", &config.hide_key_hints, config_handle_bool},
|
{"hide_key_hints", &config.hide_key_hints, config_handle_bool},
|
||||||
|
|
@ -279,6 +280,7 @@ void config_defaults()
|
||||||
config.clock = NULL;
|
config.clock = NULL;
|
||||||
config.console_dev = strdup("/dev/console");
|
config.console_dev = strdup("/dev/console");
|
||||||
config.default_input = LOGIN_INPUT;
|
config.default_input = LOGIN_INPUT;
|
||||||
|
config.enter_is_login = true;
|
||||||
config.fg = 9;
|
config.fg = 9;
|
||||||
config.hide_borders = false;
|
config.hide_borders = false;
|
||||||
config.hide_key_hints = false;
|
config.hide_key_hints = false;
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ struct config
|
||||||
char* clock;
|
char* clock;
|
||||||
char* console_dev;
|
char* console_dev;
|
||||||
uint8_t default_input;
|
uint8_t default_input;
|
||||||
|
bool enter_is_login;
|
||||||
uint8_t fg;
|
uint8_t fg;
|
||||||
bool hide_borders;
|
bool hide_borders;
|
||||||
bool hide_key_hints;
|
bool hide_key_hints;
|
||||||
|
|
|
||||||
49
src/main.c
49
src/main.c
|
|
@ -313,35 +313,44 @@ int main(int argc, char** argv)
|
||||||
update = true;
|
update = true;
|
||||||
break;
|
break;
|
||||||
case TB_KEY_ENTER:
|
case TB_KEY_ENTER:
|
||||||
save(&desktop, &login);
|
if (config.enter_is_login || active_input == PASSWORD_INPUT)
|
||||||
auth(&desktop, &login, &password, &buf);
|
|
||||||
update = true;
|
|
||||||
|
|
||||||
if (dgn_catch())
|
|
||||||
{
|
{
|
||||||
++auth_fails;
|
save(&desktop, &login);
|
||||||
// move focus back to password input
|
auth(&desktop, &login, &password, &buf);
|
||||||
active_input = PASSWORD_INPUT;
|
update = true;
|
||||||
|
|
||||||
if (dgn_output_code() != DGN_PAM)
|
if (dgn_catch())
|
||||||
{
|
{
|
||||||
buf.info_line = dgn_output_log();
|
++auth_fails;
|
||||||
|
// move focus back to password input
|
||||||
|
active_input = PASSWORD_INPUT;
|
||||||
|
|
||||||
|
if (dgn_output_code() != DGN_PAM)
|
||||||
|
{
|
||||||
|
buf.info_line = dgn_output_log();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.blank_password)
|
||||||
|
{
|
||||||
|
input_text_clear(&password);
|
||||||
|
}
|
||||||
|
|
||||||
|
dgn_reset();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf.info_line = lang.logout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.blank_password)
|
load(&desktop, &login);
|
||||||
{
|
system("tput cnorm");
|
||||||
input_text_clear(&password);
|
|
||||||
}
|
|
||||||
|
|
||||||
dgn_reset();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf.info_line = lang.logout;
|
++active_input;
|
||||||
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
load(&desktop, &login);
|
|
||||||
system("tput cnorm");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
(*input_handles[active_input])(
|
(*input_handles[active_input])(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue