Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Re-enabling pinch to zoom on Discord Canary
Find the directory for the `Local` instance of your Discord client, e.g. `AppData\Local\DiscordCanary\app-0.0.214`.
Make a directory called `app` in the `resources` directory, e.g. `AppData\Local\DiscordCanary\app-0.0.214\resources\app`.
Paste the `index.js`, `inject.js` and `package.json` files into the `app` directory you just made.
Restart your client.
Credits to Kura for helping me figure this out :)
const path = require('path');
const Module = require('module');
const { BrowserWindow, app } = require('electron');
const entry = Object.keys(require.cache).find(k => k.includes('browser-window.js'));
require.cache[entry].exports = class PatchedBrowserWindow extends BrowserWindow {
constructor (opts) {
opts.webPreferences = opts.webPreferences || {};
opts.webPreferences.preload = path.join(__dirname, 'inject.js');
return new BrowserWindow(opts);
}
};
const basePath = path.join(__dirname, '..', 'app.asar');
const { main } = require(path.join(basePath, 'package.json'));
app.getAppPath = () => basePath;
Module._load(path.join(basePath, main), null, true);
require(`C:\\Users\\${require('os').userInfo().username}\\AppData\\Roaming\\discordcanary\\${process.argv[0].match(/0\.0\.\d{3}/)[0]}\\modules\\discord_desktop_core\\core.asar\\app\\mainScreenPreload.js`);
/* Where the magic happens: */
require('electron').webFrame.setVisualZoomLevelLimits(1, 3);
{
"main": "index.js"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.