Skip to content

Commit

Permalink
Add flag to stop multiple visualiser processes
Browse files Browse the repository at this point in the history
Fixes #116
  • Loading branch information
elParaguayo committed Sep 22, 2022
1 parent 83bea6e commit e16dc16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2022-09-22: [BUGFIX] Stop multiple visualiser processes being spawned by widget
2022-09-19: [FEATURE] Add `Visualizer` widget
2022-09-16: [BUGFIX] Fix transparency issue in `PowerLineDecoration`
2022-09-13: [FEATURE] Add clipping to `RectDecoration`
Expand Down
5 changes: 4 additions & 1 deletion qtile_extras/widget/visualiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def __init__(self, **config):
self._timer = None
self._draw_count = 0
self._toggling = False
self._starting = False

def _configure(self, qtile, bar):
if self.cava_path is None:
Expand Down Expand Up @@ -117,6 +118,7 @@ def _set_length(self):
self.length = new

def _start(self):
self._starting = True
self.cava_proc = self.qtile.cmd_spawn([self.cava_path, "-p", self.config_file.name])
self.draw_proc = self.qtile.cmd_spawn(
[
Expand Down Expand Up @@ -185,6 +187,7 @@ def lock_shm(buffer):

self._take_lock = lock_shm
self._procs_started = True
self._starting = False
self._set_length()

@contextmanager
Expand Down Expand Up @@ -234,7 +237,7 @@ def cmd_stop(self):

def cmd_start(self):
"""Start the visualiser."""
if self._procs_started or self._toggling:
if self._procs_started or self._toggling or self._starting:
return

with self.lock_state():
Expand Down

0 comments on commit e16dc16

Please sign in to comment.