diff --git a/DiscordRichPresence.sublime-settings b/DiscordRichPresence.sublime-settings index f98cb55..55da090 100644 --- a/DiscordRichPresence.sublime-settings +++ b/DiscordRichPresence.sublime-settings @@ -32,6 +32,9 @@ // Whether to change the timestamp when switching to/editing another file. "time_per_file": true, + // Whether or not to show the elapsed time + "show_elapsed_time": true, + // Whether or not to use the small icon (changes for every language) in the presence. "small_icon": false, diff --git a/drp.py b/drp.py index 1473617..ce3f425 100644 --- a/drp.py +++ b/drp.py @@ -129,6 +129,7 @@ def base_activity(started = False): 'raku' } + def get_icon(file, ext, _scope): main_scope = _scope.split()[0] base_scope = main_scope.split('.')[0] @@ -154,6 +155,7 @@ def get_icon(file, ext, _scope): return 'https://raw.githubusercontent.com/Snazzah/SublimeDiscordRP/master/icons/lang-%s.png' % icon + def yield_subscopes(scope): last_dot = len(scope) while last_dot > 0: @@ -224,7 +226,10 @@ def handle_activity(view, is_write=False, idle=False): elif settings.get('small_icon'): act['assets']['small_image'] = icon act['assets']['small_text'] = language - act['timestamps'] = {'start': stamp} + + if settings.get('show_elapsed_time'): + act['timestamps'] = {'start': stamp} + logger.info(window.folders()) try: ipc.set_activity(act) @@ -314,7 +319,9 @@ def connect(silent=False, retry=True): return act = base_activity(True) - act['timestamps'] = {'start': start_time} + if settings.get('show_elapsed_time'): + act['timestamps'] = {'start': start_time} + try: ipc.set_activity(act) except OSError as e: @@ -367,6 +374,7 @@ def on_close(self, view): else: reset_activity() else: reset_activity() + class DiscordrpConnectCommand(sublime_plugin.ApplicationCommand): def is_enabled(self):