Skip to content

Commit f6bfcdb

Browse files
committed
Format
1 parent 6707e92 commit f6bfcdb

7 files changed

Lines changed: 157 additions & 51 deletions

File tree

src/AetherApplication.js

Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/components/ColorSynthesizer.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,22 @@ export const ColorSynthesizer = GObject.registerClass(
210210
*/
211211
_createColorAssignments() {
212212
const semanticNames = [
213-
'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white',
214-
'bright_black', 'bright_red', 'bright_green', 'bright_yellow',
215-
'bright_blue', 'bright_magenta', 'bright_cyan', 'bright_white',
213+
'black',
214+
'red',
215+
'green',
216+
'yellow',
217+
'blue',
218+
'magenta',
219+
'cyan',
220+
'white',
221+
'bright_black',
222+
'bright_red',
223+
'bright_green',
224+
'bright_yellow',
225+
'bright_blue',
226+
'bright_magenta',
227+
'bright_cyan',
228+
'bright_white',
216229
];
217230

218231
const assignments = {

src/components/ThemeActionBar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ export const ThemeActionBar = GObject.registerClass(
152152
'document-save-symbolic',
153153
'Export Omarchy Theme'
154154
);
155-
exportBtn.set_tooltip_text('Export as a shareable Omarchy theme package');
155+
exportBtn.set_tooltip_text(
156+
'Export as a shareable Omarchy theme package'
157+
);
156158
exportBtn.connect('clicked', () => this.emit('export-theme'));
157159
leftGroup.append(exportBtn);
158160

src/components/ThemeEditor.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,9 @@ export const ThemeEditor = GObject.registerClass(
417417
}
418418

419419
if (palette.appOverrides) {
420-
this._appOverridesWidget.loadFromBlueprint(palette.appOverrides);
420+
this._appOverridesWidget.loadFromBlueprint(
421+
palette.appOverrides
422+
);
421423
}
422424

423425
this._colorPalette.setLockedColors(new Array(16).fill(false));
@@ -430,7 +432,9 @@ export const ThemeEditor = GObject.registerClass(
430432
*/
431433
async _loadBlueprintWallpaper(palette) {
432434
if (palette.wallpaperUrl && !palette.wallpaper) {
433-
const wallpaperPath = await this._downloadWallpaper(palette.wallpaperUrl);
435+
const wallpaperPath = await this._downloadWallpaper(
436+
palette.wallpaperUrl
437+
);
434438
if (wallpaperPath) {
435439
this.loadWallpaperWithoutExtraction(wallpaperPath);
436440
this._wallpaperMetadata = {
@@ -468,15 +472,21 @@ export const ThemeEditor = GObject.registerClass(
468472
ensureDirectoryExists(wallpapersDir);
469473

470474
const urlParts = url.split('/');
471-
const filename = urlParts[urlParts.length - 1] || 'imported-wallpaper.jpg';
472-
const wallpaperPath = GLib.build_filenamev([wallpapersDir, filename]);
475+
const filename =
476+
urlParts[urlParts.length - 1] || 'imported-wallpaper.jpg';
477+
const wallpaperPath = GLib.build_filenamev([
478+
wallpapersDir,
479+
filename,
480+
]);
473481

474482
const file = Gio.File.new_for_path(wallpaperPath);
475483
if (file.query_exists(null)) {
476484
return wallpaperPath;
477485
}
478486

479-
const {wallhavenService} = await import('../services/wallhaven-service.js');
487+
const {wallhavenService} = await import(
488+
'../services/wallhaven-service.js'
489+
);
480490
await wallhavenService.downloadWallpaper(url, wallpaperPath);
481491
return wallpaperPath;
482492
} catch (error) {
@@ -572,7 +582,9 @@ export const ThemeEditor = GObject.registerClass(
572582

573583
const filter = new Gtk.FileFilter();
574584
filter.set_name(filterConfig.name);
575-
filterConfig.patterns.forEach(pattern => filter.add_pattern(pattern));
585+
filterConfig.patterns.forEach(pattern =>
586+
filter.add_pattern(pattern)
587+
);
576588

577589
const filterList = Gio.ListStore.new(Gtk.FileFilter.$gtype);
578590
filterList.append(filter);
@@ -626,7 +638,10 @@ export const ThemeEditor = GObject.registerClass(
626638

627639
this._applyImportedPalette(result.colors);
628640

629-
if (result.extendedColors && Object.keys(result.extendedColors).length > 0) {
641+
if (
642+
result.extendedColors &&
643+
Object.keys(result.extendedColors).length > 0
644+
) {
630645
themeState.setExtendedColors(result.extendedColors);
631646
}
632647

src/components/palette-editor/ColorPaletteDisplay.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ export const ColorPaletteDisplay = GObject.registerClass(
186186
? '2px solid @accent_bg_color'
187187
: '1px solid alpha(@borders, 0.2)';
188188

189-
applyCssToWidget(swatch, `
189+
applyCssToWidget(
190+
swatch,
191+
`
190192
box {
191193
background-color: ${color};
192194
border-radius: 0;
@@ -195,7 +197,8 @@ export const ColorPaletteDisplay = GObject.registerClass(
195197
box:hover {
196198
border: 2px solid alpha(white, 0.8);
197199
}
198-
`);
200+
`
201+
);
199202
swatch.set_cursor(Gdk.Cursor.new_from_name('pointer', null));
200203
swatch._colorIndex = index;
201204
overlay.set_child(swatch);
@@ -217,7 +220,9 @@ export const ColorPaletteDisplay = GObject.registerClass(
217220
*/
218221
_createLockButton(index, isLocked) {
219222
const lockBtn = new Gtk.Button({
220-
icon_name: isLocked ? 'changes-prevent-symbolic' : 'changes-allow-symbolic',
223+
icon_name: isLocked
224+
? 'changes-prevent-symbolic'
225+
: 'changes-allow-symbolic',
221226
halign: Gtk.Align.END,
222227
valign: Gtk.Align.START,
223228
margin_top: 2,
@@ -227,15 +232,18 @@ export const ColorPaletteDisplay = GObject.registerClass(
227232
tooltip_text: isLocked ? 'Unlock color' : 'Lock color',
228233
});
229234

230-
applyCssToWidget(lockBtn, `
235+
applyCssToWidget(
236+
lockBtn,
237+
`
231238
button {
232239
background-color: alpha(@window_bg_color, 0.95);
233240
min-width: 20px;
234241
min-height: 20px;
235242
padding: 2px;
236243
border-radius: 0;
237244
}
238-
`);
245+
`
246+
);
239247

240248
lockBtn.connect('clicked', () => this._toggleLock(index));
241249
return lockBtn;
@@ -261,7 +269,9 @@ export const ColorPaletteDisplay = GObject.registerClass(
261269
});
262270
swatch.add_controller(clickGesture);
263271

264-
const rightClick = new Gtk.GestureClick({button: Gdk.BUTTON_SECONDARY});
272+
const rightClick = new Gtk.GestureClick({
273+
button: Gdk.BUTTON_SECONDARY,
274+
});
265275
rightClick.connect('pressed', () => this._copyColor(index));
266276
swatch.add_controller(rightClick);
267277
}

src/components/palette-editor/ColorPaletteSection.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ export const ColorPaletteSection = GObject.registerClass(
407407

408408
const filter = new Gtk.FileFilter();
409409
filter.set_name(filterConfig.name);
410-
filterConfig.patterns.forEach(pattern => filter.add_pattern(pattern));
410+
filterConfig.patterns.forEach(pattern =>
411+
filter.add_pattern(pattern)
412+
);
411413

412414
const filterList = Gio.ListStore.new(Gtk.FileFilter.$gtype);
413415
filterList.append(filter);
@@ -466,7 +468,10 @@ export const ColorPaletteSection = GObject.registerClass(
466468

467469
this._applyImportedPalette(result.colors);
468470

469-
if (result.extendedColors && Object.keys(result.extendedColors).length > 0) {
471+
if (
472+
result.extendedColors &&
473+
Object.keys(result.extendedColors).length > 0
474+
) {
470475
themeState.setExtendedColors(result.extendedColors);
471476
}
472477

0 commit comments

Comments
 (0)