Lotsofstuf
This commit is contained in:
parent
3d24d97d51
commit
45c3bfe4d4
16 changed files with 190 additions and 43 deletions
|
@ -9,6 +9,7 @@ import signal
|
|||
import subprocess
|
||||
import logging
|
||||
import coloredlogs
|
||||
import updaters
|
||||
|
||||
coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s')
|
||||
log = logging.getLogger()
|
||||
|
@ -23,6 +24,7 @@ log = logging.getLogger()
|
|||
# TODO Use default colors of lemonbar sometimes
|
||||
# TODO Adapt bar height with font height
|
||||
# TODO OPTI Static text objects that update its parents if modified
|
||||
# TODO OPTI Updater locks, do not LB screen util every updater finished
|
||||
|
||||
|
||||
class BarGroupType(enum.Enum):
|
||||
|
@ -118,7 +120,6 @@ class Bar:
|
|||
Bar.actionsF2H[function] = handle
|
||||
Bar.actionsH2F[handle] = function
|
||||
|
||||
log.debug("Registered action {} → {}".format(handle, function))
|
||||
return handle
|
||||
|
||||
@staticmethod
|
||||
|
@ -292,8 +293,10 @@ class SectionThread(threading.Thread):
|
|||
ANIMATION_START = 0.025
|
||||
ANIMATION_STOP = 0.001
|
||||
ANIMATION_EVOLUTION = 0.9
|
||||
|
||||
def run(self):
|
||||
while Section.somethingChanged.wait():
|
||||
updaters.notBusy.wait()
|
||||
Section.updateAll()
|
||||
animTime = self.ANIMATION_START
|
||||
frameTime = time.perf_counter()
|
||||
|
|
|
@ -488,10 +488,14 @@ class NotmuchUnreadProvider(ColorCountsSection, InotifyUpdater):
|
|||
queryStr = 'folder:/{}/ and tag:unread'.format(account)
|
||||
query = notmuch.Query(db, queryStr)
|
||||
nbMsgs = query.count_messages()
|
||||
if account == 'frogeye':
|
||||
global q
|
||||
q = query
|
||||
print(489, self.dir, queryStr, nbMsgs)
|
||||
if nbMsgs < 1:
|
||||
continue
|
||||
counts.append((nbMsgs, self.colors[account]))
|
||||
db.close()
|
||||
# db.close()
|
||||
return counts
|
||||
|
||||
def __init__(self, dir='~/.mail/', theme=None):
|
||||
|
|
13
config/lemonbar/requirements.txt
Normal file
13
config/lemonbar/requirements.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
coloredlogs==10.0
|
||||
enum-compat==0.0.2
|
||||
humanfriendly==4.16.1
|
||||
i3ipc==1.6.0
|
||||
ifaddr==0.1.4
|
||||
ipaddress==1.0.22
|
||||
psutil==5.4.7
|
||||
pulsectl==18.8.0
|
||||
pyinotify==0.9.6
|
||||
python-mpd2==1.0.0
|
||||
python-uinput==0.11.2
|
||||
yoke==0.1.1
|
||||
zeroconf==0.21.3
|
|
@ -16,12 +16,14 @@ log = logging.getLogger()
|
|||
|
||||
# TODO Sync bar update with PeriodicUpdater updates
|
||||
|
||||
notBusy = threading.Event()
|
||||
|
||||
class Updater:
|
||||
@staticmethod
|
||||
def init():
|
||||
PeriodicUpdater.init()
|
||||
InotifyUpdater.init()
|
||||
notBusy.set()
|
||||
|
||||
def updateText(self, text):
|
||||
print(text)
|
||||
|
@ -49,15 +51,18 @@ class PeriodicUpdaterThread(threading.Thread):
|
|||
# TODO Sync with system clock
|
||||
counter = 0
|
||||
while True:
|
||||
notBusy.set()
|
||||
if PeriodicUpdater.intervalsChanged \
|
||||
.wait(timeout=PeriodicUpdater.intervalStep):
|
||||
# ↑ sleeps here
|
||||
notBusy.clear()
|
||||
PeriodicUpdater.intervalsChanged.clear()
|
||||
counter = 0
|
||||
for providerList in PeriodicUpdater.intervals.copy().values():
|
||||
for provider in providerList.copy():
|
||||
provider.refreshData()
|
||||
else:
|
||||
notBusy.clear()
|
||||
counter += PeriodicUpdater.intervalStep
|
||||
counter = counter % PeriodicUpdater.intervalLoop
|
||||
for interval in PeriodicUpdater.intervals.keys():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue