Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix watch play/pause icon display for Kitty terminal #1717

Merged
merged 1 commit into from
Jan 9, 2024
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
21 changes: 17 additions & 4 deletions plextraktsync/watch/ProgressBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,34 @@ class ProgressBar(dict):

@cached_property
def progress(self):
from rich.box import MINIMAL
from rich.live import Live
from rich.panel import Panel
from rich.progress import (BarColumn, Progress, TextColumn,
TimeRemainingColumn)

console = factory.console
progress = Progress(
TextColumn("{task.fields[play_state]} [bold blue]{task.description}", justify="left"),
TextColumn(" {task.fields[play_state]} [bold blue]{task.description}", justify="left"),
BarColumn(bar_width=None),
"[progress.percentage]{task.percentage:>3.1f}%",
"•",
TimeRemainingColumn(),
console=factory.console,
console=console,
)
progress.start()

# -1 to adjust Kitty terminal issue
# https://github.com/Textualize/rich/issues/3254#issuecomment-1881885471
panel_width = console.size.width - 1
panel = Panel(progress, width=panel_width, padding=(0, 0), box=MINIMAL)
live = Live(panel, console=console).__enter__()

def stop():
progress.stop()
live.stop()

import atexit
atexit.register(lambda: progress.stop())
atexit.register(lambda: stop())

return progress

Expand Down
Loading