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
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Commit the changes once you are happy with them.
When you're finished with the changes, push them to your fork and create a pull request. Make sure you fill the pull request template.

### Test plugin
*Not a developer* but still want to help? You can help with testing. Either you test the current version for possible problems or, if there are currently any, you can also test [pre-releases (alpha/beta)](https://github.com/4Source/settings-profiles-obsidian-plugin/releases). You need to install the version you wanna test in a vault. It is not recommendet to test in your acctual vault create a copy of it or create new one for testing. If you found a bug or unexpected behavior create an [issue](https://github.com/4Source/SettingsProfiles-Obsidian-Plugin/issues) with the version you have tested. Before creating an issue, make sure you know how to reproduce the bug. If there is already an issue for the bug you found that is still open but you have additional information, add it to the issue.
*Not a developer* but still want to help? You can help with testing. Either you test the current version for possible problems or, if there are currently any, you can also test [pre-releases (alpha/beta)](https://github.com/4Source/settings-profiles-obsidian-plugin/releases). You need to install the version you wanna test in a vault. It is not recommendet to test in your acctual vault create a copy of it or create new one for testing. If you found a bug or unexpected behavior create an [issue](https://github.com/4Source/settings-profiles-obsidian-plugin/issues) with the version you have tested. Before creating an issue, make sure you know how to reproduce the bug. If there is already an issue for the bug you found that is still open but you have additional information, add it to the issue.
> [!TIP]
> Install the [VARE](https://obsidian.md/plugins?id=vare) plugin to easily switch versions while testing.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,16 @@ To switch to other settings profile or create a new one.
Displays the current settings profile.
## Settings profiles: Save current profile
Save the settings of current profile.
## Settings profiles: Save current profile partially
Save only a part of the settings to the current profile. Lets you select the options you would like to save.
## Settings profiles: Save to profile partially
Save only a part of the settings to a selected profile. Lets you select the options you would like to save.
## Settings profiles: Save to profile
Save the current settings to a selected profile. This will override the settings in the profile.
## Settings profiles: Reload current profile
Load the settings of current profile from files.
## Settings profiles: Load from profile partially
Load settings from a selected profile to the current, it could be the same ore different profile than current.
## Settings profiles: Update profile status
Updates the UI elements.

Expand All @@ -119,7 +127,7 @@ You can create an [issue](https://github.com/4Source/SettingsProfiles-Obsidian-P

Or instead create a [pull request](https://github.com/4Source/SettingsProfiles-Obsidian-Plugin/pulls) to contribute a bug fix or improvement for this plugin.

*Not a developer* but still want to help? You can help with testing. Either you test the current version for possible problems or, if there are currently any, you can also test [pre-releases (alpha/beta)](https://github.com/4Source/settings-profiles-obsidian-plugin/releases). This can be easily accomplished if you install [VARE](https://obsidian.md/plugins?id=vare). Any version of this plugin must be installed. Then simply go to VARE's Settings tab and select the version you want to test from the drop-down menu. You could also add this plugin manually just ![plus](https://github.com/4Source/settings-profiles-obsidian-plugin/assets/38220764/663a0bd6-53f9-4da3-b0ab-33e30eae3029)``Add unlisted plugin`` and enter ``4Source`` and ``settings-profiles-obsidian-plugin``. If you found a bug or unexpected behavior create an [issue](https://github.com/4Source/SettingsProfiles-Obsidian-Plugin/issues) with the version you have tested. Before creating an issue, make sure you know how to reproduce the bug. If there is already an issue for the bug you found that is still open but you have additional information, add it to the issue.
*Not a developer* but still want to help? You can help with testing. Either you test the current version for possible problems or, if there are currently any, you can also test [pre-releases (alpha/beta)](https://github.com/4Source/settings-profiles-obsidian-plugin/releases). This can be easily accomplished if you install [VARE](https://obsidian.md/plugins?id=vare). Any version of this plugin must be installed. Then simply go to VARE's Settings tab and select the version you want to test from the drop-down menu. You could also add this plugin manually just ![plus](https://github.com/4Source/settings-profiles-obsidian-plugin/assets/38220764/663a0bd6-53f9-4da3-b0ab-33e30eae3029)``Add unlisted plugin`` and enter ``4Source`` and ``settings-profiles-obsidian-plugin``. If you found a bug or unexpected behavior create an [issue](https://github.com/4Source/settings-profiles-obsidian-plugin/issues) with the version you have tested. Before creating an issue, make sure you know how to reproduce the bug. If there is already an issue for the bug you found that is still open but you have additional information, add it to the issue.

For more info see [CONTRIBUTING](https://github.com/4Source/settings-profiles-obsidian-plugin/blob/master/.github/CONTRIBUTING.md)

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "settings-profiles",
"name": "Settings profiles",
"version": "0.5.9",
"version": "0.5.10-beta.3",
"minAppVersion": "0.15.0",
"description": "Allows you to create various global settings profiles. You can sync them between different vaults. To keep all your settings in sync, you'll never have to manually adjust them again for every vault you have or create in the future.",
"author": "4Source",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "settings-profiles-obsidian-plugin",
"version": "0.5.9",
"version": "0.5.10-beta.3",
"description": "This plugin is for global setting profiles in Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {
Expand Down
141 changes: 141 additions & 0 deletions src/Commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import { Command, Notice } from "obsidian";
import SettingsProfilesPlugin from "./main";
import { ProfileSwitcherModal } from "./modals/ProfileSwitcherModal";
import { ProfileOptionsFuzzySuggestModal } from "./modals/ProfileOptionsFuzzySuggestModal";
import { DEFAULT_PROFILE_SETTINGS, NONE_PROFILE_OPTIONS, ProfileOptions, ProfileSettings } from "./settings/SettingsInterface";
import { ProfileSuggestModal } from "./modals/ProfileSuggestModal";
import { ProfileSaveDialogModal } from "./modals/ProfileSaveDialogModal";
import { ReloadDialogModal } from "./modals/ReloadDialogModal";

export function registerCommands(plugin: SettingsProfilesPlugin) {
const commands: Command[] = [
{
id: "open-profile-switcher",
name: "Open profile switcher",
callback: () => {
// Open new profile switcher modal to switch or create a new profile
new ProfileSwitcherModal(plugin.app, plugin).open();
}
},
{
id: "current-profile",
name: "Show current profile",
callback: () => {
new Notice(`Current profile: ${plugin.getCurrentProfile()?.name}`);
}
},
{
id: "save-current-profile",
name: "Save current profile",
callback: () => {
plugin.refreshProfilesList();
const profile = plugin.getCurrentProfile();
if (profile) {
new ProfileSaveDialogModal(plugin, profile).open();
}
}
},
{
id: "save-current-profile-partially",
name: "Save current profile partially",
callback: () => {
plugin.refreshProfilesList();
const profile: ProfileSettings = { ...DEFAULT_PROFILE_SETTINGS, ...plugin.getCurrentProfile(), ...NONE_PROFILE_OPTIONS };
if (profile) {
new ProfileOptionsFuzzySuggestModal(plugin.app, "Select which option to save...", (result: (keyof ProfileOptions)[]) => {
result.forEach(key => {
(profile[key as keyof ProfileSettings] as boolean) = true;
});
new ProfileSaveDialogModal(plugin, profile).open();
}).open();
}
}
},
{
id: "save-to-profile-partially",
name: "Save to profile partially",
callback: () => {
new ProfileSuggestModal(plugin, "Select profile to save to...", (result: ProfileSettings) => {
const profile: ProfileSettings = { ...DEFAULT_PROFILE_SETTINGS, ...result, ...NONE_PROFILE_OPTIONS };
profile.name = plugin.getCurrentProfile()?.name || "";
if (profile) {
new ProfileOptionsFuzzySuggestModal(plugin.app, "Select which option to save...", (result: (keyof ProfileOptions)[]) => {
result.forEach(key => {
(profile[key as keyof ProfileSettings] as boolean) = true;
});
new ProfileSaveDialogModal(plugin, profile).open();
}).open();
}
}).open();
}
},
{
id: "save-to-profile",
name: "Save to profile",
callback: () => {
new ProfileSuggestModal(plugin, "Select profile to save to...", (result: ProfileSettings) => {
const profile: ProfileSettings = plugin.getProfile(result.name);
if (profile) {
new ProfileSaveDialogModal(plugin, profile).open();
}
}).open();
}
},
{
id: "reload-current-profile",
name: "Reload current profile",
callback: () => {
plugin.refreshProfilesList();
const profile = plugin.getCurrentProfile();
if (profile) {
plugin.loadProfileSettings(profile)
.then((profile) => {
plugin.updateCurrentProfile(profile);
// Reload obsidian so changed settings can take effect
new ReloadDialogModal(plugin, {
onSubmit: async () => {
// Save Settings
await plugin.saveSettings();
},
}).open();
});

}
}
},
{
id: "load-from-profile-partially",
name: "Load from profile partially",
callback: () => {
new ProfileSuggestModal(plugin, "Select the profile to load from...", (result: ProfileSettings) => {
const profile: ProfileSettings = { ...DEFAULT_PROFILE_SETTINGS, ...result, ...NONE_PROFILE_OPTIONS };
if (profile) {
new ProfileOptionsFuzzySuggestModal(plugin.app, "Select which option to load...", (result: (keyof ProfileOptions)[]) => {
plugin.loadPartiallyProfileSettings(profile, result)
.then((profile) => {
// Reload obsidian so changed settings can take effect
new ReloadDialogModal(plugin, {
onSubmit: async () => {
// Save Settings
await plugin.saveSettings();
},
}).open();
});
}).open();
}
}).open();
}
},
{
id: "update-profile-status",
name: "Update profile status",
callback: () => {
plugin.updateUI();
}
}
];

commands.forEach(command => {
plugin.addCommand(command);
});
}
6 changes: 6 additions & 0 deletions src/Icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addIcon } from "obsidian";

export function registerCustomIcons() {
// Filled Lucide's icons
addIcon('crown-filled', `<path fill="currentColor" stroke="currentColor" stroke-width="8.33331966" stroke-linecap="round" stroke-linejoin="round" d="m8.333 16.666 12.5 50h58.334l12.5-50-25 29.167L50 16.666 33.333 45.833Zm12.5 66.667h58.334" style="stroke-width:8.33331966"/>`)
}
4 changes: 3 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export const ICON_RESET = 'lucide-rotate-ccw';
export const ICON_ADD_PROFILE = 'plus';
export const ICON_RELOAD_PROFILES = 'refresh-cw';

export const ICON_PROFILE_OPTIONS = 'settings';
export const ICON_PROFILE_SETTINGS = 'settings';
export const ICON_PROFILE_REMOVE = 'trash-2';
export const ICON_PROFILE_ADD_HOTKEY = 'plus-circle';
export const ICON_PROFILE_SAVE = 'save';
export const ICON_PROFILE_LOAD = 'download';
export const ICON_PROFILE_DEFAULT = 'crown';
export const ICON_PROFILE_DEFAULT_SELECTED = 'crown-filled';

export const ICON_CURRENT_PROFILE = 'user-check';
export const ICON_PROFILE = 'user';
Expand Down
Loading