Skip to content

Preferences: New UI, Theme Pane implementation, Persistence to ~/.codeedit/ Folder - #343

Merged
lukepistrol merged 34 commits into
CodeEditApp:mainfrom
lukepistrol:feature/prefs-themes
Apr 2, 2022
Merged

lukepistrol merged 34 commits into
CodeEditApp:mainfrom
lukepistrol:feature/prefs-themes

Conversation

@lukepistrol

@lukepistrol lukepistrol commented Mar 31, 2022 •

Copy link
Copy Markdown
Member

Description

Changes to Preferences

This PR implements a complete redesign of the Preferences window, coupled with a new way to persist settings. Instead of using UserDefaults settings are now saved to ~/.codeedit/preferences.json. This way one can easily export or import settings manually. It's also possible to sync it across devices using Dotfiles Workflows.

The main focus of the redesign is the window itself with a new toolbar selector on top (just like Xcode) to navigate to the different sections. Further the Themes section is implemented how it was discussed in #286. The thumbnails of the themes in the sidebar are adaptive to color changes.

The Editor itself will not adapt to theme changes yet since its implementation is yet work-in-progress
Therefore the Preview tab in the Theme section is not yet implemented.

Theme-specific changes

Themes are saved in ~/.codeedit/themes/ as a ThemeName.json file. A default theme is provided bundled within the app and gets saved the first time preferences are opened. A template for themes can be found here.

When a theme gets edited, changes get saved in ~/.codeedit/preferences.json under "theme" > "overrides" > "theme_name". When a theme gets loaded it will override the values found there.

When a theme was reset, the override properties of this theme get deleted in the preferences.json file.

When a theme was gets deleted, the original theme_name.json file in ~/.codeedit/themes/ is deleted.

TODOs

  • Preferences UI overhaul
  • Selectable themes.
  • Use preferences.json instead of UserDefaults for persisting settings.
  • Don't overwrite themes when changing colors. Use preferences.jsons overrides instead.
  • Reset themes (right click > Reset Theme)
  • Implement remaining terminal colors.
  • Delete themes.
  • Enable list view in themes sidebar.
  • Font selector for editor. (not yet functional since new Editor is not implemented yet)
  • Documentation. (partly done)
    - [ ] Duplicate themes. (will be implemented later)
    - [ ] Sort themes by category: Bundled, Community, Custom. (will be implemented later)

Releated Issue

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • Review requested

Screenshots

Editor Theme Settings / Icon Mode

Screen Shot 2022-04-02 at 17 25 22

Terminal Theme Settings / List Mode

Screen Shot 2022-04-02 at 17 25 37

Changing Colors -> Previews

Screen.Recording.2022-03-31.at.14.23.22.mov

Terminal Tab

Screen Shot 2022-04-02 at 17 25 54

Text Editing Tab

Screen Shot 2022-04-02 at 17 26 46

Folder structure of ~/.codeedit/

Screen Shot 2022-04-01 at 14 12 55

~/.codeedit/preferences.json

Screen.Recording.2022-04-01.at.09.54.50.mov

Reset/Delete Theme

Screen Shot 2022-04-02 at 17 26 20

@lukepistrol lukepistrol added enhancement New feature or request UI This is UI related labels Mar 31, 2022
@lukepistrol lukepistrol linked an issue Mar 31, 2022 that may be closed by this pull request
@Angelk90

Copy link
Copy Markdown
Contributor

@lukepistrol : Great job, how come the Editor and Preview are empty and are there in the video?

@lukepistrol

Copy link
Copy Markdown
Member Author

@lukepistrol : Great job, how come the Editor and Preview are empty and are there in the video?

You need to select a theme.

@Angelk90

Copy link
Copy Markdown
Contributor

@lukepistrol : From where?

Schermata 2022-03-31 alle 15 26 28

@lukepistrol

Copy link
Copy Markdown
Member Author

@Angelk90 pull again and try now

@Angelk90

Angelk90 commented Mar 31, 2022 •

Copy link
Copy Markdown
Contributor

@lukepistrol :

This is what I see:

Registrazione.schermo.2022-03-31.alle.15.36.58.mov

Considerations:

  • Once the theme colors are changed, I can't reset them anymore, right?
  • The button is a theme background, it does not deactivate, is there a reason?

@lukepistrol

Copy link
Copy Markdown
Member Author
  • Once the theme colors are changed, I can't reset them anymore, right?

Not yet.

  • The button is a theme background, it does not deactivate, is there a reason?

Not yet implemented. The whole thing is WIP!

@lukepistrol lukepistrol changed the title [WIP] Preferences: Theme Pane implementation [WIP] Preferences: New UI, Theme Pane implementation, Persistence to ~/.codeedit/ Folder Apr 1, 2022
@lukepistrol lukepistrol self-assigned this Apr 2, 2022
@lukepistrol
lukepistrol marked this pull request as ready for review April 2, 2022 15:32
@lukepistrol
lukepistrol requested a review from 0xWDG April 2, 2022 15:38

@0xWDG 0xWDG left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, πŸ₯‡

@lukepistrol lukepistrol changed the title [WIP] Preferences: New UI, Theme Pane implementation, Persistence to ~/.codeedit/ Folder Preferences: New UI, Theme Pane implementation, Persistence to ~/.codeedit/ Folder Apr 2, 2022
@lukepistrol lukepistrol removed the WIP This is work-in-progress label Apr 2, 2022
@Angelk90

Angelk90 commented Apr 2, 2022 •

Copy link
Copy Markdown
Contributor

@lukepistrol :
Deleting the theme seems to give some problems, I have deleted the theme from the program.
In fact in the folder there is no more, but it continues to show me the theme.

Schermata 2022-04-02 alle 18 06 15

Reset:

Error Domain=NSCocoaErrorDomain Code=260 "The file β€œDefault (Dark).json” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/userName/.codeedit/themes/Default (Dark).json, NSUnderlyingError=0x6000015b9fe0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Delete:

Error Domain=NSCocoaErrorDomain Code=4 "β€œDefault (Dark).json” couldn’t be removed." UserInfo={NSUserStringVariant=(
    Remove
), NSFilePath=/Users/userName/.codeedit/themes/Default (Dark).json, NSUnderlyingError=0x6000015990e0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

I also deleted the .codeedit folder, run the program again, a themes folder is created but it is empty.

But in the program it shows me that the theme is there.

@lukepistrol

Copy link
Copy Markdown
Member Author

@Angelk90 should be fixed now. When there is only one theme available, it cannot be deleted. And the default theme now properly gets saved to disk.

@Angelk90

Angelk90 commented Apr 2, 2022

Copy link
Copy Markdown
Contributor

@lukepistrol : You could post the themes you created anura or light.

@lukepistrol

Copy link
Copy Markdown
Member Author

@lukepistrol : You could post the themes you created anura or light.

Not in scope for this PR. But we will implement proper themes later on.

@Angelk90

Angelk90 commented Apr 2, 2022

Copy link
Copy Markdown
Contributor

@lukepistrol : At the moment the following problem happens I change a theme color, for example invisible.

I close the settings, also the program and find that it has been saved.

But when I go to open the file, I can't find the change.

@lukepistrol

Copy link
Copy Markdown
Member Author

@lukepistrol : At the moment the following problem happens I change a theme color, for example invisible.

I close the settings, also the program and find that it has been saved.

But when I go to open the file, I can't find the change.

What do you mean by "open the file"? please be more specific!

@Angelk90

Angelk90 commented Apr 2, 2022

Copy link
Copy Markdown
Contributor

@lukepistrol : I open the json file.
Schermata 2022-04-02 alle 19 14 02

@lukepistrol

Copy link
Copy Markdown
Member Author

@lukepistrol : I open the json file.
Schermata 2022-04-02 alle 19 14 02

Which one??

@Angelk90

Angelk90 commented Apr 2, 2022

Copy link
Copy Markdown
Contributor

@lukepistrol :
Schermata 2022-04-02 alle 19 17 12

@lukepistrol

Copy link
Copy Markdown
Member Author

@Angelk90 please read the PR description...

@Angelk90

Angelk90 commented Apr 2, 2022 •

Copy link
Copy Markdown
Contributor

@lukepistrol : Then overrides are done in preferences.

@Angelk90

Angelk90 commented Apr 2, 2022

Copy link
Copy Markdown
Contributor

@lukepistrol : Ok, some considerations, not if they can be right at this stage.

  • As you can see from the video, when you switch from one theme to another a few times, there is a change of position between the themes inside overrides, it's not a problem but I point it out.

  • When a theme is deleted, overrides of the newly deleted theme remain, I don't know if it can be considered a problem.

Registrazione.schermo.2022-04-02.alle.19.30.23.mov

@lukepistrol

Copy link
Copy Markdown
Member Author
  • As you can see from the video, when you switch from one theme to another a few times, there is a change of position between the themes inside overrides, it's not a problem but I point it out.

That's just in which order the json is created which is random and should not be a problem.

  • When a theme is deleted, overrides of the newly deleted theme remain, I don't know if it can be considered a problem.

Thanks for pointing this out. It indeed is a problem and I fixed it in the last commit.

@Angelk90

Angelk90 commented Apr 2, 2022

Copy link
Copy Markdown
Contributor

@lukepistrol : Now it seems to work.

@austincondiff austincondiff left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Outstanding, nice work @lukepistrol! πŸ‘πŸ»

@lukepistrol
lukepistrol merged commit b565509 into CodeEditApp:main Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request UI This is UI related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Themes Settings

4 participants