bumblebee-status/bumblebee-status
Tobi-wan Kenobi e72c25b0bc [core] Add input processing
Create infrastructure for input event handling and add i3bar event
processing. For each event, callbacks can be registered in the input
module.
Modules and widgets both identify themselves using a unique ID (the
module name for modules, a generated UUID for the widgets). This ID is
then used for registering the callbacks. This is possible since both
widgets and modules are statically allocated & do not change their IDs.

Callback actions can be either callable Python objects (in which case
the event is passed as parameter), or strings, in which case the string
is interpreted as a shell command.

see #23
2016-12-09 19:29:16 +01:00

38 lines
934 B
Python
Executable file

#!/usr/bin/env python
import sys
import bumblebee.theme
import bumblebee.engine
import bumblebee.config
import bumblebee.output
import bumblebee.input
def main():
config = bumblebee.config.Config(sys.argv[1:])
theme = bumblebee.theme.Theme(config.theme())
output = bumblebee.output.I3BarOutput(theme=theme)
inp = bumblebee.input.I3BarInput()
engine = bumblebee.engine.Engine(
config=config,
output=output,
inp=inp,
)
try:
engine.run()
except KeyboardInterrupt as error:
inp.stop()
sys.exit(0)
except bumblebee.error.BaseError as error:
inp.stop()
sys.stderr.write("fatal: {}\n".format(error))
sys.exit(1)
except Exception as error:
inp.stop()
sys.stderr.write("fatal: {}\n".format(error))
sys.exit(2)
if __name__ == "__main__":
main()
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4