feat: Adding the option to display year in time applet#1243
Open
DracoTomes wants to merge 2 commits intopop-os:masterfrom
Open
feat: Adding the option to display year in time applet#1243DracoTomes wants to merge 2 commits intopop-os:masterfrom
DracoTomes wants to merge 2 commits intopop-os:masterfrom
Conversation
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As worked out in #1238 the switch from
fieldsets::long()tofieldsets::medium()causes unsightly behavior on some locales. The feature to display the year was requested there and can cover up the.,combination.