Closed gusbemacbe closed 5 years ago
nice, thanks a lot!
@actionless
I have just updated, adding new translations.
@gusbemacbe
Replace
-e 's/currentColor/url(#arrongin)/g' \ -e "s/dd9b44/$SURUPLUS_GRADIENT1/g" \ -e "s/ad6c16/$SURUPLUS_GRADIENT2/g" '{}' \;
for
-e 's/currentColor/url(#oomox)/g' \ -e "s/efefe7/$SURUPLUS_GRADIENT1/g" \ -e "s/8f8f8b/$SURUPLUS_GRADIENT2/g" '{}' \;
As I write before there is not much point to adding the separate gradient for oomox. I didn't notice that you added it so I just used arrongin as the template. I don't think that we have to change it now.
@SmartFinn
Yes, as @actionless thought it is unncessary, we left it like.
Hello @actionless and @SmartFinn !
I have upgraded the repository. I changed the files. I removed the files.
See the new Bash files and say if they are good or not. If they are not good, you are free to modify and improve.
Showing 19,519 changed files with 272 additions and 301,982 deletions. The diff you're trying to view is too large. We only load the first 3000 changed files.
:skull: :gun:
Showing 19,519 changed files with 272 additions and 301,982 deletions.
Maybe because of the folders that I have removed from this repository as 16
, test-for-oomox
and test-for-oomox-2
. All folders had together 15540 icons.
If it is not this, are you referring to the shell files that were destroying and removing the icons theme?
ok, so i've reviewed the files manually
for example:
if grep --quiet 'url(#arrongin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#arrongin)/url(#fitdance)/g'
elif grep --quiet 'url(#aurora)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#aurora)/url(#fitdance)/g'
elif grep --quiet 'url(#oomox)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#oomox)/url(#fitdance)/g'
elif grep --quiet 'url(#rainblue)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#rainblue)/url(#fitdance)/g'
elif grep --quiet 'url(#sunrise)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#sunrise)/url(#fitdance)/g'
elif grep --quiet 'url(#telinkrin)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#telinkrin)/url(#fitdance)/g'
elif grep --quiet 'url(#60spsycho)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#60spsycho)/url(#fitdance)/g'
elif grep --quiet 'url(#90ssummer)' *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/url(#90ssummer)/url(#fitdance)/g'
else
sed --in-place --follow-symlinks *.svg -e 's/currentColor/url(#fitdance)/g'
fi
it could be refactored like:
NEW_COLOR="url(#fitdance)"
ALL_COLORS=(
"url(#90ssummer)"
<.....>
"url(#sunrise)"
"currentColor"
)
for color in "${ALL_COLORS[@]}" ; do
if grep --quiet "$color" *.svg; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
Nice codes simplification, @actionless ! I have just updated, I will test at my own risk.
A small fail. The terminal said "grep: *.svg: No such file or directory
".
but it's the same what your original code do
try running each command manually in terminal to understand how they should be modified in script to work correctly
grep --quiet "$color" *.svg
means
grep (without std output) color in all .svg files in the current directory
you probably need to prepend it with find like here: https://github.com/gusbemacbe/suru-plus-colourise/issues/1#issuecomment-465455962
@actionless
I understood what happened, because of https://github.com/gusbemacbe/suru-plus-colourise/blob/ac8b46624be5820c00b88481793db7515ede1d80/change_color.sh#L64-L78.
The @SmartFinn codes you suggested were for creating a new icons theme, but I will try to use find
without generating a new icons theme.
if grep --quiet "$color" *.svg;
for if find -type f -name '*.svg' -exec grep --quiet "$color" *.svg;
, is it correct? With or without brackets?
Or I must remove for file_path in "$theme_dir/$context_dir/"*.svg; do
from those lines I showed you.
just try running find -type f -name '*.svg' -exec grep --quiet "$color" *.svg;
in the terminal too see if it works for your case (and do color=something
before of course)
I also did it and received a warning "lack of argument for -exec
".
yup, replace *.svg
at the end to '{}' \;
and also do grep -m 1
instead of just grep
(performance tuning :D)
And still sed: unable to get informations from *.svg: No such file or directory
It seems that Suru++ is in the /usr/share/icons/
and the script is denied to access to that directory.
Ah, I also tried with sudo
and I received the same warning.
have you modified sed command the same as you modifed grep?
also you need to specify target dir to find, like find ./dirname -type f -name '*.svg'
No, here:
NEW_COLOR="url(#fitdance)"
ALL_COLORS=(
"url(#arrongin)"
"url(#aurora)"
"url(#oomox)"
"url(#rainblue)"
"url(#sunrise)"
"url(#telinkrin)"
"url(#60spsycho)"
"url(#90ssummer)"
"currentColor"
)
for color in "${ALL_COLORS[@]}" ; do
if find -type f -name '*.svg' -exec grep -m 1 "$color" '{}' \; then
sed --in-place --follow-symlinks *.svg -e 's/'"$color"'/'"$NEW_COLOR"'/g'
break
fi
done
find ./dirname
The file change_colour.sh
has already that, may I put this?
ah, wait, you don't need find at all, i see those script are not independent but they should be called by your change-color script
so just add cd $1
command before for
iteration and it gonna be fine
so just add
cd $1
command beforefor
iteration and it gonna be fine
in the file change_colour.sh
or fitdance.sh
?
hm, that also wouldn't work
was this script even working before?
i think you can just rewrite it all with find as single script (https://github.com/gusbemacbe/suru-plus-colourise/issues/1#issuecomment-466614797) instead of having 10 scripts
just instead of having NEW_COLOR pre-defined read it from user
@actionless
The fitdance.sh
with the original codes worked when I used cd
to /opt/Suru++/apps/16
, running as sudo ~/suru-plus-colourise/fitdance.sh. I will test with
change_colour.sh`.
Ah, the problem is change_colour.sh
, I will add the /opt/Suru++/apps/16
to change_colour.sh
and test.
The concluding, the problem is change_colour.sh
. All other 9 files are OK.
Better to let @SmartFinn know what's wrong with the file change_colour.sh
.
@gusbemacbe
The concluding, the problem is
change_colour.sh
. All other 9 files are OK.
Hahaha, but that's not so. change_colour.sh
is OK. The 9 files do something weird.
@SmartFinn
i think you can just rewrite it all with find as single script (#1 (comment)) instead of having 10 scripts
just instead of having NEW_COLOR pre-defined read it from user
@actionless yep, I have an idea.
Now change_color.sh
cannot change colors. Maybe it should be renamed to switch_gradients.sh
.
@SmartFinn
I was unaware of your last message, but is this current commit and README OK?
Hello @SmartFinn!
I am inviting you to contribute and to improve this little repository.
I am not sure if these codes are bad and inelegant for you. If so, you can improve (only when you have time) if you want.
Little problem is that, these files do not preserve the symlinks. I found the solutions, they preserved the symlinks, but they makde them unsuable.
Based on:
find
ing the directories and tocd
multiple specific folders of a found directory to call the function?I also would like to replace Perl files for Bash files, because Bash offers
--in-place --follow-symlinks
, but I am not sure I can something similar in Bash to that in Perl.I am not sure it works for any terminal and if it is bash-agnostic.
Please do not forget of putting your credit on AUTHORS and CREDIT.