-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(transparent-player): Added Linux and macOS support #4199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JellyBrick
merged 8 commits into
pear-devs:master
from
its-iris:upstream-feat-transparent-player
Jun 25, 2026
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
af261bc
feat(transparent-player): Added Linux and macOS support
23d7ba6
style(transparent-player): Implemented prettier rule
1686de5
refactor: Removed backgroundMaterial from defaultConfig
bc006a0
refactor(transparent-player): Added value checks and translation keys
5264f63
Merge branch 'master' into upstream-feat-transparent-player
JellyBrick 801f029
feat(backend): refactor window management and transparency handling
JellyBrick 8bec93e
feat(backend): enhance type imports for transparent player configuration
JellyBrick bf8fd40
feat(menu): improve type imports and enhance material type handling
JellyBrick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,49 @@ | ||
| import is from 'electron-is'; | ||
|
|
||
| import { MaterialType } from './types'; | ||
|
|
||
| import type { BrowserWindow } from 'electron'; | ||
| import type { BackendContext } from '@/types/contexts'; | ||
| import type { TransparentPlayerConfig } from './types'; | ||
|
|
||
| let mainWindow: BrowserWindow | null = null; | ||
|
This conversation was marked as resolved.
Outdated
|
||
|
|
||
| const setWindowMaterial = (window: BrowserWindow, type: MaterialType) => { | ||
| if (type === MaterialType.NONE) { | ||
| if (is.windows()) window.setBackgroundMaterial?.('none'); | ||
| else if (is.macOS()) window.setVibrancy?.(null); | ||
| return; | ||
| } | ||
|
|
||
| if (is.windows()) { | ||
| window.setBackgroundMaterial?.( | ||
| type as Parameters<BrowserWindow['setBackgroundMaterial']>[0], | ||
| ); | ||
| } else if (is.macOS()) { | ||
| window.setVibrancy?.(type as Parameters<BrowserWindow['setVibrancy']>[0]); | ||
| } | ||
|
This conversation was marked as resolved.
|
||
| }; | ||
|
This conversation was marked as resolved.
Outdated
|
||
|
|
||
| export const onMainLoad = async ({ | ||
| window, | ||
| getConfig, | ||
| }: BackendContext<TransparentPlayerConfig>) => { | ||
| mainWindow = window; | ||
| const config = await getConfig(); | ||
|
|
||
| setWindowMaterial(window, config.type); | ||
| window.setBackgroundColor?.(`rgba(0, 0, 0, ${config.opacity})`); | ||
| }; | ||
|
|
||
| export const onConfigChange = (newConfig: TransparentPlayerConfig) => { | ||
| if (mainWindow) { | ||
| setWindowMaterial(mainWindow, newConfig.type); | ||
| mainWindow.setBackgroundColor?.(`rgba(0, 0, 0, ${newConfig.opacity})`); | ||
| } | ||
| }; | ||
|
|
||
| export const onMainStop = ({ | ||
| window, | ||
| }: BackendContext<TransparentPlayerConfig>) => { | ||
| setWindowMaterial(window, MaterialType.NONE); | ||
|
This conversation was marked as resolved.
Outdated
|
||
| }; | ||
This file contains hidden or 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 hidden or 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,62 @@ | ||
| import is from 'electron-is'; | ||
|
|
||
| import { t } from '@/i18n'; | ||
|
|
||
| import { MaterialType } from './types'; | ||
|
|
||
| import type { MenuContext } from '@/types/contexts'; | ||
| import type { MenuTemplate } from '@/menu'; | ||
| import type { TransparentPlayerConfig } from './types'; | ||
|
|
||
| const opacityList = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]; | ||
|
|
||
| export const onMenu = async ({ | ||
| getConfig, | ||
| setConfig, | ||
| }: MenuContext<TransparentPlayerConfig>): Promise<MenuTemplate> => { | ||
| const config = await getConfig(); | ||
| const typeList = is.windows() | ||
| ? [ | ||
| MaterialType.MICA, | ||
| MaterialType.ACRYLIC, | ||
| MaterialType.TABBED, | ||
| MaterialType.NONE, | ||
| ] | ||
| : is.macOS() | ||
| ? [ | ||
| MaterialType.WINDOW, | ||
| MaterialType.FULLSCREEN_UI, | ||
| MaterialType.CONTENT, | ||
| MaterialType.UNDER_WINDOW, | ||
| MaterialType.UNDER_PAGE, | ||
| MaterialType.NONE, | ||
| ] | ||
| : [MaterialType.NONE]; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| return [ | ||
| { | ||
| label: t('plugins.transparent-player.menu.opacity.label'), | ||
| submenu: opacityList.map((opacity) => ({ | ||
| label: t('plugins.transparent-player.menu.opacity.submenu.percent', { | ||
| opacity: opacity * 100, | ||
| }), | ||
| type: 'radio', | ||
| checked: config.opacity === opacity, | ||
| click() { | ||
| setConfig({ opacity }); | ||
| }, | ||
| })), | ||
| }, | ||
| { | ||
| label: t('plugins.transparent-player.menu.type.label'), | ||
| submenu: typeList.map((type) => ({ | ||
| label: t(`plugins.transparent-player.menu.type.submenu.${type}`), | ||
|
This conversation was marked as resolved.
|
||
| type: 'radio', | ||
| checked: config.type === type, | ||
| click() { | ||
| setConfig({ type }); | ||
| }, | ||
| })), | ||
| }, | ||
| ]; | ||
| }; | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.