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

Ability to change keyboard shortcuts via config.json #600

Merged
merged 4 commits into from
Jun 13, 2020
Merged

Ability to change keyboard shortcuts via config.json #600

merged 4 commits into from
Jun 13, 2020

Conversation

balazsnasz
Copy link
Contributor

@balazsnasz balazsnasz commented May 29, 2020

Added ability to change the keyboard shortcuts for Skip/Postpone breaks via config.json

Issue: closes #594
closes #497

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • issue was opened to discuss proposed changes before starting implementation.
  • during development, node version specified in package.json was used (ie using nvm).
  • package versions and package-lock.json were not changed (npm install --no-save).
  • app version number was not changed.
  • all new code has tests to ensure against regressions.
  • npm run lint reports no offenses.
  • npm run test is error-free.
  • README and CHANGELOG were updated accordingly.

Description of the Change

I added the ability to change the keyboard shortcuts for Skip/Postpone breaks via config.json.
The default is still Cmd/Ctrl + X, but you can change to Alt, Shift, Cmd/Ctrl, and any a-z A-Z 0-9 keyboard shortcuts.

GUI is coming soon in a different PR.
Be careful when you accept this PR because it will have a conflict with the Hardcore Mode PR (#597 & #599). I changed the on('progress') parts for both of those - I added parameters to the function, so be careful to keep the order in all of the occurrences.

Verification Process

Other information

@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #600 into redesign will increase coverage by 0.23%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           redesign     #600      +/-   ##
============================================
+ Coverage     52.14%   52.38%   +0.23%     
============================================
  Files            16       15       -1     
  Lines           861      859       -2     
============================================
+ Hits            449      450       +1     
+ Misses          412      409       -3     
Impacted Files Coverage Δ
app/main.js 34.70% <0.00%> (-0.60%) ⬇️
app/utils/defaultSettings.js 100.00% <ø> (ø)
app/utils/utils.js 65.95% <0.00%> (-27.99%) ⬇️
app/process.js
app/breaksPlanner.js 32.06% <0.00%> (+3.81%) ⬆️
app/utils/untilMorning.js 100.00% <0.00%> (+4.76%) ⬆️
app/utils/naturalBreaksManager.js 88.23% <0.00%> (+5.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73e6f2c...807bfcb. Read the comment docs.

@hovancik
Copy link
Owner

hovancik commented Jun 11, 2020

@balazsnasz I've made some changes to your code:

  • more generic name for shortcut, as there will be more of them in future
  • no validation and let Electron take care of that, so we have more options for values
  • added test
  • simplify some code
  • add readme

I think I can merge if it looks good to you.

@balazsnasz
Copy link
Contributor Author

@hovancik I checked it, and it seems fine. You can merge it.

@hovancik
Copy link
Owner

Now I am thinking, maybe I should just have shortcut, without separating it to key and modifier...

Not sure if I'll ever need them separated, and even then it's easy to split by +

@balazsnasz
Copy link
Contributor Author

Probably we won't ever need them separately. But when you think about creating the GUI for this feature, it's a little easier to update the separate setting values than updating them together.

I thought I would build the GUI like this:
[Modifier Dropdown] + [Key Dropdown]

Setting (e.g. saving) Dropdowns is already implemented in the Preferences & Contributor Preferences windows, so it would easy to add such interface elements.
However if we'd have one config element (like shortcut or so), we would handle the saving/loading the element's values as an exception.

Not that big issue though, so if you think we should have only one config item, then it's fine.

@hovancik
Copy link
Owner

I've check for example Atom, and they have no UI to change shortcuts, only ability to edit config file. I went with more simple solution over premature optimization. There will need to be research about how shortcuts are managed in UI elsewhere, if there is need for it.

@hovancik hovancik merged commit 7f122bd into hovancik:redesign Jun 13, 2020
@balazsnasz balazsnasz deleted the keyboard-shortcuts branch July 26, 2023 23:58
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.

2 participants