Skip to content

phrozen/digital-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon

digital-clock

A cross platform digital clock widget overlay written in Go. It stays always on top of other windows in your desktop and can be customized to show different formats and styles.

Although a very simple app, the motivation was to have a cross platform customizable clock that could be used as a status bar widget, with UTC support and that shows seconds (you would be surprised how few apps out there support this... if any). After some hours of scouring the web for an app, it was clear that there is none that fits my needs, so I decided to write one.

It uses ebiten, a lightweight and portable Go library for real-time, high-performance 2D games, widgets and visualizations for showing the clock on screen.

It also uses systray, a cross platform library for system tray apps written in Go, which is used to create the icon and menu.

Configuration

Default configuration file will be created in ./config.toml on first run. If a different configuration file needs to be used, pass the -config flag with the path of the configuration file. On parsing errors, default configuration is loaded, if that happens, check your file.

# Default Configuration

Seconds = true
Timezone = false
UTC = false
Hours24 = false
FontSize = 64.0

[FontColor]
  R = 255
  G = 255
  B = 255
  A = 255

[Background]
  R = 0
  G = 0
  B = 0
  A = 128

When changing the configuration file, click Reload from the system tray icon context menu to reload it and show the changes, no need to restart.

Building from source

Windows

Youcan just go build to get the application, but ideally you want it to have an icon and not show a console window. For that, follow the steps below:

  1. Install Go and a C compiler toolchain (CGO is needed for systray)
  2. Install rsrc: go install github.com/akavel/rsrc@latest
  3. Generate .syso resource file: rsrc -arch amd64 -ico tray\icon.ico
  4. Build with GUI flags: go build -ldflags="-H windowsgui"

This will get you the binary with an icon and it does not show a window on the taskbar when run.

Mac OSX

Coming Soon

Linux

To build on Ubuntu/Linux, install the following dependencies for the hajimehoshi/ebiten package:

sudo apt install libc6-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev libasound2-dev pkg-config

For more information, refer to the official hajimehoshi/ebiten documentation.

Install Go dependencies:

go get ./...

Build the binary:

go build

Usage

Simply run the binary to display the clock on your screen. The clock will remain on top of other windows and can be moved by dragging.

Credits

All graphic resources are free for personal use and are embedded with the binary when compiled:

  • Font: digital-7.mono by Sizenko Alexander - Style-7
  • Icon: Digital-clock icons created by Freepik - Flatico

About

A cross platform digital clock widget overlay written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •