eylles / pywal16

16 colors fork of pywal
MIT License
157 stars 24 forks source link

KeyError: 'DESKTOP_SESSION' #52

Closed asimovc closed 2 months ago

asimovc commented 3 months ago

I get this error when i test a wallpaper and wal cant generate the files with colors

(pywal16) [user@tux ~/pywal16]$ wal -n -i ~/Wallpapers/wallhaven-5gp7j8_1920x1080.png 
[I] image: Using image wallhaven-5gp7j8_1920x1080.png.
[I] theme: Set theme to _home_hellboy_Wallpapers_wallhaven-5gp7j8_1920x1080_png_9_dark_None_None_2774760_1.1.0.json.
[I] colors: Found cached colorscheme.
Traceback (most recent call last):
  File "/home/user/pywal16/bin/wal", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/pywal16/lib/python3.12/site-packages/pywal/__main__.py", line 244, in main
    parse_args(parser)
  File "/home/user/pywal16/lib/python3.12/site-packages/pywal/__main__.py", line 216, in parse_args
    sequences.send(colors_plain, to_send=not args.s, vte_fix=args.vte)
  File "/home/user/pywal16/lib/python3.12/site-packages/pywal/sequences.py", line 93, in send
    if os.environ["DESKTOP_SESSION"] == "plasma":
       ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 685, in __getitem__
KeyError: 'DESKTOP_SESSION'
eylles commented 3 months ago

huh so that is a direct consequence of https://github.com/eylles/pywal16/pull/51

what distro and desktop environment are you on?

cc @Acetylsalicylsaeure

asimovc commented 3 months ago

My distro is Gentoo and i'm not using any desktop environment, i just use a compositor window manager called dwl.

eylles commented 3 months ago

the os.environ expects the variable DESKTOP_SESSION to exist and have some value even if empty, should have catched that back before merging the pr, i guess you really cannot assume any env var to be set by the user session.

eylles commented 3 months ago

fixed in https://github.com/eylles/pywal16/commit/8aad28a33ec30cd03836296813355f43b5546724