Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date Format with custom uppercase & spaces #36

Closed
CrimsonBloodfang opened this issue Feb 3, 2023 · 2 comments
Closed

Date Format with custom uppercase & spaces #36

CrimsonBloodfang opened this issue Feb 3, 2023 · 2 comments

Comments

@CrimsonBloodfang
Copy link

Hello, I'm trying to use the font Anurati for the date format (%A) in background clock and I don't know how to make it all in uppercase. I also need each letter to have a space from each other.

As you can see, just placing %A doesn't showcase the full design of uppercase fonts like Anurati. I guess GNOME just provides the default lowercase fonts for custom fonts that don't have any?
image

Ideally, I would love to see it like this with a space in between each letter.
image

If there are no spaces, the Anurati font would look like this.
image

I would really like an option in the extension for these specific use cases. If there are workarounds in the meantime, I'd like to know about it.

@Aylur
Copy link
Owner

Aylur commented Feb 3, 2023

I am using GLib.DateTime.format which can't do things like this. You would need a function to return a custom string based on the day.
in ~/.local/share/gnome-shell/extensions/widgets@aylur/widgets/backgroundClock.js at line 165

    _updateClock(){
        let clock = GLib.DateTime.new_now_local().format(this._clockFormat);
        // let date = GLib.DateTime.new_now_local().format(this._dateFormat);

        this._clock.set_text(clock);
        // this._date.set_text(date);
        this._date.set_text(this._formatDay());
    }

    _formatDay(){
        //number between 1-7 as string
        let day = GLib.DateTime.new_now_local().format('%u');

        switch (day) {
            case '1': return 'M O N D A Y';
            case '2': return 'T U E S D A Y';
            //
            default: return '';
        }
    }

@CrimsonBloodfang
Copy link
Author

@Aylur Thank you! It worked perfectly.

@Aylur Aylur closed this as completed Feb 3, 2023
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

No branches or pull requests

2 participants