-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from fperera123/feature/overlay-mode
Introduce window modes with overlay and transparent overlay
- Loading branch information
Showing
12 changed files
with
397 additions
and
99 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { app } from 'electron'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
export class WindowModeManager { | ||
|
||
private filePath: string; | ||
|
||
constructor(private windowName: string) { | ||
const userDataPath = app.getPath('userData'); | ||
this.filePath = path.join(userDataPath, `${windowName}-window-mode.json`); | ||
console.log('filePath', this.filePath); | ||
} | ||
|
||
getWindowMode(): 'overlay' | 'windowed' | 'overlayTransparent' { | ||
try { | ||
const data = fs.readFileSync(this.filePath, 'utf8'); | ||
const parsed = JSON.parse(data); | ||
return parsed.windowMode; | ||
} catch (error) { | ||
return 'windowed'; | ||
} | ||
} | ||
|
||
setWindowMode(mode: 'overlay' | 'windowed') { | ||
const data = JSON.stringify({ windowMode: mode }, null, 2); | ||
console.log('setWindowMode', this.filePath, data, mode); | ||
fs.writeFileSync(this.filePath, data); | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.