Skip to content

Commit

Permalink
Add boilerplate Rich Presence integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jake158 committed Mar 7, 2024
1 parent 25000ab commit 29226d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pomodorodiscord/src/pomodoro_frame.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
import json
import threading
import customtkinter as ctk
from datetime import datetime
from src.utils import load_config, DEF_POMODORO_MINS, DEF_SB_MINS, DEF_LB_MINS, beep
from src.richpresence import RichPresence

BREAK_BTN_COLOR = "#9a9a9a"
BREAK_HOVER = "#adaaaa"
Expand All @@ -16,6 +18,9 @@ def __init__(self, master):
self.data_file = 'data.json'
config = load_config()

# Rich presence in separate thread
threading.Thread(target=self.init_rpc, daemon=True).start()

# Helper text that appears when a break is running
self.break_text = ctk.StringVar(value="")
self.break_label = ctk.CTkLabel(self, textvariable=self.break_text, font=("Roboto", 15))
Expand Down Expand Up @@ -48,6 +53,9 @@ def __init__(self, master):
self.next_timer_update = None
self.remaining_time = self.pomodoro_time

def init_rpc(self):
self.rpc = RichPresence()

def start_timer(self):
if self.next_timer_update:
self.after_cancel(self.next_timer_update)
Expand Down

0 comments on commit 29226d2

Please sign in to comment.