Skip to content

Commit 219cc93

Browse files
committed
[FEAT] Enhance status bar interaction (#71) and update version to 0.7.0
1 parent 52d8754 commit 219cc93

File tree

6 files changed

+87
-58
lines changed

6 files changed

+87
-58
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,37 @@ Only visible if [Profile update](#Profile_update) enabled.
4646
**Max:** ``10000ms``
4747

4848
**Default:** ``800ms``
49+
## Statusbar Interaction
50+
This setting controls what action is triggered when clicking on the statusbar icon. You can configure different actions for regular clicks and modifier key combinations (Ctrl, Shift, Alt).
51+
52+
**Available Actions:**
53+
- **Auto** - Automatically selects the most suitable action based on the current profile state
54+
- **Load** - Always load settings from the current profile (requires Obsidian reload)
55+
- **Switch** - Open the profile switcher modal to change profiles
56+
- **Save** - Always save current settings to the active profile
57+
- **Disabled** - Deactivates the action. Falls back to regular click behavior when no other modifier actions are configured
58+
59+
### Click
60+
Controls the action for a regular click (without modifier keys).
61+
62+
**Default:** `Auto`
63+
64+
### Ctrl + Click
65+
Controls the action when clicking while holding the Ctrl key.
66+
67+
**Default:** `Disabled`
68+
69+
### Shift + Click
70+
Controls the action when clicking while holding the Shift key.
71+
72+
**Default:** `Disabled`
73+
74+
### Alt + Click
75+
Controls the action when clicking while holding the Alt key.
76+
77+
**Default:** `Disabled`
78+
79+
**Note:** Only one modifier key can be used at a time. Using a modifier key that is disabled will **not** fallback to regular click action.
4980
## Profiles ![plus](https://github.com/4Source/settings-profiles-obsidian-plugin/assets/38220764/ec66911b-69dc-436a-9860-f9cdde4b27ac) *Button*
5081
Let you create a new profile with the current settings. Pressing on it will open a new window [Profile options](#Profile-options) here you can configure the profile.
5182
## Profiles ![refresh-cw](https://github.com/4Source/settings-profiles-obsidian-plugin/assets/38220764/e3a66b68-d30d-4990-8938-20db7b5e7cdd) *Button*

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "settings-profiles",
33
"name": "Settings profiles",
4-
"version": "0.6.0",
4+
"version": "0.7.0",
55
"minAppVersion": "0.15.0",
66
"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.",
77
"author": "4Source",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "settings-profiles-obsidian-plugin",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"description": "This plugin is for global setting profiles in Obsidian (https://obsidian.md)",
55
"main": "main.js",
66
"scripts": {

src/settings/SettingsInterface.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export type Device = Record<string, string>
1414

1515
export type StatusbarClickAction = 'auto' | 'load' | 'switch' | 'save' | 'none';
1616
export const STATUSBAR_CLICK_ACTIONS: Record<StatusbarClickAction, string> = {
17-
'auto': 'Automatically selects the most suitable',
18-
'load': 'Always load from the current profile',
19-
'switch': 'Open profile switcher',
20-
'save': 'Always save to the current profile',
17+
'auto': 'Auto',
18+
'load': 'Load',
19+
'switch': 'Switch',
20+
'save': 'Save',
2121
'none': 'Disabled'
2222
};
2323

src/settings/SettingsTab.ts

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -218,57 +218,6 @@ export class SettingsProfilesSettingTab extends PluginSettingTab {
218218
})
219219
.toggleEl.setAttr('id', 'profile-update'));
220220

221-
222-
223-
new Setting(containerEl)
224-
.setHeading()
225-
.setName('Statusbar interaction')
226-
.setDesc('Change the behavior when clicked on the Status bar Icon')
227-
new Setting(containerEl)
228-
.setName('Click')
229-
.addDropdown(dropdown => dropdown
230-
.addOptions(STATUSBAR_CLICK_ACTIONS)
231-
.setValue(this.plugin.getStatusbarInteraction())
232-
.onChange(value => {
233-
const action = value as StatusbarClickAction;
234-
this.plugin.setStatusbarInteraction(action);
235-
this.display();
236-
})
237-
)
238-
new Setting(containerEl)
239-
.setName('Ctrl + Click')
240-
.addDropdown(dropdown => dropdown
241-
.addOptions(STATUSBAR_CLICK_ACTIONS)
242-
.setValue(this.plugin.getStatusbarInteraction('ctrl'))
243-
.onChange(value => {
244-
const action = value as StatusbarClickAction;
245-
this.plugin.setStatusbarInteraction(action, 'ctrl');
246-
this.display();
247-
})
248-
)
249-
new Setting(containerEl)
250-
.setName('Shift + Click')
251-
.addDropdown(dropdown => dropdown
252-
.addOptions(STATUSBAR_CLICK_ACTIONS)
253-
.setValue(this.plugin.getStatusbarInteraction('shift'))
254-
.onChange(value => {
255-
const action = value as StatusbarClickAction;
256-
this.plugin.setStatusbarInteraction(action, 'shift');
257-
this.display();
258-
})
259-
)
260-
new Setting(containerEl)
261-
.setName('Alt + Click')
262-
.addDropdown(dropdown => dropdown
263-
.addOptions(STATUSBAR_CLICK_ACTIONS)
264-
.setValue(this.plugin.getStatusbarInteraction('alt'))
265-
.onChange(value => {
266-
const action = value as StatusbarClickAction;
267-
this.plugin.setStatusbarInteraction(action, 'alt');
268-
this.display();
269-
})
270-
)
271-
272221
if (this.plugin.getProfileUpdate()) {
273222
new Setting(containerEl)
274223
.setName('Profile update delay')
@@ -328,6 +277,55 @@ export class SettingsProfilesSettingTab extends PluginSettingTab {
328277
.sliderEl.setAttr('id', 'update-delay'))
329278
}
330279

280+
new Setting(containerEl)
281+
.setHeading()
282+
.setName('Statusbar interaction')
283+
.setDesc('Change the behavior when clicked on the Status bar Icon');
284+
new Setting(containerEl)
285+
.setName('Click')
286+
.addDropdown(dropdown => dropdown
287+
.addOptions(STATUSBAR_CLICK_ACTIONS)
288+
.setValue(this.plugin.getStatusbarInteraction())
289+
.onChange(value => {
290+
const action = value as StatusbarClickAction;
291+
this.plugin.setStatusbarInteraction(action);
292+
this.display();
293+
})
294+
);
295+
new Setting(containerEl)
296+
.setName('Ctrl + Click')
297+
.addDropdown(dropdown => dropdown
298+
.addOptions(STATUSBAR_CLICK_ACTIONS)
299+
.setValue(this.plugin.getStatusbarInteraction('ctrl'))
300+
.onChange(value => {
301+
const action = value as StatusbarClickAction;
302+
this.plugin.setStatusbarInteraction(action, 'ctrl');
303+
this.display();
304+
})
305+
);
306+
new Setting(containerEl)
307+
.setName('Shift + Click')
308+
.addDropdown(dropdown => dropdown
309+
.addOptions(STATUSBAR_CLICK_ACTIONS)
310+
.setValue(this.plugin.getStatusbarInteraction('shift'))
311+
.onChange(value => {
312+
const action = value as StatusbarClickAction;
313+
this.plugin.setStatusbarInteraction(action, 'shift');
314+
this.display();
315+
})
316+
);
317+
new Setting(containerEl)
318+
.setName('Alt + Click')
319+
.addDropdown(dropdown => dropdown
320+
.addOptions(STATUSBAR_CLICK_ACTIONS)
321+
.setValue(this.plugin.getStatusbarInteraction('alt'))
322+
.onChange(value => {
323+
const action = value as StatusbarClickAction;
324+
this.plugin.setStatusbarInteraction(action, 'alt');
325+
this.display();
326+
})
327+
);
328+
331329
// Heading for Profiles
332330
new Setting(containerEl)
333331
.setHeading()

versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"0.6.0": "0.15.0"
2+
"0.7.0": "0.15.0"
33
}

0 commit comments

Comments
 (0)