diff --git a/README.md b/README.md index faf0493..ef9260f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Obsidian WakeLock Plugin +# Screen WakeLock Plugin -This is a tniy plugin for [Obsidian](https://obsidian.md). +This is a plugin for [Obsidian](https://obsidian.md). It's only purpose is to stop your device from dimming or locking the screen. Use it at your own leisure, as an always active screen will impact your device battery. diff --git a/esbuild.config.mjs b/esbuild.config.mjs index a5de8b8..c42678d 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -2,20 +2,19 @@ import esbuild from "esbuild"; import process from "process"; import builtins from "builtin-modules"; -const banner = -`/* +const banner = `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ `; -const prod = (process.argv[2] === "production"); +const prod = process.argv[2] === "production"; const context = await esbuild.context({ banner: { js: banner, }, - entryPoints: ["main.ts"], + entryPoints: ["src/plugin.ts"], bundle: true, external: [ "obsidian", @@ -31,7 +30,8 @@ const context = await esbuild.context({ "@lezer/common", "@lezer/highlight", "@lezer/lr", - ...builtins], + ...builtins, + ], format: "cjs", target: "es2018", logLevel: "info", diff --git a/manifest.json b/manifest.json index b4b9dd8..af6ec1b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { "id": "screen-wake-lock", "name": "Screen WakeLock", - "version": "1.0.3", + "version": "1.0.4", "minAppVersion": "0.15.0", - "description": "Allows to keep a wake lock on the display, using the w3 WakeLock API.", + "description": "Keeps the display awake while Obsidian is in the foreground.", "author": "blotspot", "authorUrl": "https://github.com/blotspot", "fundingUrl": "https://ko-fi.com/blotspot", diff --git a/package.json b/package.json index 3c94f52..fd61ec7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "screen-wake-lock", - "version": "1.0.3", - "description": "Allows to keep a wake lock on the display, using the w3 WakeLock API.", + "version": "1.0.4", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", @@ -9,7 +8,7 @@ "version": "node version-bump.mjs && git add manifest.json versions.json" }, "keywords": [], - "author": "", + "author": "blotspot", "license": "MIT", "devDependencies": { "@types/dom-screen-wake-lock": "^1.0.3", diff --git a/src/log.ts b/src/log.ts index dbec883..a3b1a3d 100644 --- a/src/log.ts +++ b/src/log.ts @@ -1,5 +1,5 @@ export class Log { - public static devMode = true; + public static devMode = false; public static d(msg: string) { if (Log.devMode) { diff --git a/main.ts b/src/plugin.ts similarity index 95% rename from main.ts rename to src/plugin.ts index 4a9bc02..354f9de 100644 --- a/main.ts +++ b/src/plugin.ts @@ -1,11 +1,8 @@ import { MarkdownView, Notice, Plugin, WorkspaceLeaf } from "obsidian"; -import { WakeLock } from "./src/wake-lock"; -import { WakeLockStatusBarItem } from "./src/statusbar"; -import { Log } from "./src/log"; -import { - WakeLockPluginSettings, - WakeLockPluginSettingsData, -} from "./src/settings"; +import { WakeLock } from "./wake-lock"; +import { WakeLockStatusBarItem } from "./statusbar"; +import { Log } from "./log"; +import { WakeLockPluginSettings, WakeLockPluginSettingsData } from "./settings"; export default class WakeLockPlugin extends Plugin { private settings: WakeLockPluginSettings; diff --git a/src/settings.ts b/src/settings.ts index 87336a3..64cc877 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,5 +1,4 @@ -import { App, PluginSettingTab, Setting } from "obsidian"; -import WakeLockPlugin from "../main"; +import { App, Plugin, PluginSettingTab, Setting } from "obsidian"; interface SettingsEventMap { active: CustomEvent; @@ -27,10 +26,10 @@ const TypedEventTarget = EventTarget as { }; export class WakeLockPluginSettings extends TypedEventTarget { - context: WakeLockPlugin; + context: Plugin; data: WakeLockPluginSettingsData; - static async load(context: WakeLockPlugin) { + static async load(context: Plugin) { const handler = new WakeLockPluginSettings(context); await handler.loadSettings(); context.addSettingTab( @@ -39,7 +38,7 @@ export class WakeLockPluginSettings extends TypedEventTarget { return handler; } - private constructor(context: WakeLockPlugin) { + private constructor(context: Plugin) { super(); this.context = context; } @@ -108,11 +107,7 @@ export const DEFAULT_SETTINGS: WakeLockPluginSettingsData = { export class WakeLockSettingsTab extends PluginSettingTab { settings: WakeLockPluginSettings; - constructor( - app: App, - plugin: WakeLockPlugin, - settings: WakeLockPluginSettings - ) { + constructor(app: App, plugin: Plugin, settings: WakeLockPluginSettings) { super(app, plugin); this.settings = settings; } @@ -145,7 +140,7 @@ export class WakeLockSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Hide Notifications") + .setName("Hide notifications") .setDesc( "Hide all notification messages about enable / disable events." ) @@ -159,7 +154,9 @@ export class WakeLockSettingsTab extends PluginSettingTab { new Setting(containerEl) .setName("Show in status bar") - .setDesc("Shows the WakeLock state in the statusbar.") + .setDesc( + "Adds an icon to the status bar, showing the current WakeLock state." + ) .addToggle((toggle) => toggle .setValue(this.settings.data.showInStatusBar)