GithubHelp home page GithubHelp logo

taffybar / gtk-sni-tray Goto Github PK

View Code? Open in Web Editor NEW
34.0 4.0 2.0 103 KB

A StatusNotifierHost widget written using the gtk+3 bindings for haskell provided by gi-gtk.

License: BSD 3-Clause "New" or "Revised" License

Haskell 94.95% Nix 5.05%
status-notifier-item appindicator gtk dbus tray haskell taffybar statusnotifieritem

gtk-sni-tray's Introduction

gtk-sni-tray

Build Status Hackage Stackage LTS Stackage Nightly

gtk-sni-tray provides a StatusNotifierHost widget written using the gtk+3 bindings for haskell provided by gi-gtk. It also provides a simple standalone executable, gtk-sni-tray-standalone, that is configured with command line arguments. This executable will run the aforementioned widget by itself in a strut window, on each monitor it is requested.

taffybar

It is generally recommeneded that you use this widget through taffybar with this module, which will allow you to combine it with other useful widgets, and will allow more flexibility in configuration.

StatusNotifierWatcher

By default, it is assumed that you are running an isolated StatusNotifierWatcher daemon. status-notifier-item provides a StatusNotifierWatcher executable that you can use for this purpose. If you get an error like

MethodError {methodErrorName = ErrorName "org.freedesktop.DBus.Error.ServiceUnknown", methodErrorSerial = Serial 7, methodErrorSender = Just (BusName "org.freedesktop.DBus"), methodErrorDestination = Just (BusName ":1.549"), methodErrorBody = [Variant "The name org.kde.StatusNotifierWatcher was not provided by any .service files"]}

when you start gtk-sni-tray-standalone it is probably because you have not started a StatusNotifierWatcher on your system. You can solve this problem by passing the --watcher flag to gtk-sni-tray-standalone, but this is not recommeneded, because many SNI processes do not monitor for new watcher processes, and so may not immediately register when this new watcher is started.

Installation

nix, stack and cabal can all be used to install gtk-sni-tray.

gtk-sni-tray's People

Contributors

colonelpanic8 avatar kurnevsky avatar rvl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gtk-sni-tray's Issues

Failing to find icons for some apps

I have the widget working for some things, like pasystray and Steam, but when I try running the Network Manager applet (nm-applet), I get the following:

Got null pixbuf for info ItemInfo {itemServiceName = BusName ":1.490", itemServicePath = ObjectPath "/org/ayatana/NotificationItem/nm_applet", itemId = Just "nm-applet", itemStatus = Just "Active", itemCategory = Just "SystemServices", itemToolTip = Nothing, iconTitle = "Network", iconName = "nm-device-wired-secure", overlayIconName = Nothing, iconThemePath = Just "", iconPixmaps = [], overlayIconPixmaps = [], menuPath = Just (ObjectPath "/org/ayatana/NotificationItem/nm_applet/Menu")}

This is on NixOS, where the icons in question are in /run/current-system/sw/share/icons. Is nm-applet supposed to be doing something differently, or should gtk-sni-tray be getting iconThemePath set, or something else?

No tooltips on hover

Some icons have extra information on tooltip hover which are accessible on other trays. E.g. (again) lxqt-powermanagement with battery percentage

Builderror with gdkpixbuf 2.0.26

Hey there. While packaging for nixpkgs I encountered this build error, which I assume is related to our gdkpixbuf bump.

Building library for gtk-sni-tray-0.1.6.0..
[1 of 3] Compiling Paths_gtk_sni_tray ( dist/build/autogen/Paths_gtk_sni_tray.hs, dist/build/Paths_gtk_sni_tray.o, dist/build/Paths_gtk_sni_tray.dyn_o )
[2 of 3] Compiling StatusNotifier.TransparentWindow ( src/StatusNotifier/TransparentWindow.hs, dist/build/StatusNotifier/TransparentWindow.o, dist/build/StatusNotifier/TransparentWindow.dyn_o )
[3 of 3] Compiling StatusNotifier.Tray ( src/StatusNotifier/Tray.hs, dist/build/StatusNotifier/Tray.o, dist/build/StatusNotifier/Tray.dyn_o )

src/StatusNotifier/Tray.hs:125:5: error:
    • Couldn't match type ‘Maybe Pixbuf’ with ‘Pixbuf’
      Expected type: IO (Maybe Pixbuf)
        Actual type: IO (Maybe (Maybe Pixbuf))
    • In a stmt of a 'do' block:
        sequenceA $ pixbufNewFromFile <$> maybeFile
      In the expression:
        do trayLogger DEBUG
             $ printf "Trying to load icon %s as filepath" name
           let nameString = T.unpack name
           fileExists <- doesFileExist nameString
           maybeFile <- if fileExists then
                            return $ Just nameString
                        else
                            fmap join
                              $ sequenceA $ getIconPathFromThemePath nameString <$> themePath
           ....
      In a stmt of a 'do' block:
        if hasIcon || hasPanelIcon then
            do let targetName = ...
               trayLogger DEBUG $ printf "Found icon %s in theme" name
               iconThemeLoadIcon themeForIcon targetName size themeLoadFlags
        else
            do trayLogger DEBUG
                 $ printf "Trying to load icon %s as filepath" name
               let nameString = ...
               fileExists <- doesFileExist nameString
               ....
    |
125 |     sequenceA $ pixbufNewFromFile <$> maybeFile
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Incorrect colors in icons

It seems that red/orange are swapped with blue. For example, QtPass, which should have a blue icon, appears orange. VLC, Kleopatra, and lxqt-powermanagement when the power is low, should be orange/red/red, but all appear blue. Other colors, such as lxqt-powermanagement when the power is high (green) are fine.

IBus AppIndicator support

IBus is supposed to support AppIndicators (so long as the environment variable XDG_CURRENT_DESKTOP=KDE is set), however when I run it with

XDG_CURRENT_DESKTOP=KDE ibus-daemon -rxv

I get the following error from gtk-sni-tray-standalone (and also the taffybar module).

Got signal for update type: IconUpdated from unknown sender: Signal {signalPath = ObjectPath "/org/ayatana/NotificationItem/ibus_ui_gtk3", signalInterface = InterfaceName "org.kde.StatusNotifierItem", signalMember = MemberName "NewIcon", signalSender = Just (BusName ":1.209"), signalDestination = Nothing, signalBody = []}
Property update failures [MethodError {methodErrorName = ErrorName "org.freedesktop.DBus.Error.ServiceUnknown", methodErrorSerial = Serial 77, methodErrorSender = Just (BusName "org.freedesktop.DBus"), methodErrorDestination = Just (BusName ":1.203"), methodErrorBody = [Variant "The name :1.209 was not provided by any .service files"]}]
Failed to identify senderMethodError {methodErrorName = ErrorName "org.freedesktop.DBus.Error.ServiceUnknown", methodErrorSerial = Serial 78, methodErrorSender = Just (BusName "org.freedesktop.DBus"), methodErrorDestination = Just (BusName ":1.203"), methodErrorBody = [Variant "The name :1.209 was not provided by any .service files"]}
Got signal for update type: IconUpdated from unknown sender: Signal {signalPath = ObjectPath "/org/ayatana/NotificationItem/ibus_ui_gtk3", signalInterface = InterfaceName "org.kde.StatusNotifierItem", signalMember = MemberName "NewIcon", signalSender = Just (BusName ":1.209"), signalDestination = Nothing, signalBody = []}
Property update failures [MethodError {methodErrorName = ErrorName "org.freedesktop.DBus.Error.ServiceUnknown", methodErrorSerial = Serial 86, methodErrorSender = Just (BusName "org.freedesktop.DBus"), methodErrorDestination = Just (BusName ":1.203"), methodErrorBody = [Variant "The name :1.209 was not provided by any .service files"]},MethodError {methodErrorName = ErrorName "org.freedesktop.DBus.Error.ServiceUnknown", methodErrorSerial = Serial 88, methodErrorSender = Just (BusName "org.freedesktop.DBus"), methodErrorDestination = Just (BusName ":1.203"), methodErrorBody = [Variant "The name :1.209 was not provided by any .service files"]}]

instead of the system tray icon.

Expected behaviour: I get the IBus system tray icon.

Support Activate and SecondaryActivate

Clicking on icons seems to always show the right-click menu, and there is no way to trigger the left-click action. For some programs, this means an extra click to "show" or "open," but some programs do not have the left-click functionality in the right-click menu.

Duplicate icons in tray

This is similar to #10 , but its likely that the underlying cause is different, since I know that the issue underlying that issue was fixed.

Electron apps update icons by sending newIconThemePath; gtk-sni-tray continues to look in old path

Ever since I migrated to using SNI tray with indicators, I've had problems with Slack and Signal not updating their icons (they both add graphical flourishes to indicate things like whether there are unread messages or not). When I start them up, the icon in Taffybar correctly shows whatever state they're in at that time, and then never changes.

I noticed that Taffybar's stderr emits messages about failing to get pixbufs, with iconThemePath set to folders like /tmp/.org.chromium.Chromium.<randomstring> that don't exist, exactly when the icon should be changing (new message recieved, or I click on the last unread message, etc). So I did a bit more digging.

In dbus-monitor, when I start up Slack (with my Taffybar SNI tray running), I can see this section:

method call time=1530493694.000590 sender=:1.66 -> destination=:1.71 serial=31 path=/org/ayatana/NotificationItem/Slack1; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.kde.StatusNotifierItem"
   string "IconPixmap"
error time=1530493694.000937 sender=:1.71 -> destination=:1.66 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=31
   string "No such property 'IconPixmap'"
method call time=1530493694.001166 sender=:1.66 -> destination=:1.71 serial=32 path=/org/ayatana/NotificationItem/Slack1; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.kde.StatusNotifierItem"
   string "IconName"
method return time=1530493694.060064 sender=:1.71 -> destination=:1.66 serial=21 reply_serial=32
   variant       string "Slack1_2"
method call time=1530493694.060298 sender=:1.66 -> destination=:1.71 serial=33 path=/org/ayatana/NotificationItem/Slack1; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.kde.StatusNotifierItem"
   string "IconThemePath"
method return time=1530493694.065481 sender=:1.71 -> destination=:1.66 serial=22 reply_serial=33
   variant       string "/tmp/.org.chromium.Chromium.Vke7A3"

:1.66 seems to be Taffybar and :1.71 seems to be Slack. Taffybar asks for a direct pixbuf, which doesn't exist, so then it asks for the icon name and theme path. Sure enough, the theme path mentioned contains a file for the icon name mentioned:

% ls /tmp/.org.chromium.Chromium.Vke7A3
Slack1_2.png

And everything works at this point. The icon is displayed correctly. After a message comes in and the icon should be updated (but actually remains unchanged), Taffybar's log says:

Failed to get pixbuf for ItemInfo {itemServiceName = BusName ":1.71", itemServicePath = ObjectPath "/org/ayatana/NotificationItem/Slack1", iconTitle = "slack", iconName = "Slack1_4", iconThemePath = Just "/tmp/.org.chromium.Chromium.Vke7A3", iconPixmaps = [], menuPath = Just (ObjectPath "/org/ayatana/NotificationItem/Slack1/Menu")}

It's still using /tmp/.org.chromium.Chromium.Vke7A3 as the icon theme path, which no longer exists (Electron cleaned up the tmp folder I guess):

% ls /tmp/.org.chromium.Chromium.Vke7A3
ls: cannot access '/tmp/.org.chromium.Chromium.Vke7A3': No such file or directory

At the same time, dbus-monitor shows this sequence:

signal time=1530494718.862148 sender=:1.71 -> destination=(null destination) serial=42 path=/org/ayatana/NotificationItem/Slack1; interface=org.kde.StatusNotifierItem; member=NewIconThemePath
   string "/tmp/.org.chromium.Chromium.zLsFh7"
signal time=1530494718.862196 sender=:1.71 -> destination=(null destination) serial=43 path=/org/ayatana/NotificationItem/Slack1; interface=org.kde.StatusNotifierItem; member=NewIcon
method call time=1530494718.862513 sender=:1.66 -> destination=:1.71 serial=46 path=/org/ayatana/NotificationItem/Slack1; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.kde.StatusNotifierItem"
   string "IconName"
method return time=1530494718.862868 sender=:1.71 -> destination=:1.66 serial=44 reply_serial=46
   variant       string "Slack1_4"
method call time=1530494718.863173 sender=:1.66 -> destination=:1.71 serial=47 path=/org/ayatana/NotificationItem/Slack1; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.kde.StatusNotifierItem"
   string "IconPixmap"
error time=1530494718.863299 sender=:1.71 -> destination=:1.66 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=47
   string "No such property 'IconPixmap'"

Slack sent a broadcast NewIconThemePath message. And the Slack1_4 icon does exist in that path:

% ls /tmp/.org.chromium.Chromium.zLsFh7                                                                                                                           
Slack1_4.png

As further events happen, the Taffybar log continues to show "Failed to get pixbuf for ItemInfo" messages containing the same iconThemePath, but it seems like Slack generates a new temp folder every time it updates its icon. So It seems that gtk-sni-tray isn't responding to the NewIconThemePath messages.

The Signal desktop app seems to behave exactly the same way. Both are based on the Electron framework, which uses Chromium for the front end, so I presume they're using common code to update their icons which generates the /tmp/.org.chromium.Chromium.*/ paths. This leads me to expect that this will be a problem for Electron-based apps in general.

SNITray.hs does not exist

in README there is a link pointing to SNITray.hs in taffybar, no such file exists in that project.

Some dynamic icons unchanging

When launched, a program will add an icon to the tray. However, the icon is not updated, even as it would be in other tray programs. Restarting the program updates the icon correctly, but it does not update while the program is running. Example: lxqt-powermanagement

Only Qt programs have icons by default

Some qt programs with icons: Kleopatra, VLC, KDE Connect Indicator, lxqt-powermanagement

Some GTK programs without icons: Syncthing GTK, Onboard, Connman-gtk, volumeicon

Many of the latter programs have no option to change the type of notification icon, e.g. Syncthing GTK

compilation error String vs Text

I am hitting compilation error:

gtk-sni-tray/src/StatusNotifier/Tray.hs:72: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
   |           
72 |     then Just <$> pixbufNewFromFile name
   |                                     ^^^^

Tried with OverloadedStrings but suprisingly didn't help, any idea what could cause that?

Can this be made swallowable inside another dock?

Hello! I'm trying to find a substitute for stalonetray that can deal with this newfangled SNI stuff, for use with FVWM. Presently, stalonetray can be "swallowed" by telling it to use a specific geometry (rather than a percentage of the screen) and not try to do anything like handle its own placement on the screen or anything like that. Is there a way to do something similar with gtk-sni-tray? Thank you!

Possibly incomplete WM hints

Although the program correctly docks to the top of the screen and prevents maximized programs from overlapping it, it also shows up in the task list as a normal window and is minimizable from there.

Pattern match failure in GIGtkStrut.hs user error

I get this error when I try to run gtk-sni-tray-standalone after starting the watcher. I am using hyprland if that matters. I am able to get it to open a window with the --no-strut flag, but then it just opens like a regular window.

Unable to build

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.