Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions src/AetherApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const AetherApplication = GObject.registerClass(
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
});
this._wallpaperPath = null;
this._ohmydebnMode = false;

// Ensure ~/Wallpapers directory exists
const wallpapersDir = GLib.build_filenamev([
Expand Down Expand Up @@ -184,6 +185,15 @@ export const AetherApplication = GObject.registerClass(
'Output directory for generated theme files (use with --generate --no-apply)',
'PATH'
);

this.add_main_option(
'ohmydebn',
0,
GLib.OptionFlags.NONE,
GLib.OptionArg.NONE,
'Enable OhMyDebn-specific behavior (start on Themes tab)',
null
);
}

/**
Expand All @@ -195,6 +205,9 @@ export const AetherApplication = GObject.registerClass(
vfunc_command_line(commandLine) {
const options = commandLine.get_options_dict();

// Handle --ohmydebn flag
this._ohmydebnMode = options.contains('ohmydebn');

// Run migrations before any command execution
runMigrations();

Expand Down Expand Up @@ -429,7 +442,7 @@ export const AetherApplication = GObject.registerClass(
_launchWidget() {
// Initialize theme manager for consistent styling
if (!themeManager) {
themeManager = new ThemeManager();
themeManager = new ThemeManager(this._ohmydebnMode);
}
this.themeManager = themeManager;

Expand Down Expand Up @@ -516,9 +529,8 @@ export const AetherApplication = GObject.registerClass(
*/
async _downloadWallpaperForBlueprint(url) {
try {
const {ensureDirectoryExists} = await import(
'./utils/file-utils.js'
);
const {ensureDirectoryExists} =
await import('./utils/file-utils.js');
const Soup = (await import('gi://Soup?version=3.0')).default;

const wallpapersDir = GLib.build_filenamev([
Expand Down Expand Up @@ -624,11 +636,13 @@ export const AetherApplication = GObject.registerClass(

// Initialize theme manager only when GUI is activated
if (!themeManager) {
themeManager = new ThemeManager();
console.log(`Base theme: ${themeManager.getThemePath()}`);
console.log(
`Override theme: ${themeManager.getOverridePath()} (edit this file)`
);
themeManager = new ThemeManager(this._ohmydebnMode);
if (!this._ohmydebnMode) {
console.log(`Base theme: ${themeManager.getThemePath()}`);
console.log(
`Override theme: ${themeManager.getOverridePath()} (edit this file)`
);
}
}
this.themeManager = themeManager;

Expand Down
25 changes: 20 additions & 5 deletions src/AetherWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ export const AetherWindow = GObject.registerClass(
default_height: 700,
});

this._ohmydebnMode = application._ohmydebnMode || false;
this.configWriter = new ConfigWriter();
this._initializeUI();
this._connectSignals();
this._connectThemeState();

// Set initial tab based on OhMyDebn mode
if (this._ohmydebnMode) {
this._viewStack.set_visible_child_name('blueprints');
}
}

/**
Expand Down Expand Up @@ -346,7 +350,7 @@ export const AetherWindow = GObject.registerClass(
);

// Blueprints page
this._blueprintsView = new BlueprintsView();
this._blueprintsView = new BlueprintsView(this._ohmydebnMode);
this._blueprintsView.connect(
'blueprint-applied',
(_, blueprint) => {
Expand All @@ -362,6 +366,11 @@ export const AetherWindow = GObject.registerClass(
this._importOmarchyTheme(theme);
});
this._blueprintsView.connect('theme-applied', (_, theme) => {
// Reload OhMyDebn theme if in OhMyDebn mode
if (this._ohmydebnMode && this.application.themeManager) {
this.application.themeManager.reloadOhMyDebnTheme();
}

const toast = new Adw.Toast({
title: `Applied theme: ${theme.name}`,
timeout: 3,
Expand Down Expand Up @@ -404,8 +413,9 @@ export const AetherWindow = GObject.registerClass(
* @param {Object} [metadata] - Optional wallpaper metadata
*/
_onBrowserWallpaperSelected(path, metadata = null) {
// Switch to editor tab
this._viewStack.set_visible_child_name('editor');
// Switch to editor tab (or themes tab in OhMyDebn mode)
const defaultTab = this._ohmydebnMode ? 'blueprints' : 'editor';
this._viewStack.set_visible_child_name(defaultTab);

// Reset adjustments and app overrides when changing wallpaper
this.settingsSidebar.resetAdjustments();
Expand Down Expand Up @@ -743,6 +753,11 @@ export const AetherWindow = GObject.registerClass(
});

if (result.success) {
// Reload OhMyDebn theme if in OhMyDebn mode
if (this._ohmydebnMode && this.application.themeManager) {
this.application.themeManager.reloadOhMyDebnTheme();
}

const message = result.isOmarchy
? 'Theme applied successfully'
: `Theme created at ${result.themePath}`;
Expand Down
20 changes: 16 additions & 4 deletions src/components/BlueprintsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ export const BlueprintsView = GObject.registerClass(
},
},
class BlueprintsView extends Gtk.Box {
_init() {
_init(ohmydebnMode = false) {
super._init({
orientation: Gtk.Orientation.VERTICAL,
spacing: 0,
});

this._ohmydebnMode = ohmydebnMode;
this._blueprints = [];
this._blueprintsDir = GLib.build_filenamev([
GLib.get_user_config_dir(),
Expand Down Expand Up @@ -96,7 +97,7 @@ export const BlueprintsView = GObject.registerClass(
active: true,
});
this._themesToggle = new Gtk.ToggleButton({
label: 'Omarchy Themes',
label: this._ohmydebnMode ? 'System Themes' : 'Omarchy Themes',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, let us rename it to System Themes, does not have to be named "Omarchy Themes"

active: false,
});

Expand Down Expand Up @@ -145,7 +146,7 @@ export const BlueprintsView = GObject.registerClass(
this._contentStack.add_named(blueprintsContent, 'blueprints');

// Omarchy themes browser
this._omarchyBrowser = new OmarchyThemesBrowser();
this._omarchyBrowser = new OmarchyThemesBrowser(this._ohmydebnMode);
this._omarchyBrowser.connect('theme-imported', (_, theme) => {
this.emit('theme-imported', theme);
});
Expand All @@ -154,7 +155,18 @@ export const BlueprintsView = GObject.registerClass(
});
this._contentStack.add_named(this._omarchyBrowser, 'themes');

this._contentStack.set_visible_child_name('blueprints');
const initialView = this._ohmydebnMode ? 'themes' : 'blueprints';
this._contentStack.set_visible_child_name(initialView);

// Set toggle button state to match initial view
if (this._ohmydebnMode) {
this._themesToggle.set_active(true);
this._blueprintsToggle.set_active(false);
} else {
this._blueprintsToggle.set_active(true);
this._themesToggle.set_active(false);
}

this.append(this._contentStack);
}

Expand Down
Loading