Commit Graph

221 Commits

Author SHA1 Message Date
enkore
bf3b77ddbd Code cleanup 2013-02-22 23:21:53 +01:00
enkore
2625de19dc Readme 2013-02-22 21:29:56 +01:00
enkore
5474980b11 Support for standalone operation
Specify standalone=True to the I3statushandler constructor
to run i3pystatus without i3status in the background.
i3pystatus won't read input from stdin or any other
file object specified with input_stream.

The keyword argument interval specifies how often output should
be generated. The default is 1 (second).


Sorry guys for changing the way i3pystatus "way of operation"
is set so often. If you're want the "self-contained" mode
(you execute i3pystatus, i3pystatus automatically starts
i3status), don't set the file attribute, but pass the file
descriptor of the pipe as input_stream like this:

process = subprocess.Popen(["i3status", "-c", "~/.i3/status"], stdout=subprocess.PIPE, universal_newlines=True)
status = i3pystatus(input_stream=process.stdout)

On a side note:
The main class name has been changed to i3pystatus, but I3statusHandler
is still available as an alias. Use whichever you prefer :-)
(Linux is about choice after all)
2013-02-22 21:23:58 +01:00
enkore
4c5dfbe429 Using uevent instead of the separate files reduces I/O...
...and makes the code a bit cleaner.

Didn't touch much of the class logic, except that it just
displays the charge if the state is "Unknown".
2013-02-22 21:04:33 +01:00
enkore
62b59db8d6 Fixed issue #9
Notmuch checker does not work in this state
NotmuchMailChecker does not work because of a conflict between the notmuch Python API and the file for NotmuchMailChecker which is also named notmuch.

I suggest to rename i3pystatus/notmuch.py to i3pystatus/notmuchchecker.py and modify main.py.dist appropriately.

Reported by mjepronk

Also removed some superfluous whitespace
2013-02-22 18:16:39 +01:00
enkore
8a1041ac0e Merge branch 'master' of https://github.com/janoliver/i3pystatus 2013-02-22 18:14:05 +01:00
Jan Oliver Oelerich
e44770ef14 Merge pull request #8 from mjepronk/master
Two new modules (battery status and clock)
2013-02-22 08:52:43 -08:00
Matthias Pronk
400d639e31 register_module has been renamed to register 2013-02-22 14:15:14 +01:00
Matthias Pronk
0adbc0ad28 remove unused import 2013-02-22 14:11:05 +01:00
Matthias Pronk
fdadd3f143 clock added 2013-02-22 13:59:28 +01:00
Matthias Pronk
c72363092d battery checker added 2013-02-22 13:56:37 +01:00
Jan Oliver Oelerich
e9b1976e1e Merge pull request #7 from enkore/master
Mailchecker, regex
2013-02-21 14:50:18 -08:00
enkore
4966f90775 .dist 2013-02-21 16:08:52 +01:00
enkore
99b1e003cb Fixed crash if used with normal pipe
If one wants to run i3status as a subprocess of
i3pystatus, do it like this:

import subprocess
import io
...
process = subprocess.Popen(["i3status", "-c", "~/.i3/status"], stdout=subprocess.PIPE)
stdin = io.TextIOWrapper(process.stdout)
status = I3statusHandler(stdin)
2013-02-21 14:05:11 +01:00
enkore
426f57d97d Regex module. Batteries... eh.. example included.
*gotta get some sleep. maybe.
2013-02-21 04:56:34 +01:00
enkore
d3228cc8be Reworked that (again) 2013-02-19 01:59:59 +01:00
enkore
d4f1c77c85 Once in a while I even delete code. I like it. 2013-02-19 01:59:43 +01:00
Jan Oliver Oelerich
43b72066f4 Merge pull request #6 from enkore/master
Once again… I/O handling
2013-02-18 10:22:51 -08:00
enkore
e3829b5700 We were finally successful in moving the input loop
to the lower I/O layer.
This means we unified the loop with it's implicit abort
condition (end of stream or ^C).
2013-02-18 19:15:27 +01:00
enkore
6ff3e8ebf3 One may want to change the ordering
("injecting" items in the middle of i3status output, for example)
2013-02-18 18:06:08 +01:00
enkore
143d7d1a40 Turns out, i3bar doesn't care for "None". One conditional less <3 2013-02-18 18:03:54 +01:00
enkore
0ad4ae6a02 This isn't a program... this is a poem! 2013-02-18 18:02:23 +01:00
enkore
1d4403e308 Let's remove that synchronous functionality alltogether.
It simply isn't in the spirit of this app :-)
And nobody uses it.
2013-02-18 18:00:16 +01:00
Jan Oliver Oelerich
8e5231b56e Merge pull request #5 from enkore/master
Refactored IO
2013-02-17 05:30:07 -08:00
enkore
84fdbfaff3 Using a context here is much... smoother
exploited_language_features += 2;

(I also exploit the mutability of the list-object here,
yield j binds the list to the context,
when the context is leaved execution continues and the
modified j is written back)
2013-02-17 14:02:55 +01:00
enkore
797333e7ac Added some magic to JSONIO 2013-02-17 13:57:22 +01:00
enkore
60b5def7d9 Splitted IO handling even a bit more :-) 2013-02-17 01:25:41 +01:00
enkore
ab5afd0227 Moved IO handling out of main class
(for reusability; I use that piece of code now elsewhere
and want to keep that easily in sync)
2013-02-17 01:19:04 +01:00
enkore
973abc928e Support for external file descriptors.
Allows to run i3status directly from your __main__, like this:

    status.register(...) # and so on

    process = subprocess.Popen("i3status", stdout=subprocess.PIPE)
    status.fd = process.stdout

    # start the handler
    status.run()
2013-02-17 00:55:25 +01:00
Jan Oliver Oelerich
1548209222 Merge pull request #4 from enkore/py3k
Py3k
2013-02-15 15:53:29 -08:00
enkore
7e2c61c21a mailchecker ; didn't really test it yet 2013-02-15 21:14:39 +01:00
enkore
c4e80b3e40 notmuch^2 2013-02-15 21:09:54 +01:00
enkore
c93503704b Changed modsde 2013-02-15 21:08:29 +01:00
enkore
2c7b0fcef9 Added yet another module type, fixed notmuch module
(Yeah, I'm really lazy today)
2013-02-15 21:06:52 +01:00
enkore
59ab38d83b Readme 2013-02-15 18:43:20 +01:00
enkore
8ec1972a3e Replaced conditionals with polymorphism 2013-02-15 18:38:50 +01:00
enkore
561e60efee Consistent quotes 2013-02-15 18:38:18 +01:00
enkore
922ae49aba Create package i3pystatus 2013-02-12 01:07:26 +01:00
enkore
469f711dcd .gitignore 2013-02-11 21:43:11 +01:00
enkore
54c14658bc Common code elimination run 2013-02-11 21:37:07 +01:00
enkore
4c45087a5b ... 2013-02-11 21:25:21 +01:00
enkore
484cfbbf03 Format settings 2013-02-11 21:25:14 +01:00
enkore
2c97a67494 Readme 2013-02-11 21:24:58 +01:00
enkore
807eb937fd ... 2013-02-11 21:09:53 +01:00
enkore
db94df07a3 With small changes, comes great change
Introduced asynchronous plugins that gather their data on different
intervals than the mainloop. Here it is used for the modsde plugin.

The statushandler has a new class Module, which acts as documentation
for the API


These changes let the output evenly flow, even if an async plugin hangs
due to network problems or similiar issues.
2013-02-11 21:01:38 +01:00
enkore
80d7184e14 Merge branch 'master' of github.com:enkore/i3pystatus
Conflicts:
	statushandler.py
2013-02-11 17:25:58 +01:00
enkore
cb71fca25d Also import the tb plugin 2013-02-11 17:21:32 +01:00
enkore
a5db47fcf8 Python 3 2013-02-11 16:03:52 +01:00
enkore
71c64b2c26 As far as I can tell that IP address is down
(both ping and nmap -Pn confirm this)
2013-02-11 15:52:52 +01:00
enkore
45f9ba3c66 Update statushandler.py 2013-02-11 13:06:12 +01:00