Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
feat: add toggle fullscreen option
Browse files Browse the repository at this point in the history
  • Loading branch information
renanrcp committed Feb 20, 2023
1 parent c44d504 commit 9ac28cb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ OBS: macOS installer not available for now.
- URL setter for change to any CPPS the user want.
- Clear cache option
- Reload and Reload Without Cache
- Can set FullScreen
- Can open Chromium Dev Tools
- Optional AD Blocker for performance gameplay (comes disabled)
- Optional Discord Rich Presence (comes disabled)
Expand Down
6 changes: 6 additions & 0 deletions src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import openDevTools from "./dev-tools";
import { enableOrDisableDiscordRPC, enableOrDisableDiscordRPCLocationTracking } from "./discord";
import { Store } from "./store";
import changeClubPenguinUrl from "./urlchanger";
import { toggleFullScreen } from "./window";

const createMenuTemplate = (store: Store, mainWindow: BrowserWindow): MenuItemConstructorOptions[] => {
const options = {
Expand Down Expand Up @@ -33,6 +34,11 @@ const createMenuTemplate = (store: Store, mainWindow: BrowserWindow): MenuItemCo
label: 'Reload without cache',
accelerator: 'CommandOrControl+R',
click: () => { mainWindow.webContents.reloadIgnoringCache(); }
},
{
label: 'Toggle Fullscreen',
accelerator: 'F11',
click: () => { toggleFullScreen(store, mainWindow); }
}
]
};
Expand Down
1 change: 1 addition & 0 deletions src/store/PrivateSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import { DiscordState } from "./DiscordState";
export type PrivateSchema = {
blocker?: ElectronBlocker;
discordState?: DiscordState;
fullScreen: boolean;
}
9 changes: 9 additions & 0 deletions src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import { createAdblocker } from "./adblocker";
import { Store } from "./store";
import { getUrlFromStore } from "./urlchanger";


export const toggleFullScreen = (store: Store, mainWindow: BrowserWindow) => {
const fullScreen = !store.private.get('fullScreen') ?? false;

store.private.set('fullScreen', fullScreen);

mainWindow.setFullScreen(fullScreen);
};

const createWindow = async (store: Store) => {
const mainWindow = new BrowserWindow({
width: 1280,
Expand Down

0 comments on commit 9ac28cb

Please sign in to comment.