sdushantha/farge

Enable support for Wayland

Opened this issue · 7 comments

I would request you to make this tool also work for Wayland .
Grim is imagepicker can also be used as alternative for Colorpicker .
The command
grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-
picks color in wayland.
It would be glad to see Wayland support as Wayland is future.

grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -1 | grep '#' | awk '{print $3}'

This returns hex.You can replace colorpicker line with this(for wayland)

https://pastebin.com/6hEjEYFR
I have modified farge to support wayland(The above program works only in wayland)

@varshitgithub I will add this. But first I have to find a way to see if the user is using Wayland or X11

@varshitgithub I will add this. But first I have to find a way to see if the user is using Wayland or X11

I found these solutions searching online, the first one uses loginctl:

$ loginctl show-session 2 -p Type
Type=wayland

The second one use the $XDG_SESSION_TYPE environment variable:

$ echo $XDG_SESSION_TYPE
x11

I don't know if these solutions always work but it's a starting point. If you need help I can make a PR.

@dexpota Sure, you can make a PR :)

@sdushantha echo $WAYLAND_DISPLAY only returns value when It's running Wayland.
Methods that @dexpota mentioned is returning me "tty"

I have PRed .Now,I am closing the issue