Skip to content

Commit

Permalink
Road to 1.0.0 (#35)
Browse files Browse the repository at this point in the history
* Create FUNDING.yml

* PERF/circadian.el: use memoized sunset & sunrise times (#29)

* Update issue templates

* EDIT: ignore :sunrise and :sunset, if calendar lat/lng settings are missing

* FIX: correct testing, filter :sunrise and :sunset if calendar lat/lng is not set

* FIX/test.el: re-enable test-circadian-setup-benchmark

* FIX/test.el: move timezone test to the end as it changes lat lng

* EDIT: check for theme lists to support #16

* FIX/test.el: typo

* FIX 28: emacs is freezed at switch (#31)

* EDIT/circadian.el: add print statement to circadian-activate-latest-theme

* FIX: potential fix for #28

* FIX/test.el: move timezone test to end

* EDIT/.github/workflows/ci.yml: drop Emacs 26.3 support

* EDIT/circadian.el: moved check for already enabled theme from `circadian-enable-theme` to `circadian-activate-latest-theme`

* EDIT: cleanup

* FIX: after merge

* FIX: remove print statements, make sure timer runs only once

* FIX: timer issue + rename circadian-activate-latest-theme to circadian-activate

* FIX/circadian.el: proper use of new `circadian-activate-and-schedule`

* FIX/test.el: adjust tests to use new API

* DOC/README.md: adjust usage section

* DOC/README.md

* FIX: use format-time-string

* FIX: improve timer scheduling

* FIX: wrong function in timer

* FIX: solve recursive timer calls with timer variable + cancel-timer

* FIX/DOC/README.md: proper inner list for random selection from theme list

* FIX: endless loop #33 + code cleanup, adjust tests

* EDIT: introduce circadian-verbose + circadian-stop

* FIX: cleanup, remove circadian-- prefix in favor of single dash prefix

* FIX: disable-theme only if requested theme is not part of custom-enabled-themes

* FIX: check if next run is today or tomorrow

* EDIT/test.el: extend test-circadian-time-comparisons

* FIX/circadian.el: ensure a single timer + timer is always set

* EDIT/README.md: hint about `circadian-verbose`

* FIX #32: proper time zone settings according to Emacs documentation

* EDIT/circadian.el: remove print statement

* FIX/test.el

* UPGRADE/.github: upgrade actions/checkout + actions/cache to version 4

* FIX/circadian.el: check for timer nil + enable theme -> set timer to nil

* FIX/circadian.el: proper canceling of previous timer

* EDIT/circadian.el: update version in comment

---------

Co-authored-by: StrawberryTea <[email protected]>
  • Loading branch information
guidoschmidt and LemonBreezes authored Jun 3, 2024
1 parent 9959e4b commit 7646441
Show file tree
Hide file tree
Showing 7 changed files with 360 additions and 121 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: guidoschmidt
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to report a bug in circadian.el
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. macOS 14, Windows 11, Ubuntu etc.]
- Emacs: [e.g. emacs-plus 30.0.50]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ jobs:
strategy:
matrix:
emacs-version:
- 26.3
- 27.2
- 28.2
- 29.3
- snapshot
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs-version }}

- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache-cask-packages
with:
path: .cask
key: cache-cask-packages-000

- uses: actions/cache@v2
- uses: actions/cache@v4
id: cache-cask-executable
with:
path: ~/.cask
Expand Down
87 changes: 62 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<h3 align="center">Theme-switching for Emacs based on daytime</h3>
</p>

### Conception
## Conception

Circadian tries to help reducing eye strain that may arise
from difference of your display brightness and the
Expand All @@ -31,9 +31,63 @@ adaption software like:

---

### Example usage
## Usage & Configuration
Install circadian.el with
[use-package](https://www.gnu.org/software/emacs/manual/html_mono/use-package.html)
or [straight.el](https://github.com/radian-software/straight.el)

##### Switching themes on time of day
### Configuration with times
To auto-switch a theme on a specific time, use time strings:

```elisp
(use-package circadian
:ensure t
:config
(setq circadian-themes '(("8:00" . wombat)
("19:30" . adwaita)))
(circadian-setup))
```


### Configuration with `:sunrise` and `:sunset`
To auto-switch a theme based on your current locations sunrise and sunset times:

1. Make sure to set your latitude and longitude (Get them e.g. at
[latlong.net](https://www.latlong.net/)):
```elisp
(setq calendar-latitude 40.712776)
(setq calendar-longitude -74.005974)
```
2. Configure `circadian-themes` using the `:sunset` and `:sunset`
```elisp
(use-package circadian
:ensure t
:config
(setq circadian-themes '((:sunrise . adwaita)
(:sunset . wombat)))
(circadian-setup))
```


### Randomly selection from theme list
Circadian.el can randomly select a theme from a given list, e.g here using [doom-themes](https://github.com/doomemacs/themes) at sunset:

```elisp
(use-package doom-themes)
(use-package circadian
:config
(setq circadian-themes '((:sunrise . doom-gruvbox-light)
(:sunset . (doom-dracula doom-gruvbox))))
(add-hook 'emacs-startup-hook #'circadian-setup)
(circadian-setup))
```


### Use with custom themes
To use custom themes, install them from MELPA using
e.g. [use-package](https://www.gnu.org/software/emacs/manual/html_mono/use-package.html)
or [straight.el](https://github.com/radian-software/straight.el).

Example usage featuring [hemera-themes](https://github.com/GuidoSchmidt/emacs-hemera-theme)
and [nyx-theme](https://github.com/GuidoSchmidt/emacs-nyx-theme) (with use-package). Make sure
Expand All @@ -45,33 +99,16 @@ to use `:defer` keyword. Omitting it may lead to broken colors
;; make sure to use :defer keyword
(use-package hemera-theme :ensure :defer)
(use-package nyx-theme :ensure :defer)
(use-package circadian
:ensure t
:config
(setq circadian-themes '(("8:00" . hemera)
("19:30" . nyx)))
(circadian-setup))
```

##### Switching themes on sunrise & sunset

Be sure to set your latitude and longitude (Get them e.g. at [latlong.net](https://www.latlong.net/)):
### Verbose messages
By default circadian will not log any messages. however for development or just
getting more information, one can enable a more verbose message log:

```elisp
;; Install additinal themes from melpa
;; make sure to use :defer keyword
(use-package apropospriate-theme :ensure :defer)
(use-package nord-theme :ensure :defer)
(setq circadian-verbose t)
(use-package circadian
:ensure t
:config
(setq calendar-latitude 49.0)
(setq calendar-longitude 8.5)
(setq circadian-themes '((:sunrise . apropospriate-light)
(:sunset . nord)))
(circadian-setup))
```

---
Expand Down Expand Up @@ -107,7 +144,7 @@ e.g. I like to override any themes cursor color to a very bright color via:

---

### Development
### Development & Testing

Install Emacs [cask](https://github.com/cask/cask) environment. On macOS you
canr use [homebrew](https://brew.sh/) with: `brew install cask`.
Expand Down
Loading

0 comments on commit 7646441

Please sign in to comment.