mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	Add transparency to linux (#618)
Co-authored-by: smartfridge <37928912+smartfrigde@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									d9d24d9473
								
							
						
					
					
						commit
						69c34435f2
					
				
					 4 changed files with 31 additions and 3 deletions
				
			
		|  | @ -15,7 +15,7 @@ | ||||||
|     "settings-theme-desc1": "ArmCord \"themes\" manage apps behaviour and looks.", |     "settings-theme-desc1": "ArmCord \"themes\" manage apps behaviour and looks.", | ||||||
|     "settings-theme-desc2": "this is how ArmCord looks when you first launch it. It includes recreation of Discord's\n                custom titlebar and ArmCord specific styles injected into Discord.", |     "settings-theme-desc2": "this is how ArmCord looks when you first launch it. It includes recreation of Discord's\n                custom titlebar and ArmCord specific styles injected into Discord.", | ||||||
|     "settings-theme-desc3": "uses native titlebar of OS you're currently running (e.g Windows 7/10). Functions more\n                similar to actual Discord app on Linux.", |     "settings-theme-desc3": "uses native titlebar of OS you're currently running (e.g Windows 7/10). Functions more\n                similar to actual Discord app on Linux.", | ||||||
|     "settings-theme-desc4": "transparent window with native titlebar, you need a compatible theme to run this. Windows only.", |     "settings-theme-desc4": "transparent window with native titlebar, you need a compatible theme to run this.", | ||||||
|     "settings-theme-default": "Default", |     "settings-theme-default": "Default", | ||||||
|     "settings-theme-native": "Native", |     "settings-theme-native": "Native", | ||||||
|     "settings-theme-transparent": "Transparent", |     "settings-theme-transparent": "Transparent", | ||||||
|  |  | ||||||
|  | @ -361,6 +361,7 @@ export function createTransparentWindow(): void { | ||||||
|         icon: iconPath, |         icon: iconPath, | ||||||
|         frame: true, |         frame: true, | ||||||
|         backgroundColor: "#00000000", |         backgroundColor: "#00000000", | ||||||
|  |         transparent: true, | ||||||
|         show: false, |         show: false, | ||||||
|         autoHideMenuBar: true, |         autoHideMenuBar: true, | ||||||
|         webPreferences: { |         webPreferences: { | ||||||
|  |  | ||||||
							
								
								
									
										29
									
								
								src/main.ts
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								src/main.ts
									
										
									
									
									
								
							|  | @ -101,6 +101,7 @@ if (!app.requestSingleInstanceLock()) { | ||||||
|         "disable-features", |         "disable-features", | ||||||
|         "WinRetrieveSuggestionsOnlyOnDemand,HardwareMediaKeyHandling,MediaSessionService" |         "WinRetrieveSuggestionsOnlyOnDemand,HardwareMediaKeyHandling,MediaSessionService" | ||||||
|     ); |     ); | ||||||
|  |     app.commandLine.appendSwitch("enable-transparent-visuals"); | ||||||
|     checkForDataFolder(); |     checkForDataFolder(); | ||||||
|     checkIfConfigExists(); |     checkIfConfigExists(); | ||||||
|     checkIfConfigIsBroken(); |     checkIfConfigIsBroken(); | ||||||
|  | @ -113,7 +114,33 @@ if (!app.requestSingleInstanceLock()) { | ||||||
|         } else { |         } else { | ||||||
|             iconPath = path.join(import.meta.dirname, "../", "/assets/desktop.png"); |             iconPath = path.join(import.meta.dirname, "../", "/assets/desktop.png"); | ||||||
|         } |         } | ||||||
|         await init(); |         async function init(): Promise<void> { | ||||||
|  |             if (getConfig("skipSplash") == false) { | ||||||
|  |                 void createSplashWindow(); // REVIEW - Awaiting will hang at start
 | ||||||
|  |             } | ||||||
|  |             if (firstRun == true) { | ||||||
|  |                 setLang(new Intl.DateTimeFormat().resolvedOptions().locale); | ||||||
|  |                 await createSetupWindow(); | ||||||
|  |             } | ||||||
|  |             switch (getConfig("windowStyle")) { | ||||||
|  |                 case "default": | ||||||
|  |                     createCustomWindow(); | ||||||
|  |                     customTitlebar = true; | ||||||
|  |                     break; | ||||||
|  |                 case "native": | ||||||
|  |                     createNativeWindow(); | ||||||
|  |                     break; | ||||||
|  |                 case "transparent": | ||||||
|  |                     createTransparentWindow(); | ||||||
|  |                     break; | ||||||
|  |                 default: | ||||||
|  |                     createCustomWindow(); | ||||||
|  |                     customTitlebar = true; | ||||||
|  |                     break; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Patch for linux bug to insure things are loaded before window creation (fixes transparency on some linux systems)
 | ||||||
|  |         await new Promise<void>((resolve) => setTimeout(() => (init(), resolve()), 1500)); | ||||||
|         await installModLoader(); |         await installModLoader(); | ||||||
|         session.fromPartition("some-partition").setPermissionRequestHandler((_webContents, permission, callback) => { |         session.fromPartition("some-partition").setPermissionRequestHandler((_webContents, permission, callback) => { | ||||||
|             if (permission === "notifications") { |             if (permission === "notifications") { | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
|                 <option value="" disabled selected hidden data-string="settings-theme"></option> |                 <option value="" disabled selected hidden data-string="settings-theme"></option> | ||||||
|                 <option value="default" data-string="settings-theme-default"></option> |                 <option value="default" data-string="settings-theme-default"></option> | ||||||
|                 <option value="native" data-string="settings-theme-native"></option> |                 <option value="native" data-string="settings-theme-native"></option> | ||||||
|                 <option value="transparent" windows-exclusive data-string="settings-theme-transparent"></option> |                 <option value="transparent" data-string="settings-theme-transparent"></option> | ||||||
|             </select> |             </select> | ||||||
| 
 | 
 | ||||||
|             <p class="header" data-string="settings-theme"></p> |             <p class="header" data-string="settings-theme"></p> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue