Ejemplo n.º 1
0
def test_application_info():
    for i in range(2):
        try:
            print(applicationinfo.get_active_window_title())
            print(applicationinfo.get_active_process_name())
        except applicationinfo.UncriticalException:
            pass
        time.sleep(1)
Ejemplo n.º 2
0
    def update(self):
        try:
            _today = track_common.today_int()
            self._current_minute = track_common.minutes_since_midnight()

            if self._active_day < _today:
                print("current minute is %d - it's midnight" % self._current_minute)
                #midnight!
                self.save('track-log-%d.json' % self._active_day)
                self.clear()

            self._active_day = _today

            self._current_minute = track_common.minutes_since_midnight()

            self._user_is_active = True

            self._idle_current = idle.getIdleSec()
            self._current_app_title = applicationinfo.get_active_window_title()
            try:
                self._current_process_exe = applicationinfo.get_active_process_name()
            except applicationinfo.UncriticalException as e: #necessary to run in i3
                self._current_process_exe = "Process not found"
                
            self._rules.highlight_string(self._current_app_title)
            self._rules.update_categories_time(self.get_time_per_categories())

            if self._idle_current > 10:
                self._user_is_active = False
                return

            _app = track_common.app_info(self._current_app_title, 
                            self._current_process_exe)
            _app._category = self._rules.get_first_matching_key(_app)

            _app = self._applications.update(
                        self._current_minute,
                        _app)

        except applicationinfo.UncriticalException as e:
            pass
Ejemplo n.º 3
0
    def update(self):
        try:
            _today = track_common.today_int()
            self._current_minute = track_common.minutes_since_midnight()

            if self._active_day < _today:
                print("current minute is %d - it's midnight" % self._current_minute)
                #midnight!
                self.save('track-log-%d.json' % self._active_day)
                self.clear()

            self._active_day = _today

            self._current_minute = track_common.minutes_since_midnight()

            self._user_is_active = True

            self._idle_current = idle.getIdleSec()
            self._current_app_title = applicationinfo.get_active_window_title()
            self._current_process_exe = applicationinfo.get_active_process_name()

            self._rules.highlight_string(self._current_app_title)

            if self._idle_current > 10:
                self._user_is_active = False
                return

            _app = track_common.app_info(self._current_app_title, 
                            self._current_process_exe)
            _app._category = self._rules.get_first_matching_key(_app)

            _app = self._applications.update(
                        self._current_minute,
                        _app)

        except applicationinfo.UncriticalException as e:
            pass