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

RPC keeps showing even after I switch/close tab #240

Open
karimawi opened this issue Aug 8, 2022 · 9 comments
Open

RPC keeps showing even after I switch/close tab #240

karimawi opened this issue Aug 8, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@karimawi
Copy link

karimawi commented Aug 8, 2022

I use only 2 presences, AniMixPlay and Twitch, both of them keep sticking to my Discord profile even after I switch tabs or even close them, it eventually closes (sometimes doesn't at all) but it's so random, sometimes it closes after a couple of minutes, some times an hour, sometimes even more

What it's supposed to do: Remove the presence from profile as soon as I switch/close the tab with the presence, or add an option for every presence (or all presences if adding the setting for everyone would be a pain) to toggle the sticky presence thing, whether it should keep the presence even when you switch tabs or not, and for closing tabs I don't think it should keep the presence at all, that's clearly a bug, and I don't know if someone else is having it.

Version: PreMiD v2.2.0 | Ext v2.2.3
OS: Windows 10 64-Bit Version 21H1
Browser: Google Chrome Version 104.0.5112.81 (Official Build) (64-bit)

@EncryptedDev EncryptedDev added the bug Something isn't working label Aug 9, 2022
@EncryptedDev
Copy link
Contributor

This is a known bug. The following may help:

  • Have you tried to reinstall the PreMiD client?
  • Do you have any apps which could cause interference installed? (e.g. antiviruses)

@karimawi
Copy link
Author

karimawi commented Aug 9, 2022

I didn't actually try to reinstall it so I'm going to try that, but for the antivirus part I only use Windows Defender and it didn't recognize PreMiD or any of its connections as suspicious afaict so, I'll just try reinstalling it, if the issue presists, I'll let you know, thanks for the resppnse.

@EncryptedDev
Copy link
Contributor

Awesome. For this sort of issue, it is best if you raise your issue in our Support Discord server. discord.gg/premid

@karimawi
Copy link
Author

karimawi commented Aug 9, 2022

Sure, so I keep this issue open? Then when I try the reinstall I go to the Discord? Right?

@karimawi
Copy link
Author

karimawi commented Aug 15, 2022

Hey, I reinstalled, got the same issue, reached out to Discord support, here's the ticket conversation:

Screenshot_20220815-164132_Discord

Can this toggle be implemented? Cause I find it very annoying to have a presence stuck on your profile the whole time when it's not even what you're doing/watching/hearing etc..

@Timeraa
Copy link
Member

Timeraa commented Mar 25, 2023

Moving this to the Extension repo as it's a Extension bug but also Application bug could cause this. Should be fixed with v2.5

@karimawi
Copy link
Author

karimawi commented May 24, 2024

I don't know if something like that would work for Chrome, using the "active" and the "lastFocusedWindow" bools alongside each other to determine whether the tab is focused or not, there's already an implementation for this in tabPriority.ts async function but I'm not experienced enough with JS/TS to know why it's not working properly.

function checkTabFocusState(tabId, callback) {
  chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
    if (tabs.length > 0) {
      const currentTab = tabs[0];
      const isFocused = (currentTab.id === tabId);
      callback(isFocused);
    } else {
      callback(false);
    }
  });
}

And then use some event listeners to implement the above function:

chrome.tabs.onActivated.addListener(function(activeInfo) {
  checkTabFocusState(activeInfo.tabId, function(isFocused) {
    if (isFocused) {
      console.log(`Tab ${activeInfo.tabId} is now focused.`);
    }
  });
});

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
  if (changeInfo.status === 'complete') {
    checkTabFocusState(tabId, function(isFocused) {
      if (isFocused) {
        console.log(`Tab ${tabId} is now focused.`);
      }
    });
  }
});

The "chrome.windows.onFocusChanged" can be used as well to detect if Chrome is even focused by the system in the first place, maybe the tab is focused but chrome is minimized, and if it's minimized the presence can still be show if a site is playing media which can be detected using the "audible" bool property for the tab object that is equivalent to the speaker icon appearing on the tab (as described in the docs)

An alternative would be using the visibilitychange API but I don't actually think that would work properly across all browsers as it's not exactly designed for tab changes, I just thought I'd throw it here if it sparks something.

@karimawi
Copy link
Author

karimawi commented May 24, 2024

Moving this to the Extension repo as it's a Extension bug but also Application bug could cause this. Should be fixed with v2.5

Hey, @Timeraa thanks for the transfer (just noticed your comment a year+ later 💀, srry), I'm running 2.6, I have a new device now running Win11, I'm having the same exact issue as well as some other people who opened issues in the wrong repo again (idk who'd do such thing that's very weird).

@Timeraa
Copy link
Member

Timeraa commented May 27, 2024

It should be a lot better now but we're working hard on it all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants