Skip to content

Commit

Permalink
Issue #124/PR #125: sort alphabetically by default
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertMueller2 authored and apognu committed Apr 26, 2024
1 parent c658c77 commit c186f0b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ Options:
remember last selected session
--remember-user-session
remember last selected session for each user
--sort-sessions
sort sessions alphabetically
--user-menu allow graphical selection of users from a menu
--user-menu-min-uid UID
minimum UID to display in the user selection menu
Expand Down
4 changes: 0 additions & 4 deletions src/greeter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ pub struct Greeter {
pub remember_session: bool,
// Whether last launched session for the current user should be remembered.
pub remember_user_session: bool,
// Whether to sort sessions alphabetically.
pub sort_sessions: bool,

// Greeting message (MOTD) to use to welcome the user.
pub greeting: Option<String>,
Expand Down Expand Up @@ -369,7 +367,6 @@ impl Greeter {
opts.optflag("r", "remember", "remember last logged-in username");
opts.optflag("", "remember-session", "remember last selected session");
opts.optflag("", "remember-user-session", "remember last selected session for each user");
opts.optflag("", "sort-sessions", "sort sessions alphabetically");
opts.optflag("", "user-menu", "allow graphical selection of users from a menu");
opts.optopt("", "user-menu-min-uid", "minimum UID to display in the user selection menu", "UID");
opts.optopt("", "user-menu-max-uid", "maximum UID to display in the user selection menu", "UID");
Expand Down Expand Up @@ -483,7 +480,6 @@ impl Greeter {
self.remember = self.config().opt_present("remember");
self.remember_session = self.config().opt_present("remember-session");
self.remember_user_session = self.config().opt_present("remember-user-session");
self.sort_sessions = self.config().opt_present("sort-sessions");
self.greeting = self.option("greeting");

// If the `--cmd` argument is provided, it will override the selected session.
Expand Down
4 changes: 1 addition & 3 deletions src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ pub fn get_sessions(greeter: &Greeter) -> Result<Vec<Session>, Box<dyn Error>> {
}
}

if greeter.sort_sessions {
files.sort_by(|a, b| a.name.cmp(&b.name));
}
files.sort_by(|a, b| a.name.cmp(&b.name));

Ok(files)
}
Expand Down

0 comments on commit c186f0b

Please sign in to comment.