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

Add cutomizable timer duration #319

Merged
merged 27 commits into from
Jul 5, 2024

Conversation

pakaoraki
Copy link
Collaborator

Add new "Timer" menu in preferences with customizable timer duration.

Screenshot from 2024-03-14 18-07-07 resized

This will close #296

@pakaoraki
Copy link
Collaborator Author

It look like there is some issues with my code, I can't fix PR right now, I will have more time tomorrow evening. Cheers

@stuarthayhurst
Copy link
Collaborator

stuarthayhurst commented Mar 14, 2024

I haven't looked at the code yet, but would it be better to store timer lengths using 1 key as an array, instead of 3 separate keys?

Also, if I remember correctly, red is supposed to be for destructive actions according to the GNOME Human Interface Guidelines I think it was? I don't know if that applies to extensions, but it might be worth considering to be consistent with the rest of GNOME.

Still, this is a clear improvement over the current system, nice work :)

@pakaoraki
Copy link
Collaborator Author

I haven't looked at the code yet, but would it be better to store timer lengths using 1 key as an array, instead of 3 separate keys?

Yes I totally agree, I was thinking the same. I just used a simple 'int' type for each duration but it need to be unified with a single key.

Also, if I remember correctly, red is supposed to be for destructive actions according to the GNOME Human Interface Guidelines I think it was? I don't know if that applies to extensions, but it might be worth considering to be consistent with the rest of GNOME.

It make sense, I hesitated to keep the red color anyway so I can remove it.

There are some other small improvements to make, I'll try to fix it all this evening or tomorrow for final review.

@pakaoraki
Copy link
Collaborator Author

There is a weird eslint issue:

/home/runner/work/gnome-shell-extension-caffeine/gnome-shell-extension-caffeine/caffeine@patapon.info/preferences/timerPage.js
283:13 error Expected property shorthand object-shorthand

The code is the same as line 66, but it cause an error only in line 283. Should I ignore this using /* eslint-disable object-shorthand */ and /* eslint-enable object-shorthand */ or did I miss something ?

@stuarthayhurst
Copy link
Collaborator

There is a weird eslint issue:

/home/runner/work/gnome-shell-extension-caffeine/gnome-shell-extension-caffeine/caffeine@patapon.info/preferences/timerPage.js
283:13 error Expected property shorthand object-shorthand

The code is the same as line 66, but it cause an error only in line 283. Should I ignore this using /* eslint-disable object-shorthand */ and /* eslint-enable object-shorthand */ or did I miss something ?

I think it's because the variables have different names, durationIndex and value. I think changing the name of value, or replacing value: value with value should do it?

@pakaoraki
Copy link
Collaborator Author

Thanks

caffeine@patapon.info/preferences/timerPage.js Outdated Show resolved Hide resolved
caffeine@patapon.info/preferences/timerPage.js Outdated Show resolved Hide resolved
@gabrbrand
Copy link

gabrbrand commented Mar 27, 2024

I manually installed this branch with make all on Fedora Rawhide (Gnome 46).
The stopwatch-symbolic currently isn't visible in dark style:
image
This can be fixed by moving caffeine@patapon.info/icons/stopwatch-symbolic.svg to caffeine@patapon.info/icons/hicolor/scalable/actions and changing

Gio.icon_new_for_string(`${this._path}/icons/${TimerMenuIcon}.svg`); 

to

Gio.icon_new_for_string(`${this._path}/icons/hicolor/scalable/actions/${TimerMenuIcon}.svg`);

in caffeine@patapon.info/extension.js (line 147)

@pakaoraki
Copy link
Collaborator Author

pakaoraki commented Mar 27, 2024

Thanks for reporting, icon fixed. Tested in Ubuntu 24.04 / Fedora 40.

@stuarthayhurst
Copy link
Collaborator

The pipeline failure seems to be eslint 9 complaining about arguments, we wouldn't need to try and fix it if we just drop the jsdoc stuff, since I don't think we don't really use it anyway

If we drop it we just need to update the makefile, workflow definition and linter configs

@pakaoraki
Copy link
Collaborator Author

I tried to remove the jsdoc plugin but it's seams that we need to rewrite the entire Eslint config for version 9.0 (migrate-to-9.0.0) as they changed the config file format.

Should we make a separate PR for this ?

@stuarthayhurst
Copy link
Collaborator

Should we make a separate PR for this ?

Yeah, probably a good idea

@matdave
Copy link

matdave commented Apr 29, 2024

This feature is awesome. I've been wanting long timers since I work on dual computers and need both on during my work day. This is saving me from having to remember to turn caffeine off at the end of my work day.

@pakaoraki pakaoraki force-pushed the change_timers branch 2 times, most recently from 7ef6741 to dd1222c Compare April 30, 2024 22:08
@pakaoraki
Copy link
Collaborator Author

@eonpatapon @stuarthayhurst
I think it's ready to merge, let me know if it's ok for you.

@stuarthayhurst
Copy link
Collaborator

Looks ok to me, do we want to merge this with a squash merge since there are a lot of small commits and fixes for previous commits?

pakaoraki added 3 commits May 27, 2024 12:46
Remove old code
Add missing leading zero and fix subtitle display hours

Fix variable name

Change countdown-timer to seconds
pakaoraki added 12 commits May 27, 2024 12:46
Fix translations
Fix spaces and syntax issues

Remove unused vars
Fix spacing

Remove trailling space

Fix object-shorthand

Fix spacing
Fix object-shorthand with value

Rename constant with uppercase

Symplify code

Replace Gtk.Switch/ActionRow with Adw.SwitchRow

Improve code: get durations values

Fix stopwatch icon

Update translations
Update locales

Update catalan translation
Simplify code and update locales
@stuarthayhurst
Copy link
Collaborator

Just a heads up, the locales don't need to be updated with every change if it's just line numbers that changed, it also makes reverting commits harder

I can't see anything else to change, LGTM. I'll rebase #334 when this is merged.

Copy link
Collaborator

@stuarthayhurst stuarthayhurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

This doesn't seem right, hours shouldn't be plural here (also applies when set to 1 minute).

@pakaoraki
Copy link
Collaborator Author

image

This doesn't seem right, hours shouldn't be plural here (also applies when set to 1 minute).

I fix it: it will display properly the plural only when it should. I also improve the code as you suggest. Let me know if you see somethings else.

@pakaoraki
Copy link
Collaborator Author

Just a heads up, the locales don't need to be updated with every change if it's just line numbers that changed, it also makes reverting commits harder

I can't see anything else to change, LGTM. I'll rebase #334 when this is merged.

Ok I will stop doing that, it's also make it easiest. Then, is translation reference update when installing the extension ?

@stuarthayhurst
Copy link
Collaborator

Just a heads up, the locales don't need to be updated with every change if it's just line numbers that changed, it also makes reverting commits harder
I can't see anything else to change, LGTM. I'll rebase #334 when this is merged.

Ok I will stop doing that, it's also make it easiest. Then, is translation reference update when installing the extension ?

Whoops, I missed the lines that did actually change in those commits, sorry. For my own extensions, I update the translations when a feature is completely ready since I find that simpler.

@stuarthayhurst
Copy link
Collaborator

I'll run this for a couple days and let you know if anything goes wrong, otherwise it's looking good :)

@stuarthayhurst stuarthayhurst merged commit bd97cf7 into eonpatapon:master Jul 5, 2024
3 checks passed
@foolishgrunt
Copy link

Super stoked to see this feature added! Any idea when we'll see a new release?

@stuarthayhurst
Copy link
Collaborator

Super stoked to see this feature added! Any idea when we'll see a new release?

Most likely with the release to add GNOME 47 support, which should be around September time. In the meantime, you could always build from source, you'll just have to increase the version number to match the current release, otherwise GNOME will 'update' it.

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

Successfully merging this pull request may close these issues.

longer timers
5 participants