Giter Site home page Giter Site logo

giorgosxou / tuifimanager Goto Github PK

View Code? Open in Web Editor NEW
663.0 6.0 12.0 5.11 MB

A cross-platform terminal-based termux-oriented file manager (and component), meant to be used with a Uni-Curses project or as is.

License: GNU General Public License v3.0

Python 98.74% Nix 1.26%
tui unicurses ncurses pdcurses terminal-based filemanager filemanager-ui terminal termux cross-platform

tuifimanager's Introduction

TUIFI Manager

A cross-platform terminal-based termux-oriented file manager (and component), meant to be used with a Uni-Curses project or as is. This project is mainly an attempt to get more attention to the Uni-Curses project.

⚙️ Installation

sudo pip3 install tuifimanager --upgrade
pip3 install TUIFIManager --upgrade

or just ^^^ if it works for you. (eg. on termux?)

💥 Usage

Run tuifi in your terminal to use it as is or import it in one of your Uni-Curses project as a component like:

from TUIFIManager import *

for more details look into the __main__.py

FONT: Cartograph CF

📦 Features

• 📌 Current:

  • Supports most of the common mouse events so far
  • It is somewhat fully customizable?
  • Can be used as a component
  • Uses only ~30MB of RAM
  • It is pretty snappy
  • Supports Termux
  • Cross Platform
  • and more

• 🔮 Desired:

⌨️ Keybindings

In vim_mode both normal and vim shortcuts work

Normal vim_mode Action
SHIFT + TAB Moves selected file to the previous directory
KEY_BACKSPACE J Opens\Goes to the previous directory
ALT + DOWN Opens\Closes the "right-click menu"
KEY_HOME H Navigates to the $HOME directory
KEY_F5 Reload\Refresh current directory
CTRL + V p Pastes the Copied or Cuted files
DEL CTRL+d Deletes the selected files
CTRL + F i Find Files (if not auto_find_on_typing)
CTRL + O O Open whole directory in editor
CTRL + A Select all files in current folder
CTRL + C yy Copies the selected files
CTRL + K Copies the selected files
CTRL + X c Cuts the selected files
CTRL + R r Rename selected file
CTRL + T Toggle hidden files
CTRL + N W Create new folder
CTRL + W w Create new file
ARROW KEYS l k j h Navigates files
KEY_ENTER K Opens files
CTRL + E e Exit with cd
ESCAPE Exit

(TIP: 🐁 use ALT + CLICK for multiple mouse selection if SHIFT not working)

TERMUX only Shortcuts\Keybindings

Shortcut Action
CTRL + DOWN Goes in&out of select-mode while also automatically copies the selected file(s)
CTRL + LEFT Goes out of select-mode while also cuts the seleccted file(s)
CTRL + END Goes out of select-mode while also deleting the selected file(s)
CTRL + UP Same as CTRL + V, Pastes the Copied or Cuted files
END Deletes selected files

👨‍💻 Commands

(Default & Custom Comands) - To perform a command under the normal-mode, you first have to press the space-bar and then type the command. Alternatively, use vim_mode or enable the tuifi_auto_command_on_typing env-variable (notice: it disables tuifi_auto_find_on_typing). The default commands can be seen below and can be found under the ~/.config/tuifi/cmds.conf where you can add your custom ones too:

Cmd Type Attributes Label Comment
gt open 'directory':'~/.config/tuifi' - tuifi -
gh open 'directory':'~/' - Home -
owv open 'directory':None,'_with':'vim' Opened With Vim
yat copy 'pattern':'.+.txt'
yy copy 'pattern':None

There are also some "static" ones like the m+character which marks the current directory into the character, so you can navigate back to it by using ` or ;+that_character

📜 Documentation

Work in progress 🛠️🏗 ...

💭 Customization

How do I enable vim_mode?

Set tuifi_vim_mode enviroment variable to True

How do I change the default keys (besides commands)?

This is not possible right now althought you could play around with the content of toggle_vim_mode function under __init__.py

How do I set the default editor?

Set tuifi_default_editor enviroment variable to vim or whatever you prefer

How do I disable the auto-find-mode?

You can just set tuifi_auto_find_on_typing enviroment variable to False

How do I change the scroll sensitivity?

You can set either or both tuifi_scroll_sensitivity, tuifi_ctrl_scroll_sensitivity enviromental variables, to the disered number of characters per scroll action (they default to 1 and 7)

How do I change the number of visible lines of filenames that are visible?

You can set how mnay lines you want using tuifi_visible_filename_lines (Defaults to 4)

How do I change the default configuration path?

Set tuifi_config_path enviroment variable to whatever you prefer most

How do I toggle hidden files/folders?

You can either CTRL + T or set tuifi_show_hidden enviroment variable to True

How do I change the default colors?

look here for more informations

💗 Donation

I do really need money to survive, I have no job, living in a basement, making things for free, because I love to.

  • Paypal Address
  • Monero Address: 897ehhSQJQpGF7tYDhQM51jiX7nnHmzuYAW4q8JGwJxu8JKXvaK6AivCzatuJxnifjZ2qy98ks2g2PhmTaYCMMta2Ga2LJx

🫶 Special thanks to

🕳️ Help

Any Idea with this issue unicurses/unicurses#21 ?

tuifimanager's People

Contributors

brewingweasel avatar giorgosxou avatar joser93 avatar michaelbelsanti avatar sigmanificient avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tuifimanager's Issues

Using EDITOR instead of tuifi_default_editor

Is there any benefit to using a custom variable for the editor? Using EDITOR will use the correct editor out of the box for most users, since most people heavily using the terminal will have it set. If you want to offer the ability to use an editor other than what EDITOR is set to, perhaps you could check if tuifi_default_editor is set, and otherwise fallback to EDITOR?

OSError

shell=True , make it a string and maybe remove os.system('clear')

proc = subprocess.Popen([open_with, directory])

recreating the issue, open any file with DEFAULT_OPENER at least on windows

CTRL+C raises auto-search function

just a reminder to return when event is null 0, because i forgot about it and i was wondering why i had this issue lol

just add this line, under the handle_events function

if event == 0: return

Typing support

I'd like to see (maybe add by myself) typing support as it is a good practice and would help to understand a bit more of what is going on, often allowing to spot more complex issues and code simplifying.

What are your thoughts about it?

Error when starting tuifi

os: Arch GNU/Linux
version: Latest commit from git

When starting TUIFIManager using the command provided from setup.py in a local installation, it crashes with the following error:

(venv) [sigmanificient@Sigmachine TUIFIManager]$ tuifi
Traceback (most recent call last):
  File "/home/sigmanificient/TUIFIManager/venv/bin/tuifi", line 33, in <module>
    sys.exit(load_entry_point('TUIFIManager', 'console_scripts', 'tuifi')())
  File "/home/sigmanificient/TUIFIManager/venv/bin/tuifi", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/sigmanificient/TUIFIManager/TUIFIManager/__init__.py", line 11, in <module>
    from       .TUIMenu import    *
  File "/home/sigmanificient/TUIFIManager/TUIFIManager/TUIMenu.py", line 3, in <module>
    from TUItilities import BEGIN_MOUSE,END_MOUSE
ModuleNotFoundError: No module named 'TUItilities'

This is caused by the line 3 from TUIFile.py:

from TUItilities import BEGIN_MOUSE,END_MOUSE

Using a static configuration for the setup process

I noticed that the setup process is pretty simple, and thus setting up a static configuration could be a nice to have.
I'm thinking of using setup.cfg as it is natively supported by setup-tools, but poetry can be a nice alternative too.

Using a dynamic approach is a bit criticized by some as it may lead to ACE at installation. Anyway, it always better to have a clean easy and standard way for the setup.

suffixes and search

just realised how wrong my implementation of search + suffixes was, especially for the component side of the project.

Hover Effect on Windows

I'm really buffled by the mouse support of PDcurses, wierd stuff happening, where if the bstate is 0 (or even quit the app with bstate 0), then real-time mouse coordinates work fine unitl I click or scroll and the bstate change then I get nothing

ncurses not found but existing on macOS

Installed via:
% pip3 install TUIFIManager --upgrade

Run as:
% tuifi

Got:

goetz@host ~ % tuifi
Traceback (most recent call last):
  File "/opt/homebrew/bin/tuifi", line 5, in <module>
    from TUIFIManager.__main__ import main
  File "/opt/homebrew/lib/python3.10/site-packages/TUIFIManager/__init__.py", line 9, in <module>
    from       .TUIMenu import    *
  File "/opt/homebrew/lib/python3.10/site-packages/TUIFIManager/TUIMenu.py", line 2, in <module>
    import unicurses
  File "/opt/homebrew/lib/python3.10/site-packages/unicurses/__init__.py", line 119, in <module>
    ncurses,panel = get_libncursesw_paths()
  File "/opt/homebrew/lib/python3.10/site-packages/unicurses/__init__.py", line 79, in get_libncursesw_paths
    raise Exception('NCursesNotFound: ' + msg)
Exception: NCursesNotFound: No version of shared-libraries of ncurses found on this system, please try `brew install ncurses` if this won't work please create an issue

goetz@host ~ % brew install ncurses
==> Auto-updated Homebrew!
[…]
Running `brew update --auto-update`...
[…]

Warning: ncurses 6.3 is already installed and up-to-date.
To reinstall 6.3, run:
  brew reinstall ncurses

goetz@host ~ % sw_vers
ProductName:		macOS
ProductVersion:		13.1
BuildVersion:		22C65

… on ARM64.

TUIFIManager does not start in current working directory.

Hello,

I see no reason why TUIFIManager should not start in the current working directory $PWD (os.path.curdir in Python).

Instead, it appears the default is to always start in the user's home directory ($HOME).

Please consider changing the behavior.

CTRL + S is default for stop processing terminal

Just wanted to point out that for a terminal based utility, the default keybinding CTRL +S is highly problematic,
as for most environments it means freeze / don't update / stop scrolling the terminal.
(with CTRL + Q meaning continue / unfreeze / resume scrolling).

Please consider to replace this default binding with something less irritating to most users.

Thanks.

Display Hidden files after Non-Hidden files

Not sure this is an issue but displaying both hidden and non-hidden files/folders together makes it kinda messy for the user to distinguish.
Normally, non-hidden files are displayed first and then the hidden files at last.
Also, a shortcut can be created to unhide hidden files and to hide again.

Deleting in TERMUX

Permisions are limmited in TERMUX when it comes to the access of storage, and send2trash fails to create a trash-folder in the root directory of the emulated or SD storage

Move file to trash instead of deleting

As Brodie Robertson mentioned in his video, I think completely deleting files is not intuitive and makes deleting files unnecessarily stressful. I think a good solution for this would be to instead move the files to ~/.local/share/Trash/ (and the equivalent on other platforms). This way the files would be automatically removed after a certain amount of time on Windows and Mac, (and on linux if the user or another trash program configured it to do so) but if the user accidentally deleted the file they could easily recover it. This would also help when undoing is added.

Nix OS support

The package fail to initialize on Nix OS. As no configuration is provided, is make it hard to install properly.

Traceback (most recent call last):
  File "/data/dev/GiorgosXou/TUIFIManager/venv/bin/tuifi", line 5, in <module>
    from TUIFIManager.__main__ import main
  File "/data/dev/GiorgosXou/TUIFIManager/TUIFIManager/__init__.py", line 12, in <module>
    from       .TUIMenu import TUIMenu
  File "/data/dev/GiorgosXou/TUIFIManager/TUIFIManager/TUIMenu.py", line 2, in <module>
    import unicurses
  File "/data/dev/GiorgosXou/TUIFIManager/venv/lib/python3.10/site-packages/unicurses/__init__.py", line 124, in <module>
    lib1 = ctypes.CDLL(ncurses,mode=ctypes.RTLD_GLOBAL)
  File "/nix/store/hhk4wr7hwry854sq69chmrjqyi964p7y-python3-3.10.9/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libncursesw.so.6: cannot open shared object file: No such file or directory

Scroll sensitivity

We need a Scroll sensitivity variable, maybe "smoth scrolling" with an offset too?

Add a nox ci for various configuration

The project needs a nox CI to ensure installation is going as planned.

A GitHub action with various configuration (python version and os) would make it easy to sport potential issues.

Flickering of menu (?)

For some very wierd reason, the issue gets solved the momment I open a file to an external app (it doesn't matter if the external app is a TUI or not), I'm guessing this has to do with the print(BEGIN_MOUSE) in main

\r vs \n vs \r\n etc.

tuifi_Peek 2023-01-05 11-53

Code Formatting

I noticed during my small dig into the source that the formatting is pretty unusual, making it hard to understand a lot of what is happening and how to structure the code i want to add. Moreover, my code editor is going absolutely crazy, with pretty much every line being underlined.

It would be nice to provide a configuration for your code styling via pylint to a similar tooling, or maybe use a more broad formatting like black (mostly based on python pep8) or flake. The second option would allow to use contigeous integration to insure future code to be well formatted and would keep it under close standard to python developers.

What are your thoughts about it?

Freeze

Randomly freezes when using

python 3.9
tuifi from pipy 1.3.3
unicurses from pipy 2.1.0
ncurses6 6.3-p20220507
alacritty 0.11.0
recording.mp4

Extracting "ascii images" to files

It would be really nice to have a separation for the ASCII files icons into their own files outside the codebase.

This would make organization easier, adding new files type an easy manner and improve the possibility for customization.
I would think of having metadata along the ascii art, such a the file extensions.

For later on it could be a way to add better / small icons too while keeping the code clean with a simple loader helper

Git keeps corrupting the peek gif

DUE to CRLF replacement in the, git keeps corrupting the Peek.gif file.
From git logs:

warning: in the working copy of 'Peek.gif', CRLF will be replaced by LF the next time Git touches it

Installation with pip is giving an error on pyproject.toml: LICENSE not found.

Running both:
sudo pip3 install tuifimanager --upgrade
pip3 install TUIFIManager --upgrade outputs the same error.

Defaulting to user installation because normal site-packages is not writeable
Collecting TUIFIManager
  Using cached TUIFIManager-2.3.2.tar.gz (41 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      running dist_info
      creating /tmp/pip-modern-metadata-ti7k196i/TUIFIManager.egg-info
      writing manifest file '/tmp/pip-modern-metadata-ti7k196i/TUIFIManager.egg-info/SOURCES.txt'
      listing git files failed - pretending there aren't any
      writing manifest file '/tmp/pip-modern-metadata-ti7k196i/TUIFIManager.egg-info/SOURCES.txt'
      error: [Errno 2] No such file or directory: 'LICENSE'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.


Not sure if its a problem on my end or permission errors because sudo didn't work either. I tried updating my packages, ran pip again and got the same errors.

Platform: Pop!OS 22.04 LTS

Vim motions?

Thinking of adding some basic motions, although this is not the priority right now.

Over-lapping files when exiting search mode

Weird Issue resulting in the over-drawing of another icon, when exiting find-mode (in position 0) and then proceeding to move:

Peek 2022-12-12 12-52

it has been fixed, it will not be present in the next release

Adding more file types

I open this issue as I would present a few design a file type i made and may post more of them in the future.
This issue is meant to collect every proposition instead of opening an issue for each

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.