ScreenshareKeybind -> InstantScreenshare

Discord has a toggle ss bind I forgot
This commit is contained in:
thororen1234 2025-04-07 00:33:39 -04:00
parent dbcc34289e
commit bf45222d77
No known key found for this signature in database
2 changed files with 6 additions and 36 deletions

View file

@ -88,6 +88,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
- ImagePreview by Creations - ImagePreview by Creations
- ImgToGif by zyqunix - ImgToGif by zyqunix
- InRole by nin0dev - InRole by nin0dev
- InstantScreenshare by HAHALOSAH & thororen
- IRememberYou by zoodogood - IRememberYou by zoodogood
- Jumpscare by Surgedevs - Jumpscare by Surgedevs
- JumpToStart by Samwich - JumpToStart by Samwich
@ -130,7 +131,6 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
- ReplyPingControl by ant0n & MrDiamond - ReplyPingControl by ant0n & MrDiamond
- RPCEditor by Nyako & nin0dev - RPCEditor by Nyako & nin0dev
- RPCStats by Samwich - RPCStats by Samwich
- ScreenshareKeybind by HAHALOSAH
- SearchFix by Jaxx - SearchFix by Jaxx
- SekaiStickers by MaiKokain - SekaiStickers by MaiKokain
- ServerSearch by camila314 - ServerSearch by camila314

View file

@ -4,21 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { definePluginSettings } from "@api/Settings"; import { Devs, EquicordDevs } from "@utils/constants";
import { Devs } from "@utils/constants"; import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
import { findByCode, findByProps } from "@webpack"; import { findByCode, findByProps } from "@webpack";
import { ChannelStore, SelectedChannelStore, UserStore } from "@webpack/common"; import { ChannelStore, SelectedChannelStore, UserStore } from "@webpack/common";
import { VoiceState } from "@webpack/types"; import { VoiceState } from "@webpack/types";
const settings = definePluginSettings({
instantScreenShare: {
description: "Instantly screenshare screen 1 when joining a voice channel",
type: OptionType.BOOLEAN,
default: false
}
});
let hasStreamed = false; let hasStreamed = false;
async function startStream() { async function startStream() {
@ -42,29 +33,11 @@ async function startStream() {
} }
export default definePlugin({ export default definePlugin({
name: "ScreenshareKeybind", name: "InstantScreenshare",
description: "Adds a keybind to instantly screenshare your first screen", description: "Instantly screenshare your first screen when joining a voice channel",
authors: [Devs.HAHALOSAH], authors: [Devs.HAHALOSAH, EquicordDevs.thororen],
settings,
patches: [
{
find: "DISCONNECT_FROM_VOICE_CHANNEL]",
replacement: {
match: /\[\i\.\i\.DISCONNECT_FROM_VOICE_CHANNEL/,
replace: "SHARE_ENTIRE_SCREEN:{onTrigger:$self.trigger,keyEvents:{keyUp:!1,keyDown:!0}},$&"
},
},
{
find: "keybindActionTypes()",
replacement: {
match: /=\[(\{value:\i\.\i\.UNASSIGNED)/,
replace: "=[{value:'SHARE_ENTIRE_SCREEN',label:'Share Entire Screen'},$1"
}
}
],
flux: { flux: {
async VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[]; }) { async VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[]; }) {
if (!settings.store.instantScreenShare) return;
const myId = UserStore.getCurrentUser().id; const myId = UserStore.getCurrentUser().id;
for (const state of voiceStates) { for (const state of voiceStates) {
const { userId, channelId } = state; const { userId, channelId } = state;
@ -83,8 +56,5 @@ export default definePlugin({
} }
} }
}, },
async trigger() {
await startStream();
}
}); });