@@ -255,14 +255,21 @@ export const AetherApplication = GObject.registerClass(
255255 if ( ! options . contains ( 'generate' ) ) return false ;
256256
257257 const wallpaperPath = this . _getStringOption ( options , 'generate' ) ;
258- const extractionMode = this . _getStringOption ( options , 'extract-mode' ) || 'normal' ;
258+ const extractionMode =
259+ this . _getStringOption ( options , 'extract-mode' ) || 'normal' ;
259260 const lightMode = options . contains ( 'light-mode' ) ;
260261 // GLib normalizes hyphens to underscores in option names
261- const noApply = options . contains ( 'no-apply' ) || options . contains ( 'no_apply' ) ;
262+ const noApply =
263+ options . contains ( 'no-apply' ) || options . contains ( 'no_apply' ) ;
262264 const outputPath = this . _getStringOption ( options , 'output' ) ;
263265
264266 this . _runAsyncCommand (
265- GenerateThemeCommand . execute ( wallpaperPath , extractionMode , lightMode , { noApply, outputPath} )
267+ GenerateThemeCommand . execute (
268+ wallpaperPath ,
269+ extractionMode ,
270+ lightMode ,
271+ { noApply, outputPath}
272+ )
266273 ) ;
267274
268275 return true ;
@@ -282,12 +289,14 @@ export const AetherApplication = GObject.registerClass(
282289 const autoApply = options . contains ( 'auto-apply' ) ;
283290
284291 this . _runAsyncCommand (
285- ImportBlueprintCommand . execute ( source , autoApply ) . then ( async success => {
286- if ( success ) {
287- await this . _updateGuiAfterImport ( ) ;
292+ ImportBlueprintCommand . execute ( source , autoApply ) . then (
293+ async success => {
294+ if ( success ) {
295+ await this . _updateGuiAfterImport ( ) ;
296+ }
297+ return success ;
288298 }
289- return success ;
290- } )
299+ )
291300 ) ;
292301
293302 return true ;
@@ -307,7 +316,10 @@ export const AetherApplication = GObject.registerClass(
307316 const lightMode = options . contains ( 'light-mode' ) ;
308317
309318 this . _runAsyncCommand (
310- ImportBase16Command . execute ( filePath , { wallpaperPath, lightMode} )
319+ ImportBase16Command . execute ( filePath , {
320+ wallpaperPath,
321+ lightMode,
322+ } )
311323 ) ;
312324
313325 return true ;
@@ -322,12 +334,18 @@ export const AetherApplication = GObject.registerClass(
322334 _handleImportColorsToml ( options ) {
323335 if ( ! options . contains ( 'import-colors-toml' ) ) return false ;
324336
325- const filePath = this . _getStringOption ( options , 'import-colors-toml' ) ;
337+ const filePath = this . _getStringOption (
338+ options ,
339+ 'import-colors-toml'
340+ ) ;
326341 const wallpaperPath = this . _getStringOption ( options , 'wallpaper' ) ;
327342 const lightMode = options . contains ( 'light-mode' ) ;
328343
329344 this . _runAsyncCommand (
330- ImportColorsTomlCommand . execute ( filePath , { wallpaperPath, lightMode} )
345+ ImportColorsTomlCommand . execute ( filePath , {
346+ wallpaperPath,
347+ lightMode,
348+ } )
331349 ) ;
332350
333351 return true ;
@@ -452,10 +470,14 @@ export const AetherApplication = GObject.registerClass(
452470 const blueprint = allBlueprints [ 0 ] ;
453471
454472 // Handle wallpaper URL - download if not already local
455- if ( blueprint . palette ?. wallpaperUrl && ! blueprint . palette ?. wallpaper ) {
456- const wallpaperPath = await this . _downloadWallpaperForBlueprint (
457- blueprint . palette . wallpaperUrl
458- ) ;
473+ if (
474+ blueprint . palette ?. wallpaperUrl &&
475+ ! blueprint . palette ?. wallpaper
476+ ) {
477+ const wallpaperPath =
478+ await this . _downloadWallpaperForBlueprint (
479+ blueprint . palette . wallpaperUrl
480+ ) ;
459481 if ( wallpaperPath ) {
460482 blueprint . palette . wallpaper = wallpaperPath ;
461483 }
@@ -494,7 +516,9 @@ export const AetherApplication = GObject.registerClass(
494516 */
495517 async _downloadWallpaperForBlueprint ( url ) {
496518 try {
497- const { ensureDirectoryExists} = await import ( './utils/file-utils.js' ) ;
519+ const { ensureDirectoryExists} = await import (
520+ './utils/file-utils.js'
521+ ) ;
498522 const Soup = ( await import ( 'gi://Soup?version=3.0' ) ) . default ;
499523
500524 const wallpapersDir = GLib . build_filenamev ( [
@@ -506,8 +530,12 @@ export const AetherApplication = GObject.registerClass(
506530
507531 // Extract filename from URL
508532 const urlParts = url . split ( '/' ) ;
509- const filename = urlParts [ urlParts . length - 1 ] || 'imported-wallpaper.jpg' ;
510- const wallpaperPath = GLib . build_filenamev ( [ wallpapersDir , filename ] ) ;
533+ const filename =
534+ urlParts [ urlParts . length - 1 ] || 'imported-wallpaper.jpg' ;
535+ const wallpaperPath = GLib . build_filenamev ( [
536+ wallpapersDir ,
537+ filename ,
538+ ] ) ;
511539
512540 // Check if already downloaded
513541 if ( GLib . file_test ( wallpaperPath , GLib . FileTest . EXISTS ) ) {
@@ -532,32 +560,47 @@ export const AetherApplication = GObject.registerClass(
532560 null ,
533561 ( session , result ) => {
534562 try {
535- const bytes = session . send_and_read_finish ( result ) ;
563+ const bytes =
564+ session . send_and_read_finish ( result ) ;
536565 const status = message . get_status ( ) ;
537566
538567 if ( status !== 200 ) {
539- console . error ( `Failed to download wallpaper: HTTP ${ status } ` ) ;
568+ console . error (
569+ `Failed to download wallpaper: HTTP ${ status } `
570+ ) ;
540571 resolve ( null ) ;
541572 return ;
542573 }
543574
544575 const data = bytes . get_data ( ) ;
545576 if ( ! data || data . length === 0 ) {
546- console . error ( 'Empty response when downloading wallpaper' ) ;
577+ console . error (
578+ 'Empty response when downloading wallpaper'
579+ ) ;
547580 resolve ( null ) ;
548581 return ;
549582 }
550583
551584 // Write to file
552- const file = Gio . File . new_for_path ( wallpaperPath ) ;
553- const stream = file . replace ( null , false , Gio . FileCreateFlags . NONE , null ) ;
585+ const file =
586+ Gio . File . new_for_path ( wallpaperPath ) ;
587+ const stream = file . replace (
588+ null ,
589+ false ,
590+ Gio . FileCreateFlags . NONE ,
591+ null
592+ ) ;
554593 stream . write_bytes ( bytes , null ) ;
555594 stream . close ( null ) ;
556595
557- console . log ( `Wallpaper saved to: ${ wallpaperPath } ` ) ;
596+ console . log (
597+ `Wallpaper saved to: ${ wallpaperPath } `
598+ ) ;
558599 resolve ( wallpaperPath ) ;
559600 } catch ( error ) {
560- console . error ( `Error saving wallpaper: ${ error . message } ` ) ;
601+ console . error (
602+ `Error saving wallpaper: ${ error . message } `
603+ ) ;
561604 resolve ( null ) ;
562605 }
563606 }
0 commit comments