Skip to content

Conversation

@DracoTomes
Copy link

As worked out in #1238 the switch from fieldsets::long() to fieldsets::medium() causes unsightly behavior on some locales. The feature to display the year was requested there and can cover up the ., combination.

image

@DracoTomes
Copy link
Author

Additional note: Yesterday when having a look at this I also tried out a match style pattern to make it easier to add more flags in the future. As a rust noob this required some ugly encapsulation and honestly I found the result harder to read and understand than the if/else structure currently in place.

let fs: CompositeDateTimeFieldSet = match(self.config.show_date_in_top_panel, self.config.show_weekday, self.config.show_seconds) {
    (true, true, true) => CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::MDET(fieldsets::MDET::medium())),
    (true, true, false) => CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::MDET(fieldsets::MDET::medium().with_time_precision(TimePrecision::Minute))),
    (true, false, true) => CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::MDT(fieldsets::MDT::medium())),
    (true, false, false) => CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::MDT(fieldsets::MDT::medium().with_time_precision(TimePrecision::Minute))),
    (false, false, true) => CompositeDateTimeFieldSet::Time(TimeFieldSet::T(fieldsets::T::medium())),
    _ => CompositeDateTimeFieldSet::Time(TimeFieldSet::T(fieldsets::T::medium().with_time_precision(TimePrecision::Minute))),
};
DateTimeFormatter::try_new(prefs, fs)
    .unwrap()
    .format(&datetime)
    .to_string()

Also so far I've compiled and ran that version of cosmic-applet-time from the shell which respected the config flags but I haven't found a way to test the vertical orientation yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant