Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
manogna4 committed Apr 19, 2021
0 parents commit a8e021c
Show file tree
Hide file tree
Showing 13 changed files with 855 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
76 changes: 76 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# FuseBox cache
.fusebox/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 manogna4

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# koncham workspace

obsidian plugin to manipulate the workspace

search for `koncham workspace` in the command palette to look for all features


## features

+ pin/unpin all leaves
+ reveal workspace-tabs (tag-panel, backlinks, outline, etc.)
+ reveal some plugin tabs (recent-files, calendar, etc.)

## features planned

+ activate functions on workspace-tabs (search: toggle-collapse-results, etc)
169 changes: 169 additions & 0 deletions main.js

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import {Plugin} from 'obsidian';

const plugin_name = 'koncham-workspace'

export default class MyPlugin extends Plugin {

async onunload() {
console.log('unloading plugin: ' + plugin_name);
}

async onload() {
console.log('loading plugin: ' + plugin_name);

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

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

this.addCommand({
id: 'reveal-tag-pane',
name: 'reveal tag pane',
callback: () => this.revealTagPane(),
});

this.addCommand({
id: 'reveal-recent-files',
name: 'reveal recent files',
callback: () => this.revealRecentFiles(),
});

this.addCommand({
id: 'reveal-starred',
name: 'reveal starred',
callback: () => this.revealStarred(),
});

this.addCommand({
id: 'reveal-backlinks',
name: 'reveal backlinks',
callback: () => this.revealBacklinks(),
});

this.addCommand({
id: 'reveal-outline',
name: 'reveal outline',
callback: () => this.revealOutline(),
});

this.addCommand({
id: 'reveal-search',
name: 'reveal file search',
callback: () => this.revealSearch(),
});

this.addCommand({
id: 'reveal-file-explorer',
name: 'reveal file explorer',
callback: () => this.revealFileExplorer(),
});

this.addCommand({
id: 'reveal-calendar',
name: 'reveal calendar',
callback: () => this.revealCalendar(),
});

}

leavesPinOn(){
this.app.workspace.iterateRootLeaves((leaf: any) => {
leaf.setPinned(true);
});
}

leavesPinOff() {
this.app.workspace.iterateRootLeaves((leaf: any) => {
leaf.setPinned(false);
});
}

revealTagPane(){
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Tag pane"){
this.app.workspace.revealLeaf(leaf);
}
});
}

revealRecentFiles() {
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Recent Files") {
this.app.workspace.revealLeaf(leaf);
}
});
}

revealStarred() {
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Starred") {
this.app.workspace.revealLeaf(leaf);
}
});
}

revealSearch() {
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Search") {
this.app.workspace.revealLeaf(leaf);
}
});
}

revealFileExplorer() {
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "File explorer") {
this.app.workspace.revealLeaf(leaf);
}
});
}

revealBacklinks() {
let note_curr = this.app.workspace.activeLeaf.getDisplayText();
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Backlinks for " + note_curr) {
this.app.workspace.revealLeaf(leaf);
}
});
}

revealOutline() {
let note_curr = this.app.workspace.activeLeaf.getDisplayText();
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Outline of " + note_curr) {
this.app.workspace.revealLeaf(leaf);
}
});
}

revealCalendar() {
let note_curr = this.app.workspace.activeLeaf.getDisplayText();
this.app.workspace.iterateAllLeaves((leaf: any) => {
if (leaf.getDisplayText() == "Calendar") {
this.app.workspace.revealLeaf(leaf);
}
});
}



}
10 changes: 10 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "koncham-workspace",
"name": "koncham workspace",
"author": "mano",
"version": "0.0.1",
"minAppVersion": "0.11.13",
"description": "obsidian workspace management",
"authorUrl": "https://manogna4.github.io",
"isDesktopOnly": true
}
Loading

0 comments on commit a8e021c

Please sign in to comment.