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

Invalid JSON data when changing start menu icon #124

Open
anventia opened this issue Oct 28, 2024 · 4 comments
Open

Invalid JSON data when changing start menu icon #124

anventia opened this issue Oct 28, 2024 · 4 comments

Comments

@anventia
Copy link

I added the following to the bottom of my config JSON:

  "controlStyles[20].target": "Taskbar.ExperienceToggleButton#LaunchListButton[AutomationProperties.AutomationId=StartButton] > Taskbar.TaskListButtonPanel > Border#BackgroundElement",
  "controlStyles[20].styles[0]": "Background:=<ImageBrush Stretch="Uniform" ImageSource="<https://cdn-icons-png.flaticon.com/512/7554/7554093.png>" />",
  "controlStyles[21].target": "Taskbar.ExperienceToggleButton#LaunchListButton[AutomationProperties.AutomationId=StartButton] > Taskbar.TaskListButtonPanel > Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer#Icon",
  "controlStyles[21].styles[0]": "Visibility=Collapsed"

however I get "Invalid JSON data" error when trying to save it in Windhawk.
Does anyone know why?

@bbmaster123
Copy link
Collaborator

without seeing the rest, its most likely because styles have to be in sequential order. if your previous style was for example controlStyles[16].target, the next one would need to be controlStyles[17].target

One other thing to watch out for is to make sure each line, except the very last one, ends with a comma

@anventia
Copy link
Author

Yeah, previously, the last one as 19, so I added this to the end as 20 and 21. I also made sure to add the comma to the previous last line that didn't have one, and my new last line doesn't have the comma.

@m417z
Copy link
Member

m417z commented Oct 29, 2024

One hint is that GitHub colors parts of the JSON you posted in red. Quotes inside strings must be escaped - each quote must turn into \".

You can also use one of the online JSON validators.

image

Generally, the JSON wasn't designed to be modified by hand. It was designed to backup and share mod settings. Why not use the settings UI instead?

@bbmaster123
Copy link
Collaborator

ah of course, good catch
Yes, that style in JSON should be:
"controlStyles[20].styles[0]": "Background:=<ImageBrush Stretch=\"Uniform\" ImageSource=\"<https://cdn-icons-png.flaticon.com/512/7554/7554093.png>\" />",

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

No branches or pull requests

3 participants