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

Scroll extent calculated wrongly - clean version of PR #89 #94

Merged
merged 7 commits into from
Nov 3, 2021

Conversation

JulienMaille
Copy link
Owner

No description provided.

@JulienMaille
Copy link
Owner Author

@Pomis would you know how to write a linux/bash script that add the Patch lines automatically?

@JulienMaille JulienMaille changed the title clean version of PR #89 Scroll extent calculated wrongly - clean version of PR #89 Nov 2, 2021
@Pomis
Copy link

Pomis commented Nov 2, 2021

@JulienMaille not really, never done that, but can have a look when I would have enough free time =))

@SendNukez
Copy link
Collaborator

Should be possible basically the same way as this. That's the line that sets the package.json's version each release. We just have to find [Patch] and replace it until we find the end of the file or another [INI_Header]. I'll try this later.

@SendNukez
Copy link
Collaborator

We should be able to make it so that it first checks if the [Patch] header exists in the config.

  • If not, It will simply append the patch lines to the config.
  • If it does exist it will replace the existing [Patch] block with the new patch.

However, I'm not really getting far with this. I'm trying to replace the patch block with this: sed -E 's/\[Patch\](\r?\n([^[\r\n].*)?)*/PATCH/' config-xpui.ini, but It's only replacing the [Patch] header, not the actual body of the patch and I don't quite get why. The RegEx itself is working (see).

@JulienMaille
Copy link
Owner Author

JulienMaille commented Nov 2, 2021

Is sed un-greedy by default?
https://regex101.com/r/nNZ3VF/1/

@SendNukez
Copy link
Collaborator

So, putting:

echo "PATCHING"
PATCH='[Patch]\nxpui.js_find_8008=,(\w+=)32,\nxpui.js_repl_8008=,`\${1}58,'
if cat config-xpui.ini | grep -oP '\[Patch\]'; then
    perl -i -0777 -pe "s/\[Patch\].*?($|(\r*\n){2})/$PATCH\n\n/s" config-xpui.ini
else
    echo -e "\n$PATCH" >> config-xpui.ini
fi

after the echo "COPYING" part seems to work. But I can't really test it since I'm only on WSL, not an actual linux machine.
The declaration of $PATCH is single-line because I couldn't figure out how to store multi-line vars in bash.
Should also probably add an uninstall.sh that does the same as uninstall.ps1 just to be consistent.

@JulienMaille
Copy link
Owner Author

JulienMaille commented Nov 2, 2021

@Pomis can you test this command line from a bash?
Under Windows it works

echo "PATCHING"
PATCH='[Patch]
xpui.js_find_8008 = ,(\\w+=)32,
xpui.js_repl_8008 = ,\${1}58,'
if cat config-xpui.ini | grep -o '\[Patch\]'; then
    perl -i -0777 -pe "s/\[Patch\].*?($|(\r*\n){2})/$PATCH\n\n/s" config-xpui.ini
else
    echo -e "\n$PATCH" >> config-xpui.ini
fi

@Pomis
Copy link

Pomis commented Nov 2, 2021

@JulienMaille Getting

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]```

@JulienMaille
Copy link
Owner Author

JulienMaille commented Nov 2, 2021

@Pomis Can you test the updated bash command and share a snapshot of the console?

@JulienMaille
Copy link
Owner Author

@SendNukez why removing then adding dribbblish-dynamic.js in the install script?

spicetify config extensions default-dynamic.js- extensions dribbblish-dynamic.js- extensions dribbblish.js- extensions Vibrant.min.js-
spicetify config extensions dribbblish-dynamic.js

@SendNukez
Copy link
Collaborator

@SendNukez why removing then adding dribbblish-dynamic.js in the install script?

Oops, that's a mistake.

@SendNukez
Copy link
Collaborator

I just realized, shouldn't we apply the patch before running spicetify apply? Also in the PowerShell script?

@JulienMaille JulienMaille merged commit 23b83c2 into main Nov 3, 2021
@JulienMaille JulienMaille deleted the patch-1 branch November 3, 2021 13:42
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.

3 participants