Last active
October 5, 2018 13:06
-
-
Save aetheryx/ea4a59c89dec955af5b84b0164bbc166 to your computer and use it in GitHub Desktop.
Re-enabling pinch to zoom on Discord Canary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"main": "index.js" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment