Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: manogna4/obsidian-koncham-workspace
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.3
Choose a base ref
...
head repository: manogna4/obsidian-koncham-workspace
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 10 commits
  • 6 files changed
  • 1 contributor

Commits on May 14, 2021

  1. resolved issues raised

    manogna4 committed May 14, 2021
    Copy the full SHA
    80ebebf View commit details

Commits on May 19, 2021

  1. Copy the full SHA
    320de7c View commit details

Commits on May 21, 2021

  1. Update README.md

    manogna4 authored May 21, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7a0b893 View commit details
  2. Update README.md

    manogna4 authored May 21, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bf0fff8 View commit details
  3. Update README.md

    manogna4 authored May 21, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fa998df View commit details
  4. Update README.md

    manogna4 authored May 21, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0d00984 View commit details
  5. Update README.md

    manogna4 authored May 21, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    485b495 View commit details
  6. new demo gif

    manogna4 committed May 21, 2021
    Copy the full SHA
    2fb971f View commit details
  7. Update README.md

    manogna4 committed May 21, 2021
    Copy the full SHA
    8e26cf3 View commit details

Commits on Apr 10, 2022

  1. update 2022-04-10T1157

    manogna4 committed Apr 10, 2022
    Copy the full SHA
    f7d9ce5 View commit details
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,33 +4,37 @@ an obsidian plugin to enhance the workspace

## features

### `open panes` view (vertical tabs)
### 'Center-panes' view on sidebar (vertical tabs)

This is a tab on the left side-bar that lists all the panes open in the main area.
This is a tab on the left side-bar that lists all the panes open in the main area. This works a little like vertical tabs (in vivaldi and edge browsers).

This works a little like vertical tabs (in vivaldi and edge browsers)
features of this view:
+ switch to any pane with one click
+ active note is highlighted
+ more features exposed through right-clicking the tab header

It is useful when using obsidian in ways that some open panes are hidden from view.
This view is useful when using obsidian in ways that hide some open panes.

examples of such modes include:
+ sliding-panes
+ maximize active pane

![root leaves in action](media/root-leaves-in-action.gif)
This screen recording demonstrates usage in the default and maximized modes:

(sidebar header icon has been changed from double-downward-arrows to horizontal-bars)
![center-panes in action](https://raw.githubusercontent.com//manogna4/obsidian-koncham-workspace/main/media/center-panes-in-action.gif)

### pin/unpin all leaves

This is useful when you want to force every new note to open in it's own pane
### pin/unpin panes

Pinning all panes forces every new note to open in it's own pane.
When some external applications open a note in Obsidian, they switch away from the last active un-pinned pane. Pinning prevents losing your existing open notes.

## features planned

+ more functionality in `open panes` view through right click
+ rearrange panes in alphabetical order
+ more functionality in `center panes` view through right click
+ pane switcher modal
+ pane arrangements such as (1+1), (1+2) using commands
+ rearrange panes in alphabetical order

## known issues

-- none right now --
-- none right now --
78 changes: 56 additions & 22 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import {Plugin, ItemView, WorkspaceLeaf, Menu, Workspace} from 'obsidian';
import {Plugin, ItemView, WorkspaceLeaf, Menu, FuzzySuggestModal} from 'obsidian';

const plugin_name = 'koncham-workspace'
const view_type = 'root-leaves'
const view_name = 'Open Panes'
const view_type = 'center-panes'
const view_name = 'Center Panes'

export default class konchamWorkspace extends Plugin {
interface leafItem {
type: string;
title: string;
}

export default class KonchamWorkspace extends Plugin {

async onunload() {
console.log('unloading plugin: ' + plugin_name);
@@ -15,41 +20,40 @@ export default class konchamWorkspace extends Plugin {

this.registerView(view_type, (leaf) => (new RootLeavesListView(leaf, this)));

this.app.workspace.onLayoutReady(this.initializeView);
this.app.workspace.onLayoutReady(this.initializeRootLeavesView);

this.addCommand({
id: 'leaves-pin-on',
name: 'pin all leaves',
name: 'Pin all panes',
callback: () => this.leavesPinOn(),
});

this.addCommand({
id: 'leaves-pin-off',
name: 'unpin all leaves',
name: 'Unpin all panes',
callback: () => this.leavesPinOff(),
});

this.addCommand({
id: 'show-root-leaves-view',
name: 'show open-panes',
id: 'show-center-panes-view',
name: 'Show center-panes',
callback: () => this.showRootLeavesView(),
});

this.addCommand({
id: 'initialize-view',
name: 'refresh open panes',
callback: () => this.initializeView(),
id: 'open-center-panes-view',
name: 'Reopen center-panes',
callback: () => this.initializeRootLeavesView(),
});

}

private readonly initializeView = (): void => {
private readonly initializeRootLeavesView = (): void => {
if (this.app.workspace.getLeavesOfType(view_type).length) {
return;
}
this.app.workspace.getLeftLeaf(false).setViewState({
type: view_type,
active: true,
});
};

@@ -76,11 +80,11 @@ export default class konchamWorkspace extends Plugin {
}

class RootLeavesListView extends ItemView {
private readonly plugin: konchamWorkspace
private readonly plugin: KonchamWorkspace

constructor(
leaf: WorkspaceLeaf,
plugin: konchamWorkspace,
plugin: KonchamWorkspace,
) {
super(leaf);

@@ -96,16 +100,23 @@ class RootLeavesListView extends ItemView {

public readonly refreshView = (): void => {
let leaf_active = this.app.workspace.activeLeaf;
const rootEl = createDiv({ cls: 'nav-folder mod-root koncham-workspace' });
const rootEl = createDiv({ cls: 'nav-folder mod-root koncham-workspace koncham-workspace-root-panes' });
this.contentEl.empty();
this.contentEl.appendChild(rootEl);
const childrenEl = rootEl.createDiv({ cls: 'nav-folder-children' });
this.app.workspace.iterateRootLeaves((leaf: WorkspaceLeaf) => {
const navFile = childrenEl.createDiv({ cls: 'nav-file' });
const navFileTitle = navFile.createDiv({ cls: 'nav-file-title' });


if (leaf === leaf_active) {
navFileTitle.addClass('is-active');
}

if (leaf.pinned) {
navFileTitle.addClass('is-pinned');
}

let displaytext
if (leaf.view.getViewType() == "empty"){
displaytext = "[empty]"
@@ -118,12 +129,8 @@ class RootLeavesListView extends ItemView {
text: displaytext,
});

const contentEl = this.containerEl.children[1];
contentEl.empty();
contentEl.appendChild(rootEl);

navFileTitle.onClickEvent(() => {
this.app.workspace.setActiveLeaf(leaf);
this.app.workspace.setActiveLeaf(leaf, true, true);
});
});
}
@@ -167,4 +174,31 @@ class RootLeavesListView extends ItemView {
});
})
}
}

class leafSwitchModal extends FuzzySuggestModal<leafItem> {
app: App;
items: leafItem[];

constructor(app: App, items: leafItem[]) {
super(app);
this.app = app;
this.items = items;
}

getItems(): leafItem[] {
return this.items;
}

getItemText(item: leafItem): string {
return item.rung + " -- " + item.title;
}

onChooseItem(item: leafItem, evt: MouseEvent | KeyboardEvent): void {
let view = this.app.workspace.activeLeaf.view
if (view instanceof MarkdownView) {
let editor = view.editor
editor.setSelection({ line: item.line, ch: item.start + 1 })
}
}
}
File renamed without changes
Binary file added media/center-panes-in-action.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/center-panes-in-action01.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.koncham-workspace>.nav-folder-children>.nav-file>.nav-file-title {
.koncham-workspace-root-panes>.nav-folder-children>.nav-file>.nav-file-title {
padding-left: 2px;
padding-right: 2px;
}

.is-pinned {
color: red !important;
}