Frewacom / pywalfox

Dynamic theming of Firefox (and Thunderbird) using your Pywal colors
https://addons.mozilla.org/en-US/firefox/addon/pywalfox/
Mozilla Public License 2.0
583 stars 12 forks source link

Setup script does not seem to work #6

Closed Archund closed 4 years ago

Archund commented 4 years ago

The script shows no errors when run, and prints out:

[arc@ARC-flex native-app]$ sudo bash setup.sh 
Creating 'native-messaging-hosts' folder in ~/.mozilla
Copying native application manifest to ~/.mozilla/native-messaging-hostst/pywalfox.json
Setting path to pywal-fetcher.py in the native app manifest
Setting execution permissions on daemon (pywal-fetcher.py)
Finished.

I have tried checking ~/.mozilla/native-messaging-hostst/pywalfox.json, but no file exists.

When trying to fetch pywal colors using the extension in firefox, the debug console does not respond. However, it does output

Reset to default theme
Theme was updated

when using the disable theme button.

Frewacom commented 4 years ago

I noticed that the output says ~/.mozilla/native-messaging-hostst/pywalfox.json and not hosts. Does ~/.mozilla/native-messaging-hosts/pywalfox.json not exist either?

Also, try running the pywal-fetcher.py manually and see if there are any errors.

Frewacom commented 4 years ago

If pywal-fetcher.py runs without errors you might want to try copying native-app/assets/pywalfox.json to one of the other paths listed here and see if that makes a difference:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#Manifest_location

Archund commented 4 years ago

Thank you for the reply. I did check for hosts out of curiosity, but that file did not exist either.

I will try running it manually and let you know what happens later today.

Frewacom commented 4 years ago

I just now fixed an issue with pywal-fetcher.py crashing if the "chrome" directory was not present in the default profile, 4270f4a0ce0e2a24434e9a730ff50fbb64a38d12. If you pull the new changes it might fix your issue.

Archund commented 4 years ago

Sorry for the late reply.

I tried with the newer version, but It did not fix the problem.

The output of running pywal-fetcher.py is

[arc@ARC-flex native-app]$ python pywal-fetcher.py 
g{"key": "enableCustomCss", "success": false, "error": "Could not find the folder to put custom CSS in"}
^CTraceback (most recent call last):
  File "pywal-fetcher.py", line 221, in <module>
    receivedMessage = getMessage()
  File "pywal-fetcher.py", line 15, in getMessage
    rawLength = sys.stdin.buffer.read(4)
KeyboardInterrupt

[arc@ARC-flex native-app]$ python2.7 pywal-fetcher.py 
Traceback (most recent call last):
  File "pywal-fetcher.py", line 218, in <module>
    sendMessage(createMessage('enableCustomCss', (False, 'Could not find the folder to put custom CSS in')))
  File "pywal-fetcher.py", line 31, in sendMessage
    sys.stdout.buffer.write(encodedMessage['length'])
AttributeError: 'file' object has no attribute 'buffer'

Running the code with python 3 caused it to hang indefinitely, so I ran it with python 2.7, but I still go the same error.

Archund commented 4 years ago

Adittionally, I tried copying the assets/pywalfox-manifest.json to ~/.mozilla/native-messaging-hosts/pywalfox-manifest.json

This changed the colors to: image

These are not the colors that I have in my pywal cache

Frewacom commented 4 years ago

pywal-fetcher.py runs in a while loop so that means everything seems to be working.

I actually never tried running it with python 2.7 so I will try fixing that later.

What does your ~/.cache/wal/colors look like?

Archund commented 4 years ago

Sorry for the late reply, it looks like this:

[arc@ARC-flex ~]$ cat ~/.cache/wal/colors
#221b08
#ab882d
#a6a056
#c1ba49
#9ea931
#adb48f
#2d7ec5
#c7c6c1
#595445
#ab882d
#a6a056
#c1ba49
#9ea931
#adb48f
#2d7ec5
#c7c6c1
Frewacom commented 4 years ago

Honestly, I have no idea where the script got those purple and green colors. If you disable the theme and fetch pywal colors again, do you get the same colors? If that's the case, we at least know that the script and extension can communicate and the problem must be when fetching the colors.

Archund commented 4 years ago

Yes, I tried fetching them again and the colors were the same. I also noticed that the colors shown seem to be the default colors for the firefox color theming extension,or at least the ones the extension set for me. If I change the colors of firefox through the firefox color extension, the pywalfox colors will be the same

Frewacom commented 4 years ago

Have you been able to resolve your issue?

Frewacom commented 4 years ago

I just noticed that you ran the setup script as sudo. Maybe that is why it is not working for you, since ~ will point to /root/ and not your home folder. Try running bash setup.sh in the root folder.

The README was a bit confusing regarding this and I have updated it.

Remember to run a git pull to get the latest changes.

Frewacom commented 4 years ago

I am closing this issue for now. If the issue persists, write a comment and I will reopen it.

Archund commented 4 years ago

Hello, sorry for the late reply. I did not have my linux machine with me. I have updated everything and tried to run it again. The setup script returns:

[arc@ARC-flex Pywalfox]$ bash setup.sh
Creating 'native-messaging-hosts' folder in ~/.mozilla
Copying native messaging manifest to /home/arc/.mozilla/native-messaging-hosts/pywalfox.json
Setting path to daemon/pywalfox.py in the manifest
Setting execution permissions on daemon/pywalfox.py
Finished.

After refreshing firefox, the extension outputs:

Fetched colors from daemon successfully

However, all colors are white. I assume this is a different issue, and will troubleshoot later on. Thanks

Frewacom commented 4 years ago

Since you got that response, the connection between the daemon and addon should be working. Have you updated the extension? You should be using version 1.5.0 (or above) of the addon, or it will not work.

I made some changes to the way colors are being sent from the daemon.