taffybar / gtk-sni-tray

A StatusNotifierHost widget written using the gtk+3 bindings for haskell provided by gi-gtk.
BSD 3-Clause "New" or "Revised" License
36 stars 2 forks source link

Unable to build #1

Closed op8867555 closed 6 years ago

op8867555 commented 6 years ago

Hi, I found this cool project on reddit. however, I can't build it without modifications below:

diff --git a/src/StatusNotifier/Tray.hs b/src/StatusNotifier/Tray.hs                                                                                                                               
index 3b24460..4321e9f 100644
--- a/src/StatusNotifier/Tray.hs
+++ b/src/StatusNotifier/Tray.hs
@@ -70,3 +70,3 @@ getIconPixbufByName size name themeForIcon = do
     if fileExists
-    then Just <$> pixbufNewFromFile name
+    then Just <$> pixbufNewFromFile nameString
     else return Nothing
diff --git a/stack.yaml b/stack.yaml
index e629b47..5969535 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -4,3 +4,3 @@ packages:
 extra-deps:
-  - status-notified-item-0.2.0.0
+  - status-notifier-item-0.2.0.0
   - gtk-strut-0.1.2.0
colonelpanic8 commented 6 years ago

@op8867555 Are you sure about that first edit? seems to build without it for me.

op8867555 commented 6 years ago

At least it's needed on my arch box. A clean build after stack setup gives

> stack build
gtk-sni-tray-0.1.0.0: build (lib + exe)
Preprocessing library for gtk-sni-tray-0.1.0.0..
Building library for gtk-sni-tray-0.1.0.0..
[2 of 2] Compiling StatusNotifier.Tray ( src/StatusNotifier/Tray.hs, .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.0.1.0/build/StatusNotifier/Tray.o )                                        

/tmp/gtk-sni-tray/src/StatusNotifier/Tray.hs:71:37: error:
    • Couldn't match expected type ‘[Char]’ with actual type ‘T.Text’
    • In the first argument of ‘pixbufNewFromFile’, namely ‘name’
      In the second argument of ‘(<$>)’, namely ‘pixbufNewFromFile name’
      In the expression: Just <$> pixbufNewFromFile name
   |
71 |     then Just <$> pixbufNewFromFile name
   |                                     ^^^^

and stack ghci gives:

*Main StatusNotifier.Tray> :t GI.GdkPixbuf.Objects.Pixbuf.pixbufNewFromFile                                                                                                                        
GI.GdkPixbuf.Objects.Pixbuf.pixbufNewFromFile                                                                                                                                                      
  :: Control.Monad.IO.Class.MonadIO m =>                                                                                                                                                           
     [Char] -> m GI.GdkPixbuf.Objects.Pixbuf.Pixbuf  
colonelpanic8 commented 6 years ago

Hmm. I think you must have an old version of gi-gdkpixbuf. See:

https://hackage.haskell.org/package/gi-gdkpixbuf-2.0.15/docs/GI-GdkPixbuf-Objects-Pixbuf.html#v:pixbufNewFromFile

where the parameter is of type Text.

The weird thing about haskell-gi is that it seems that the maintainer sometimes reuploads versions of the hackage packages, so even though you might have 2.0.15 of this package on your machine, its still an old version. I think the solution might be to include as a dependency a sufficiently new version of haskell-gi. Can you try that?

colonelpanic8 commented 6 years ago

i.e. does

0714bd1f4d2f39bc17c67093da5f73d4143cd24d work for you?

op8867555 commented 6 years ago

That's really weird to have two package with same version but different API...

It's work with a haskell-gi-0.21.2 appended in extra-deps, just took me a while to build. I think it would be better if you bump lts version to 11.6, since haskell-gi-0.21.2 is in lts 11.6.

colonelpanic8 commented 6 years ago

That's really weird to have two package with same version but different API... @op8867555 Yeah I agree, I think that maybe the package versions are synced to the GI package version that they are built from, and then it is expected that you use the haskell-gi version to control what actually happens to the bindings. Not 100% sure though.