From 7608e2c2be6a0f7889147e3ef209cfd7cb617541 Mon Sep 17 00:00:00 2001 From: ThaCuber <70547062+thacuber2a03@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:07:34 -0400 Subject: add `cleanstart` plugin (#320) --- manifest.json | 7 +++++++ plugins/cleanstart.lua | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 plugins/cleanstart.lua diff --git a/manifest.json b/manifest.json index 859f186..ece262d 100644 --- a/manifest.json +++ b/manifest.json @@ -227,6 +227,13 @@ "id": "centerdoc", "mod_version": "3" }, + { + "description": "Hides the treeview at start if no arguments passed to the executable are directories. Compatible with lite.", + "version": "0.1", + "path": "plugins/cleanstart.lua", + "id": "cleanstart", + "mod_version": "3" + }, { "id": "codeplus", "version": "1.0", diff --git a/plugins/cleanstart.lua b/plugins/cleanstart.lua new file mode 100644 index 0000000..b1f3244 --- /dev/null +++ b/plugins/cleanstart.lua @@ -0,0 +1,11 @@ +-- mod-version:3 +require 'plugins.treeview' -- load after treeview +local command = require 'core.command' + +local close = true +for _, v in ipairs(ARGS) do + local info = system.get_file_info(v) + if info and info.type == "dir" then close = false; break end +end + +if close then command.perform "treeview:toggle" end -- cgit v1.2.3