Skip to content

Commit

Permalink
Massive update: removed most all store subscriptions and use the new …
Browse files Browse the repository at this point in the history
…method of getting stores in the JavaScript code. Many other fixes allong the way as well.
  • Loading branch information
raguay committed Feb 6, 2023
1 parent 2a69dd3 commit 547c8b0
Show file tree
Hide file tree
Showing 17 changed files with 365 additions and 502 deletions.
4 changes: 3 additions & 1 deletion .notes/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ To build the project, run:

wails build --platform="darwin/universal"

or
to build a universal binary for macOS. Or

mask build

to build a binary for the current system only.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ I started my programming career with Emacs as my main text editor on a main fram

With Spacemacs and Doom-emacs, I learned that the Vim style keyboard was much more efficient. But, I kept going back to the Emacs key memory. I finally decided to really give Vim a run with neovim on my MacBook Air. I even installed Spacevim and really liked it. Now, I'm fully comfortable in the Vim style keyboard (but far from mastering it completely) and have adapted it to many other programs along the way. My current editor of choice is [OniVim2](https://github.com/onivim/oni2) which is the fastest programming editor I've ever used. It is great!

But, I've never been happy with the file managers I've used. [fman](https://fman.io/) is great, but not actively being maintained and expanded upon. I also don't really like python, it's API language. So, I decided to jump in and make one to suit me better. This is how Modal File Manager was started. I wanted something that was as configurable as TkDesk was, but with a modal keyboard model for hotkeys. To take it even further, new modes and keymaps can be added with extensions.
But, I've never been happy with the file managers I've used. [fman](https://fman.io/) is great, but not actively being maintained and expanded upon. It is very slow in large directories and I also don't really like python: it's API language. So, I decided to jump in and make one to suit me better. This is how Modal File Manager was started. I wanted something that was as configurable as TkDesk was (if anyone remembers it), but with a modal keyboard model for hotkeys. To take it even further, new modes and keymaps can be added with extensions.

Modal File Manager is also somewhat minimal in the UI. Many graphical file managers have buttons, shelves, etc. all over the place with information everywhere. I decided to make the main interface as low keyed as possible with all other information in the status line or extras panel. Extra file information is on the status line for the current cursor location. More information is displayed in extras panel as well.
Modal File Manager is also somewhat minimal in the UI. Many graphical file managers have buttons, shelves, etc. all over the place with information everywhere. I decided to make the main interface as low keyed as possible with all other information in the status line or extras panel. Extra file information is on the status line for the current cursor location. More information is displayed in the extras panel as well (the side opposite the current pointer shows extra information instead of the other file pane. When turned off, it automatically goes back to the file pane that was showing before switching.).

Since there are so many dual pane file managers available, I knew this would never be a marketable product (and I did not want the hassle of endless customer complaint over a feature not working the way they want it). Therefore, I'm making this an open source project to hopefully get some help from other to really making this thing shine.
Since there are so many dual pane file managers available, I knew this would never be a marketable product (and I did not want the hassle of endless customer complaint over a feature not working the way they want it). Therefore, I'm making this an open source project to hopefully get some help from others to help really make this thing shine.

Therefore, I hope you enjoy this little program as much as I have. Feel free to sponsor the project, help code some of it (just send in the pull requests), or just give me some tips along the way. Any help is appreciated.

Expand All @@ -75,7 +75,7 @@ I've created multiple open source resources (I have around 80 GitHub repositorie
- Watches for changes in the current directory and updates accordingly.
- Changing directories in the Directory Bar (normal mode `q`) shows a list of matching entries from history and then below the current directory.
- File editor is configurable by the `~/.myeditorchoice` file (see `Editing Files` below). Otherwise, the system editor for the file type will be used.
- Integrated with ScriptPad - another project of mine coming soon!
- Integrated with [EmailIt](https://github.com/raguay/EmailIt).
- Quick Search - a input to type text so that any entry at that level is removed that doesn't have that text in it. Just refresh the pane to get back to normal. I think of it as a quick filter more than a quick search.
- Toggle System files/folders visibility
- Optionally deletes to the OS's trashcan (external program has to be installed)
Expand Down Expand Up @@ -105,6 +105,7 @@ All Dracula based themes are here with permission from the author. Please suppor
Because this is a web technologies application, there are certain things that it just can't do and I'm not sure if they can be done at this level. Therefore, this will not completely remove your dependency on using the Finder application. But, these instances are not everyday items for which we use a file manager. As I see it, these items are not doable, but I would love for someone to prove me wrong:

- Install applications that the macOS Gatekeeper will allow.
- Drad and drop with other programs.

## Installation

Expand Down Expand Up @@ -468,7 +469,7 @@ This list of tutorials are with the latest version of Modal File Manager:

I finally made my first attempt at an icon for Modal File Manager. The files are in the `frontend/icons` directory. Any constructive criticizm is welcome.

![Icon](https://github.com/raguay/ModalFileManager/blob/main/appicon.png)
![Icon](https://github.com/raguay/ModalFileManager/blob/main/build/appicon.png)

## Sponsor this project

Expand Down
Binary file removed appicon.png
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/src/components/CommandPrompt.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
onMount(() => {
width = window.innerWidth - 30;
keyProcess.set(false);
$keyProcess = false;
if (commands != null) filtered = commands.commandList;
});
Expand Down
39 changes: 11 additions & 28 deletions frontend/src/components/DirectoryListing.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
let newPath;
let inputPath;
let dirlist = [];
let localTheme = {};
let dirListDOM;
let tryagain = false;
let pending = false;
let dirIndex = 0;
let localDirListeners = [];
let lastDir = "";
let rightSet = false;
let leftSet = false;
Expand All @@ -31,15 +29,6 @@
$: setEditFlag(edit);
onMount(() => {
const unsubscribeTheme = theme.subscribe((value) => {
localTheme = value;
});
const unsubscribeDirectoryListeners = directoryListeners.subscribe(
(value) => {
localDirListeners = value;
}
);
localTheme = get(theme);
newPath = shortenPath(path);
if (side === "left") {
window.runtime.EventsOn("leftDirChange", () => {
Expand All @@ -56,10 +45,7 @@
});
});
}
return () => {
unsubscribeTheme();
unsubscribeDirectoryListeners();
};
return () => {};
});
afterUpdate(async () => {
Expand Down Expand Up @@ -94,7 +80,7 @@
if (typeof pth !== "undefined") {
if (lastDir !== pth) {
lastDir = pth;
localDirListeners.map((value) => {
$directoryListeners.map((value) => {
value(pth, "");
});
}
Expand All @@ -107,7 +93,7 @@
}
}
function setEdit(e) {
function setEdit() {
show = false;
inputPath = path.path;
dirIndex = 0;
Expand All @@ -118,14 +104,14 @@
if (inputPath[inputPath.length - 1] !== sep) {
inputPath = inputPath + sep;
}
keyProcess.set(false);
$keyProcess = false;
}
async function editOff() {
if (await path.fileSystem.dirExists(inputPath)) {
show = true;
dirlist = [];
keyProcess.set(true);
$keyProcess = true;
dispatch("dirChange", {
path: inputPath,
cursor: true,
Expand All @@ -137,7 +123,7 @@
inputPath = dirlist[dirIndex];
show = true;
dirlist = [];
keyProcess.set(true);
$keyProcess = true;
if (await path.fileSystem.dirExists(inputPath)) {
dispatch("dirChange", {
path: inputPath,
Expand Down Expand Up @@ -169,9 +155,7 @@
//
// Add to the history.
//
var hist = get(dirHistory);
hist.addHistory(result);
dirHistory.set(hist);
$dirHistory.addHistory(result);
//
// Fixing the path.
Expand Down Expand Up @@ -252,8 +236,7 @@
//
// Get matches from history.
//
var hist = get(dirHistory);
dirlist = hist.searchHistory(inputPath);
dirlist = $dirHistory.searchHistory(inputPath);
if (dirlist === null) dirlist = [];
numleft -= dirlist.length;
if (numleft > 0) {
Expand Down Expand Up @@ -317,16 +300,16 @@
{#if dirlist.length > 0 && dirListDOM !== null && dirInputDOM !== null}
<div
id="searchList"
style="background-color: {localTheme.backgroundColor}; color: {localTheme.textColor}; top: {dirInputDOM.offsetTop +
style="background-color: {$theme.backgroundColor}; color: {$theme.textColor}; top: {dirInputDOM.offsetTop +
dirListDOM.offsetHeight}px; left: {dirListDOM.offsetLeft}px;"
>
<ul>
{#each dirlist as item, key}
{#if item !== ""}
<li
style="color: {key === dirIndex
? localTheme.selectedColor
: localTheme.textColor}"
? $theme.selectedColor
: $theme.textColor}"
on:click={() => {
processListItem(key);
}}
Expand Down
9 changes: 4 additions & 5 deletions frontend/src/components/Entry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
}
async function dragStart(e) {
const lconfig = get(config);
var flist = lconfig.extensions.getExtCommand("getSelectedFiles").command();
const $config = get(config);
var flist = $config.extensions.getExtCommand("getSelectedFiles").command();
var included = false;
var data = [];
flist.map(async (item) => {
Expand Down Expand Up @@ -175,7 +175,6 @@
// Create the entries from the drop.
//
const dataTransArray = e.dataTransfer.getData("text/plain").split("\n");
const lconfig = get(config);
var fromEntries = [];
for (var i = 0; i < dataTransArray.length; i++) {
var parts = dataTransArray[i].split("|");
Expand All @@ -201,11 +200,11 @@
});
}
if (shiftKey) {
await lconfig.extensions
await $config.extensions
.getExtCommand("moveEntriesCommand")
.command(fromEntries, toEntry);
} else {
await lconfig.extensions
await $config.extensions
.getExtCommand("copyEntriesCommand")
.command(fromEntries, toEntry);
}
Expand Down
19 changes: 5 additions & 14 deletions frontend/src/components/Env.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{#if ((localConfig !== null) && (typeof localConfig.configuration.env !== 'undefined'))}
{#if (($config !== null) && (typeof $config.configuration.env !== 'undefined'))}
<table>
<thead>
<tr>
Expand All @@ -15,7 +15,7 @@
</tr>
</thead>
<tbody>
{#each Object.entries(localConfig.configuration.env) as kv}
{#each Object.entries($config.configuration.env) as kv}
<EnvTableRow
name={kv[0]}
value={kv[1]}
Expand Down Expand Up @@ -74,33 +74,24 @@
let KVname = '';
let KVvalue = '';
let localConfig = null;
let addNew = false;
onMount(() => {
const unsubConfig = config.subscribe(value => {
localConfig = value;
});
return(() => {
unsubConfig();
});
});
function deleteCell(kv) {
delete localConfig.configuration.env[kv[0]];
config.set(localConfig);
delete $config.configuration.env[kv[0]];
}
function saveCell(kv, e) {
localConfig.configuration.env[kv[0]] = e.detail.value;
config.set(localConfig);
$config.configuration.env[kv[0]] = e.detail.value;
}
function addKV(e) {
localConfig.configuration.env[KVname] = KVvalue;
$config.configuration.env[KVname] = KVvalue;
addNew = false;
config.set(localConfig);
KVname = '';
KVvalue = '';
}
Expand Down
Loading

0 comments on commit 547c8b0

Please sign in to comment.