diff --git a/timelet@linuxedo.com/README.md b/timelet@linuxedo.com/README.md index 26c50d7c4..dc29524cc 100644 --- a/timelet@linuxedo.com/README.md +++ b/timelet@linuxedo.com/README.md @@ -19,6 +19,7 @@ Install the fonts required by each theme for the best result. - Gotham: [GE Inspira](https://fontsgeek.com/fonts/GE-Inspira-Regular) - Jelly: [Roboto](https://fonts.google.com/specimen/Roboto) - Metro: [Ubuntu](https://fonts.google.com/specimen/Ubuntu) +- Modern: [Anurati](https://font.download/font/anurati), [Ubuntu](https://fonts.google.com/specimen/Ubuntu) ## Development diff --git a/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/modern.js b/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/modern.js new file mode 100644 index 000000000..15d6e12f4 --- /dev/null +++ b/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/modern.js @@ -0,0 +1,60 @@ +/* +* A themeable desklet that shows the time. +* +* Copyright (C) 2024 Gobinath +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +// Import dependencies +const St = imports.gi.St; +const GLib = imports.gi.GLib; +imports.searchPath.unshift(GLib.get_home_dir() + "/.local/share/cinnamon/desklets/timelet@linuxedo.com/themes"); +const Theme = imports.theme.Theme; + +/** + * Modern theme class. + */ +var ModernTheme = class ModernTheme extends Theme { + + constructor(config) { + super(config); + } + + getWidget() { + this._clockContainer = new St.BoxLayout({ vertical: true }); + + this._weekday = this.createLabel("Anurati", 72, "center"); + this._date = this.createLabel("Ubuntu", 20, "left"); + this._time = this.createLabel("Ubuntu", 20, "right"); + + this._weekday.style += "font-weight: 300;"; + this._date.style += "font-weight: 300; padding-top: 10px;"; + this._time.style += "font-weight: 300; padding-top: 10px;"; + + this._clockContainer.add(this._weekday, { x_fill: false, x_align: St.Align.MIDDLE }); + this._clockContainer.add(this._date, { x_fill: false, x_align: St.Align.MIDDLE }); + this._clockContainer.add(this._time, { x_fill: false, x_align: St.Align.MIDDLE }); + return this._clockContainer; + } + + setDateTime(date, locale) { + let time = this.to2Digit(this.is24H() ? date.getHours() : this.to12Hours(date.getHours())) + ":" + this.to2Digit(date.getMinutes()); + if (!this.is24H()) { + time += " " + this.toPeriod(date.getHours()); + } + this._weekday.set_text(this.formatDateTime(date, locale, { weekday: "long" }).toUpperCase()); + this._date.set_text(this.formatDateTime(date, locale, { day: "2-digit", month: "short", year: "numeric" })); + this._time.set_text("- " + time + " -"); + } +} \ No newline at end of file diff --git a/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/themes.js b/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/themes.js index 45d07c444..d9528a465 100644 --- a/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/themes.js +++ b/timelet@linuxedo.com/files/timelet@linuxedo.com/themes/themes.js @@ -24,6 +24,7 @@ const FlairTheme = imports.flair.FlairTheme; const GothamTheme = imports.gotham.GothamTheme; const JellyTheme = imports.jelly.JellyTheme; const MetroTheme = imports.metro.MetroTheme; +const ModernTheme = imports.modern.ModernTheme; /** * A factory class acts as a theme register. @@ -41,7 +42,7 @@ var Themes = class Themes { * @returns Return the list of registered theme names. */ static getThemeNames() { - return ["Digital", "Flair", "Gotham", "Jelly", "Metro"]; + return ["Digital", "Flair", "Gotham", "Jelly", "Metro", "Modern"]; } /** @@ -61,6 +62,8 @@ var Themes = class Themes { return new JellyTheme(config); } else if (themeName == "Metro") { return new MetroTheme(config); + } else if (themeName == "Modern") { + return new ModernTheme(config); } } } \ No newline at end of file diff --git a/timelet@linuxedo.com/screenshot.png b/timelet@linuxedo.com/screenshot.png index 866b177b7..4d7eb8094 100644 Binary files a/timelet@linuxedo.com/screenshot.png and b/timelet@linuxedo.com/screenshot.png differ