elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.4k stars 381 forks source link

Custom wayland shell surface is not a layer surface, your Wayland compositor may not support Layer Shell #802

Closed MihirGrand closed 1 year ago

MihirGrand commented 1 year ago

I'm running Fedora Gnome with Wayland.

I compiled eww specifically for wayland according to the instructions at https://elkowar.github.io/eww/eww.html.

Then I followed the guide here - https://dharmx.is-a.dev/eww-powermenu/ and also made necessary modifications for since I'm using Wayland.

However, when I try to open the window, it does not open. Running ./eww logs returns this

** (eww:27955): CRITICAL **: 21:08:03.385: Custom wayland shell surface is not a layer surface, your Wayland compositor may not support Layer Shell

** (eww:27955): CRITICAL **: 21:08:03.385: Custom wayland shell surface is not a layer surface, your Wayland compositor may not support Layer Shell

** (eww:27955): CRITICAL **: 21:08:03.385: Custom wayland shell surface is not a layer surface, your Wayland compositor may not support Layer Shell

** (eww:27955): CRITICAL **: 21:08:03.385: Custom wayland shell surface is not a layer surface, your Wayland compositor may not support Layer Shell

** (eww:27955): CRITICAL **: 21:08:03.385: Custom wayland shell surface is not a layer surface, your Wayland compositor may not support Layer Shell

Can this be fixed? What does the error actually mean?

Also, here's the content from my eww config eww.yuck file -

(defwindow powermenu
  :monitor 0
  :stacking "fg"
  :exclusive false
  :focusable false
  :namespace "eww_powermenu"
  :geometry (geometry
              :width "100%"
              :height "100%")
  (powermenu_layout))  

(defpoll time :interval "5s"
  :initial `date +'{"hour":"%H","min":"%M"}'`
  `date +'{"hour":"%H","min":"%M"}'`)

(defpoll net :interval "100s"
  :initial `N/A`
  `nmcli -t -f SIGNAL,ACTIVE device wifi \
    | awk -F':' '{if($2=="yes")print$1}'`)

(defwidget _buttons [shutdown shutdown_icon reboot
                    reboot_icon logout logout_icon]
  (box :class "btns-box" :spacing 5
       :vexpand true :hexpand true
       :valign "end" :halign "end"
       :space-evenly false
    (button :onclick shutdown shutdown_icon)
    (button :onclick reboot reboot_icon)
    (button :onclick logout logout_icon)))

 (defwidget _network [strength offline excellent good okay slow]
  (box :class "net-box"
       :space-evenly false
       :spacing 8
    (label :text {strength == "" ? offline :
      strength < 26 ? slow :
        strength < 51 ? okay :
          strength < 76 ? good : excellent})))

(defwidget _battery [battery status one two three
                    four five six seven charge]
  (box :class "bat-box" :space-evenly false :spacing 8
    (label :text {status == 'Charging' ? charge :
      battery < 15 ? seven :
        battery < 30 ? six :
          battery < 45 ? five :
            battery < 60 ? four :
              battery < 75 ? three :
                battery < 95 ? two : one})))

(defwidget _sundial []
  (label :class "sundial-lbl" :halign "end" :hexpand true
         :text {time.hour >= 2 && time.hour <= 4 ? "Early Morning" :
               time.hour <= 5 ? "Dawn" :
               time.hour >= 6 &&
                (time.hour <= 8 &&
                  time.min <= 59) ? "Morning" :
               time.hour >= 9 &&
                (time.hour <= 11 && time.min <= 59)
                ? "Late Morning" :
               time.hour == 12 && time.min <= 29 ? "Midday" :
               time.hour >= 12 && time.hour <= 16 ? "Afternoon" :
               time.hour > 16 && time.hour <= 17 ?
                "Late Afternoon" :
               (time.hour >= 17 && time.min <= 1)
                || (time.hour <= 18 && time.min <= 20) ?
                  "Early Evening" :
               time.hour >= 18 && time.hour <= 19 ? "Dusk" :
               time.hour > 19 && time.hour <= 21 ? "Late Evening" :
               time.hour > 21 ? "Night" : "Midnight"}))

(defwidget powermenu_layout []
  (box :class "layout-box" :space-evenly false :orientation "vertical"
       :style "background-image: url('./wallpaper')"
    (box :valign "start" :space-evenly false :spacing 25
      (_sundial)
      (_battery :status {EWW_BATTERY.BAT0.status}
                :battery {EWW_BATTERY.BAT0.capacity}
                :charge "" :one "" :two "" :three "" :four ""
                :five "" :six "" :seven "")
      (_network :strength net :offline "" :excellent "" :good ""
                :okay "" :slow "")
      (label :text "|" :class "sep")
      (button :onclick "eww close powermenu" :class "close-btn" ""))
    (box :space-evenly false :hexpand true :vexpand true
      (box :spacing 15 :class "tm-box" :space-evenly false :valign "end"
           :halign "start"
        (label :text "")
        (label :text "${time.hour}  ${time.min}"))
      (_buttons :shutdown "poweroff" :reboot "reboot"
                :logout "loginctl kill-session self"
                :shutdown_icon "" :reboot_icon "" :logout_icon ""))))
viandoxdev commented 1 year ago

From what I remember this is a gnome issue: They simply don't want to support the layer shell protocol (see this issue). Eww needs this to create special windows.

MihirGrand commented 1 year ago

@viandoxdev so is there no way to use eww with gnome anymore?

viandoxdev commented 1 year ago

@viandoxdev so is there no way to use eww with gnome anymore?

Not that I'm aware of right now (not on Wayland at least) you might be able to try a somewhat cursed xwayland solution but I'm not sure.

Just to clarify, eww should still work on X11 gnome.

MihirGrand commented 1 year ago

@viandoxdev I had no idea that X11 comes installed by default with Fedora Gnome (pardon my ignorance, its my first time using linux), and I had no idea that you could just log in to X11 instead of Wayland.

In conclusion, switched to X11 and now EWW works. Doesn't solve the problem with Wayland, but is a solid workaround.

Thanks for the help!