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

View file

@ -4,21 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByCode, findByProps } from "@webpack";
import { ChannelStore, SelectedChannelStore, UserStore } from "@webpack/common";
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;
async function startStream() {
@ -42,29 +33,11 @@ async function startStream() {
}
export default definePlugin({
name: "ScreenshareKeybind",
description: "Adds a keybind to instantly screenshare your first screen",
authors: [Devs.HAHALOSAH],
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"
}
}
],
name: "InstantScreenshare",
description: "Instantly screenshare your first screen when joining a voice channel",
authors: [Devs.HAHALOSAH, EquicordDevs.thororen],
flux: {
async VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[]; }) {
if (!settings.store.instantScreenShare) return;
const myId = UserStore.getCurrentUser().id;
for (const state of voiceStates) {
const { userId, channelId } = state;
@ -83,8 +56,5 @@ export default definePlugin({
}
}
},
async trigger() {
await startStream();
}
});