Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions better-clock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Better Clock

A minimal digital clock desktop widget for Noctalia with customizable time and date format strings.

## Plugin

| Field | Value |
| --- | --- |
| ID | `yugaaank/better-clock` |
| Entries | Desktop widget: `clock` |

## Usage

The Better Clock plugin adds a desktop widget that displays the current time and optionally the date below it. The widget updates every 30 seconds and uses Noctalia's built-in `formatTime()` function for locale-aware formatting.

### Desktop Widget

Add the widget to your widget order in Noctalia settings to display it on your desktop.

## Settings

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `time_format` | `string` | `{:%H:%M}` | Luau date format for time, e.g. `{:%H:%M}` or `{:%I:%M %p}` |
| `date_format` | `string` | `{:%A, %B %d}` | Luau date format for date, e.g. `{:%A, %B %d}` |
| `show_date` | `bool` | `true` | Display the date below the time |
35 changes: 35 additions & 0 deletions better-clock/plugin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
id = "yugaaank/better-clock"
name = "Better Clock"
version = "1.0.0"
plugin_api = 19
author = "yugaaank"
license = "MIT"
dependencies = []
icon = "clock"
description = "A minimal digital clock desktop widget with customizable format."
tags = ["desktop", "clock", "time", "utility"]

[[setting]]
key = "time_format"
type = "string"
label_key = "settings.time_format.label"
description_key = "settings.time_format.description"
default = "{:%H:%M}"

[[setting]]
key = "date_format"
type = "string"
label_key = "settings.date_format.label"
description_key = "settings.date_format.description"
default = "{:%A, %B %d}"

[[setting]]
key = "show_date"
type = "bool"
label_key = "settings.show_date.label"
description_key = "settings.show_date.description"
default = true

[[desktop_widget]]
id = "clock"
entry = "widget.luau"
Binary file added better-clock/thumbnail.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions better-clock/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"settings": {
"time_format": {
"label": "Time Format",
"description": "Luau date format for time, e.g. {:%H:%M} or {:%I:%M %p}"
},
"date_format": {
"label": "Date Format",
"description": "Luau date format for date, e.g. {:%A, %B %d}"
},
"show_date": {
"label": "Show Date",
"description": "Display the date below the time"
}
}
}
36 changes: 36 additions & 0 deletions better-clock/widget.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
local settings = noctalia.settings
local root = ui.box({ direction = "column", hAlign = "center", vAlign = "center", spacing = 0 })

local time_label = ui.label({
text = "",
font = "monospace",
fontSize = 14,
color = "primary"
})

local date_label = ui.label({
text = "",
font = "monospace",
fontSize = 10,
color = "on_surface_variant"
})

local function update()
time_label.text = noctalia.formatTime(settings.time_format)
if settings.show_date then
date_label.text = noctalia.formatTime(settings.date_format)
date_label.visible = true
else
date_label.visible = false
end
end

noctalia.createTimer(30000, function()
update()
end)

update()
root:append(time_label)
root:append(date_label)

return root