Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions sclack/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def __init__(self, profile, channels=(), dms=(), stars=(), title=''):
self.stars = stars
self.dms = dms
self.groups = ()
self.last_time_clicked = None

# Subscribe to receive message from channels to select them
for channel in self.channels:
Expand Down Expand Up @@ -908,13 +909,20 @@ def keypress(self, size, key):
return super(SideBar, self).keypress(size, key)

def mouse_event(self, size, event, button, col, row, focus):
if event == 'mouse press' and button in (4, 5):
if button == 4:
self.keypress(size, 'up')
return True
if event == 'mouse press':
if button in (4, 5):
if button == 4:
self.keypress(size, 'up')
return True
else:
self.keypress(size, 'down')
return True
else:
self.keypress(size, 'down')
return True
now = time.time()
if self.last_time_clicked and (now - self.last_time_clicked < 0.5):
self.keypress(size, 'enter')
self.last_time_clicked = now

return super(SideBar, self).mouse_event(size, event, button, col, row, focus)


Expand Down