InstantScreenshare: Focus Discord Setting
This commit is contained in:
parent
6d753bf414
commit
de23ce496f
2 changed files with 9 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ import { Devs, EquicordDevs } from "@utils/constants";
|
|||
import definePlugin from "@utils/types";
|
||||
import { VoiceState } from "@vencord/discord-types";
|
||||
import { findByCodeLazy, findStoreLazy } from "@webpack";
|
||||
import { ChannelStore, MediaEngineStore, PermissionsBits, PermissionStore, SelectedChannelStore, showToast, Toasts, UserStore, VoiceActions } from "@webpack/common";
|
||||
import { ChannelStore, MediaEngineStore, PermissionsBits, PermissionStore, SelectedChannelStore, showToast, Toasts, UserStore, VoiceActions, WindowStore } from "@webpack/common";
|
||||
|
||||
import { getCurrentMedia, settings } from "./utils";
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ const StreamPreviewSettings = getUserSettingLazy("voiceAndVideo", "disableStream
|
|||
const ApplicationStreamingSettingsStore = findStoreLazy("ApplicationStreamingSettingsStore");
|
||||
|
||||
async function autoStartStream(instant = true) {
|
||||
if (!instant && !WindowStore.isFocused() && settings.store.focusDiscord) return;
|
||||
const selected = SelectedChannelStore.getVoiceChannelId();
|
||||
if (!selected) return;
|
||||
|
||||
|
|
@ -89,7 +90,7 @@ export default definePlugin({
|
|||
predicate: () => settings.store.keybindScreenshare,
|
||||
replacement: {
|
||||
match: /\[\i\.\i\.DISCONNECT_FROM_VOICE_CHANNEL/,
|
||||
replace: '["INSTANT_SCREEN_SHARE"]:{onTrigger(){$self.autoStartStream(false)},keyEvents:{keyUp:!1,keyDown:!0,blurred:!1,focused:!0}},$&'
|
||||
replace: '["INSTANT_SCREEN_SHARE"]:{onTrigger(){$self.autoStartStream(false)},keyEvents:{keyUp:!1,keyDown:!0}},$&'
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,12 +53,17 @@ export const settings = definePluginSettings({
|
|||
restartNeeded: true,
|
||||
default: false,
|
||||
},
|
||||
focusDiscord: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Only start screenshare with keybind when Discord is focused",
|
||||
default: true,
|
||||
},
|
||||
toolboxManagement: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Enable/Disable Instant Screenshare",
|
||||
default: true,
|
||||
hidden: true,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export async function getCurrentMedia() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue