def main(): # Verify python version is >=3.5 # req_version is 3.5 due to usage of subprocess.run assert_version((3, 5)) if sys.platform.startswith("linux") and ("DISPLAY" not in os.environ or not os.environ["DISPLAY"]): raise Exception("DISPLAY environment variable not set") # Read settings from config config = load_config() args = parse_args(default_poll_time=config.getfloat("poll_time")) setup_logging(name="aw-watcher-window", testing=args.testing, verbose=args.verbose, log_stderr=True, log_file=True) client = ActivityWatchClient("aw-watcher-window", testing=args.testing) bucket_id = "{}_{}".format(client.client_name, client.client_hostname) event_type = "currentwindow" client.create_bucket(bucket_id, event_type, queued=True) logger.info("aw-watcher-window started") sleep(1) # wait for server to start with client: heartbeat_loop(client, bucket_id, poll_time=args.poll_time, exclude_title=args.exclude_title)
def main(): # Verify python version is >=3.5 # req_version is 3.5 due to usage of subprocess.run assert_version((3, 5)) if sys.platform.startswith("linux") and ("DISPLAY" not in os.environ or not os.environ["DISPLAY"]): raise Exception("DISPLAY environment variable not set") # Read settings from config config = load_config() args = parse_args(default_poll_time=config.getfloat("poll_time"), default_exclude_title=config.getboolean("exclude_title")) setup_logging(name="aw-watcher-window", testing=args.testing, verbose=args.verbose, log_stderr=True, log_file=True) client = ActivityWatchClient("aw-watcher-window", testing=args.testing) bucket_id = "{}_{}".format(client.client_name, client.client_hostname) event_type = "currentwindow" client.create_bucket(bucket_id, event_type, queued=True) logger.info("aw-watcher-window started") sleep(1) # wait for server to start with client: heartbeat_loop(client, bucket_id, poll_time=args.poll_time, exclude_title=args.exclude_title)