Giter Club home page Giter Club logo

statnot's People

Contributors

enzbang avatar halhen avatar taylor avatar xcapaldi 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  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  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  avatar  avatar  avatar  avatar

statnot's Issues

tag a release with python 3 support

Python 3 has been supported for a while on master, but no release was made yet which makes it unnecessarily hard to package for distributions, would you mind tagging a new release?

Arch Linux: AttributeError: 'str' object has no attribute 'splitline'

Well, I installed statnot from the AUR (had to slightly modify the PKGBUILD by taking out a line or it wouldn't make, that's another story though) and I get this when trying to run statnot:

Unhandled exception in thread started by <function message_thread at 0x7f05def50758>
Traceback (most recent call last):
File "/usr/bin/statnot", line 204, in message_thread
update_text(get_statustext(current_notification_text))
File "/usr/bin/statnot", line 58, in update_text
first_line = text.splitline()[:-1]
AttributeError: 'str' object has no attribute 'splitline'

I've read about people having similar errors with the 'split' attribute, and supposedly the 'right' way to do it in that case was to instead import string, and do string.split(var, ) which I believe was the split delimiter. Regardless, statnot doesn't die at this point, it instead hangs and doesn't do anything, even when notify-send is called. I'm on the following:
statnot 0.0.4-1
python2 2.7.2-4

Thanks!

Remove dependence upon Xsetroot with calls to Xlib.

In an attempt to reduce overhead on my netbook (a lowly 1.3GHz Atom), I've tried to centralize the workflow of statnot. Most of these would not be fit to resubmit to mainline (as they remove the dependence on ~/.statusline.sh and make editing the main script necessary). However, I did find that changing statnot to not depend on xsetroot is actually pretty simple. You can find a patch that implements this feature here: http://paste.pocoo.org/show/364878/. Admittedly, this centralizes everything at the cost of a non-standard library, but I'd argue that, at least on Arch linux, xsetroot is a 'non-standard package'.

Move configuration to external file

In 0.0.2, configuration is stored in the main statnot executable. This is a crude solution for several reasons, not least that settings will be lost at upgrade (unless special care is taken). The configuration should move, preferably to $HOME.

(Should this configuration file move to a separate folder together .statusline.sh?)

Google Chrome: It's better to return ("body", "actions") from GetCapabilities()

trdr; Google Chrome requires "body" and "actions" capabilities. So it's better to return ("body", "actions") from GetCapabilities().

I love statnot because I can create my scripts to control notifications. In my case, most of the notification comes from Google Chrome. So I'm using statnot to receive notifications from Google Chrome. But I had to modify the original source code a little bit.

[How to setup / reproduce]

Google Chrome checks these two things.

  • Checks if "org.freedesktop.Notifications" is "activatable" or not.
  • Checks if GetCapabilities() returns "body" and "actions".

So I had to do these steps to use statnot to receive notifications from Google Chrome.

1. Make statnot "activatable"

Create a file here.

~/.local/share/dbus-1/services/org.freedesktop.Notifications.service

The contents need to be below. Please modify the shell script as you like.

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=~/.bin/my-notification-daemon.sh

My shell script looks like below.

#!/bin/bash
exec python3 -u ~/.app/statnot/statnot ~/.app/statnot/statnot_config.py &

Now, dbus can activate statnot if there is no statnot process. And Google Chrome requires this. As you can see on the chrome's code [Ref:1], Google Chrome uses "ListActivatableNames". This is presumably because this is a more reliable way. If the statnot process dies, it will be automatically restarted.

2. Modify statnot's GetCapabilities function to return "body" and "actions"

Google Chrome requires "body" and "actions" capabilities at minimum [Ref:2]. So I had to modify statnot's GetCapabilities function like below.

    @dbus.service.method("org.freedesktop.Notifications", in_signature='', out_signature='as')
    def GetCapabilities(self):
        return ("body", "actions")

3. Launch Google Chrome with options

This is my script to launch Google Chrome. I had to launch Google Chrome via dbus-launch (or we can use export $(dbus-launch)). And also we need to enable native notifications flag (this can be set via chrome://flags/#enable-native-notifications).

#!/bin/bash
# export $(dbus-launch)
exec dbus-launch google-chrome --enable-features=NativeNotifications $@ &

In summary, my request is to return ("body", "actions") from GetCapabilities(). But it's OK for now because I just need to modify the original statnot code a bit.
Thank you for creating statnot.

[Ref:1]
https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/notifications/notification_platform_bridge_linux.cc;l=67?q=ListActivatableNames
[Ref:2]
https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/notifications/notification_platform_bridge_linux.cc;l=491

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.