Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Vi mode for keyboard shortcuts #42

Open
wants to merge 160 commits into
base: thumbnailer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
b18a84a
Merge pull request #9 from cutefishos/thumbnailer
reionwong Jul 24, 2021
7996e01
Github action
reionwong Jul 25, 2021
164219a
Compatible with Qt 5.12
reionwong Jul 25, 2021
23fb2d1
Delete .github directory
reionwong Jul 26, 2021
8d0eaf1
Improve desktop view drag
reionwong Jul 26, 2021
3fd826e
Improve thumbnail generation
reionwong Jul 27, 2021
a998391
Translated using Weblate (French)
weblate Jul 25, 2021
411f013
Fix thumbnail memory leak
reionwong Jul 27, 2021
a8c1fab
Merge branch 'main' of github.com:cutefishos/filemanager
reionwong Jul 27, 2021
211a442
Add management app
reionwong Jul 28, 2021
db01805
Binary executable
reionwong Jul 28, 2021
8f9b973
Reconstructed the file properties dialog
reionwong Jul 29, 2021
a57f67c
Add open with dialog
reionwong Jul 29, 2021
e5cfe33
OpenWith: Double click to open the app
reionwong Jul 29, 2021
1f199ca
feat: more actions in menu
ChungZH Aug 3, 2021
74b1a2e
Merge pull request #12 from ChungZH/menu
reionwong Aug 3, 2021
3c2c3b5
Fix icons display
reionwong Aug 8, 2021
93cf9c5
Translated using Weblate (Portuguese (Portugal))
weblate Aug 9, 2021
9699904
Added translation using Weblate (Arabic)
weblate Aug 13, 2021
ce3200b
Use CMAKE_INSTALL_BINDIR instead of hardcoded path
s0dyy Aug 14, 2021
fa88d64
Merge pull request #13 from s0dyy/main
reionwong Aug 14, 2021
9a14fa5
Translated using Weblate (Ukrainian)
weblate Aug 14, 2021
dede872
Window icon
reionwong Aug 17, 2021
c5eccde
Fix property window crash
reionwong Aug 17, 2021
4868a2e
Fix OpenWithDialog icon
reionwong Aug 17, 2021
44450eb
Translated using Weblate (Swahili)
weblate Aug 17, 2021
b59db2f
SideBar: Add section
reionwong Aug 17, 2021
6258819
Merge branch 'main' of github.com:cutefishos/filemanager
reionwong Aug 17, 2021
90e609a
Update translations
reionwong Aug 17, 2021
152a537
Open mode applications skip terminal
reionwong Aug 18, 2021
4d9ba4c
Fix Removable device category
reionwong Aug 26, 2021
b71654d
Translated using Weblate (Russian)
weblate Aug 28, 2021
6bc8fb4
Create build.yml
reionwong Aug 30, 2021
a642553
Fix a compilation error in Qt5.14
reionwong Aug 30, 2021
f1477a4
Merge branch 'main' of github.com:cutefishos/filemanager
reionwong Aug 30, 2021
8c1c20e
Fix a compilation error in Qt5.14
reionwong Aug 30, 2021
9811e89
Fix solid 5.71
reionwong Aug 30, 2021
da50d4f
Fix solid 5.71
reionwong Aug 30, 2021
bbfc13e
Fix solid
reionwong Aug 30, 2021
b8b560d
Fix filepropertiesdialog error
reionwong Aug 30, 2021
54a19a9
Add kwindowsystem
reionwong Aug 30, 2021
c26e825
Fix pathhistory
reionwong Aug 30, 2021
a11f2aa
Fix qt endl
reionwong Aug 30, 2021
07bd11d
Update build.yml
reionwong Aug 30, 2021
99b76af
Sort Mode finished
reionwong Aug 31, 2021
d317bba
Merge branch 'main' of github.com:cutefishos/filemanager
reionwong Aug 31, 2021
d74c013
Update
reionwong Aug 31, 2021
631a453
Error notification
reionwong Aug 31, 2021
504473b
Update translations
reionwong Aug 31, 2021
a3017da
Fix build
reionwong Sep 1, 2021
680b142
Fix ubuntu build
reionwong Sep 1, 2021
6c0463d
Fix Qt5.14 compilation
reionwong Sep 1, 2021
dfb4e6f
Translated using Weblate (Chinese (Simplified))
weblate Sep 1, 2021
422fc5d
Add trash restore option
reionwong Sep 3, 2021
794f9ed
Add delete confirm dialog
reionwong Sep 3, 2021
4270230
Translated using Weblate (Lithuanian)
weblate Sep 3, 2021
60884f1
Update translations
reionwong Sep 3, 2021
5e18359
Add basic CIO(Cutefish IO)
reionwong Sep 3, 2021
3c389e7
Multi screen support
reionwong Sep 5, 2021
4d22dac
Using dock margins
reionwong Sep 8, 2021
a2764dc
Translated using Weblate (Arabic)
weblate Sep 7, 2021
d003a8d
Improved desktop margins
reionwong Sep 11, 2021
c3d9515
Translated using Weblate (Latvian)
weblate Sep 12, 2021
e6eedc3
Add show hidden files
reionwong Sep 12, 2021
ff1c006
Optimize open default apps
reionwong Sep 13, 2021
b8d2a0e
Improve name selection area UI
reionwong Sep 14, 2021
15005d6
Translated using Weblate (Polish)
weblate Sep 14, 2021
10ee6ff
Update interface name
reionwong Sep 15, 2021
a324a3b
Update debian
reionwong Sep 16, 2021
8587b0c
Support keyboard search selection
reionwong Sep 20, 2021
84edf40
Fix property dialog size
reionwong Sep 20, 2021
8418faf
Fix property dialog size
reionwong Sep 20, 2021
6c185ab
Translated using Weblate (Serbian)
weblate Sep 24, 2021
84f1810
Update build.yml
reionwong Sep 25, 2021
8066ac9
Update build.yml
reionwong Sep 25, 2021
6d73bb2
Improve startup speed and use single instance process
reionwong Sep 26, 2021
c0b4e21
Merge branch 'main' of github.com:cutefishos/filemanager
reionwong Sep 26, 2021
457da12
Menubar's exit option closes only the current window
reionwong Sep 26, 2021
5b748d3
Add freedesktop interface
reionwong Sep 26, 2021
becd1c3
Fix uri
reionwong Sep 26, 2021
683f5a2
Fix failed to open trash://
reionwong Sep 26, 2021
48056de
Fix desktop margins
reionwong Sep 27, 2021
b0a06e9
Optimize the logic for selecting file sizes
reionwong Sep 27, 2021
fefbe8a
Fix current url
reionwong Sep 27, 2021
3a4257c
Fix keyboard search
reionwong Sep 28, 2021
a5a9f7c
Translated using Weblate (Russian)
weblate Oct 4, 2021
ace426f
Open in new window
reionwong Oct 4, 2021
8fb4812
Update 0.5.1
reionwong Oct 9, 2021
7d2274c
Fix background opacity
reionwong Oct 14, 2021
8ede4f8
Translated using Weblate (Japanese)
weblate Oct 8, 2021
bbcbe40
Reduce memory usage
reionwong Oct 15, 2021
48934e1
Translated using Weblate (Portuguese (Brazil))
weblate Oct 17, 2021
d091f6f
Add link symbol
reionwong Oct 22, 2021
08e58c6
Add shortcut key for ShowHiddenFiles
reionwong Oct 22, 2021
e4a3967
Add screenshot
reionwong Oct 25, 2021
7d36d98
Fix keyboard positioning
reionwong Oct 27, 2021
d4783df
Add about dialog
reionwong Oct 31, 2021
2d73338
Add drag and drop plugins
reionwong Nov 3, 2021
cad758b
Support drag and drop to move files
reionwong Nov 3, 2021
9cc0c4b
Fix desktop sort mode
reionwong Nov 5, 2021
c9e03b9
Adjust OpenWithDialog margins
reionwong Nov 11, 2021
8918480
Add busy indicator
reionwong Nov 14, 2021
368f7ee
Use system call
reionwong Nov 20, 2021
cfb270a
Update changelog
reionwong Nov 21, 2021
c059667
Translation : Added Hindi Translation
rajendrakumaryadav Nov 24, 2021
ad3407a
Improve Empty trash dialog
Nov 26, 2021
d06a97f
SideBar: Add content menu
Dec 2, 2021
02223a5
Add eject & umount options
Dec 2, 2021
bbd19e0
Fix sidebar clicked()
Dec 2, 2021
6ace2da
Scroll to current item after search
Dec 5, 2021
94ecc56
Support for opening and displaying desktop files
Dec 5, 2021
7551ff9
Fix desktop file display name
Dec 14, 2021
2dc6ba4
Update UI
Dec 16, 2021
0a5d31c
New UI
Dec 18, 2021
f846b46
Adjust file items UI
Dec 18, 2021
fb38d92
Update README and enable multi-threads build
HougeLangley Dec 20, 2021
dcc2cc6
Merge pull request #36 from HougeLangley/main
kateleet Dec 20, 2021
c3f3221
feat(shortcut): ctrl+w to close window
Dec 20, 2021
edd04ce
Merge branch 'main' of github.com:cutefishos/filemanager
Dec 20, 2021
1350b8d
Merge pull request #26 from rajendrakumaryadav/main
kateleet Dec 20, 2021
3b2ac9a
fix: bottom bar
Dec 20, 2021
248c1de
fix(qml): a warning
Dec 20, 2021
c026d3a
feat: adjust hover color
Dec 21, 2021
3dd4433
fix: crash when switching view
Dec 21, 2021
a563003
fix: open current dir
Dec 23, 2021
1eb918b
feat: add moveToTrash interface
Dec 26, 2021
7592e04
feat(short): support undo
Dec 26, 2021
d6bbf7c
fix(trash): update folder
Dec 26, 2021
add106c
fix(trash): menu options
Dec 26, 2021
f7ff4e1
feat: new folder new interaction, no popup dialog
Dec 26, 2021
f89af80
fix: sidebar umount
Dec 26, 2021
b1a1061
feat(sidebar): add a new name for the local disk
Dec 26, 2021
d733c9d
feat: add new documents option
Dec 26, 2021
3ba1d05
fix: new text file
Dec 26, 2021
9315be2
fix: new text file visible
Dec 27, 2021
a44856a
feat: release 0.7
Dec 27, 2021
ce716ac
fix: empty trash button visible
Dec 28, 2021
d2d3904
fix(menu): empty trash option visible
Dec 28, 2021
2a4727c
fix: path history
Dec 28, 2021
451b27c
fix: cut logic
Dec 28, 2021
46bd8a1
chore: use cutefish cutselection
Dec 28, 2021
7c01886
fix(trash): paste option visible
Dec 28, 2021
8319832
feat: select items after it has been pasted
Dec 31, 2021
7998c3d
fix: delete dialog
Jan 1, 2022
6f7c03b
fix: open in new window option visible
Jan 1, 2022
9c5b3bc
fix: cut option enabled
Jan 1, 2022
3a062c3
fix: pasted files selection interaction
Jan 16, 2022
5c450d5
fix: xdg folders rename
Jan 16, 2022
5a16f0e
fix(openWith): locale name
Jan 25, 2022
54d2f05
feat(openWithDialog): new UI
Jan 26, 2022
51eb065
fix: default app settings
Jan 26, 2022
0426b57
fix: default apps
Jan 26, 2022
908cfca
feat: sync setting terminal
Jan 28, 2022
4a7c5c3
feat: release 0.8
Jan 28, 2022
561b1ce
feat: optimize low configuration performance
reionwong Mar 28, 2022
03f44ef
fix: main screen switching
reionwong Mar 29, 2022
ebdbc07
including some vi shortcuts
EvanKoe May 5, 2022
16ae5a6
added H,J,K,L vi keybindings
EvanKoe May 10, 2022
056dc40
updated readme
EvanKoe May 10, 2022
6cb0e3c
working HJKL
EvanKoe May 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
debian:
name: Debian
runs-on: ubuntu-latest
container: docker.io/library/debian:sid
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Update repository
run: apt-get update -y
- name: Install the basic dev packages
run: apt-get install -y equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++
- name: Install build dependencies
run: mk-build-deps -i -t "apt-get --yes" -r
- name: Build Package
run: dpkg-buildpackage -b -uc -us -j$(nproc)

ubuntu:
name: Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v2
- name: Update repository
run: sudo apt-get update -y
- name: Install the basic dev packages
run: sudo apt-get install -y equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++
- name: Install build dependencies
run: sudo mk-build-deps -i -t "apt-get --yes" -r
- name: Build Package
run: dpkg-buildpackage -b -uc -us -j$(nproc)
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ compile_commands.json
*creator.user*

/build/*
.vscode
.vscode
tags
42 changes: 36 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,66 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Core DBus Quick LinguistTools REQUIRED)
find_package(FishUI REQUIRED)
# find_package(FishUI REQUIRED)

find_package(KF5KIO)
find_package(KF5Solid)
find_package(KF5WindowSystem)
find_package(KF5Config)

qt5_add_dbus_adaptor(DBUS_SOURCES
com.cutefish.FileManager.xml
application.h Application)

add_executable(cutefish-filemanager
main.cpp
application.cpp
window.cpp
dbusinterface.cpp

draganddrop/declarativedroparea.cpp
draganddrop/declarativedragdropevent.cpp
draganddrop/declarativemimedata.cpp

model/foldermodel.cpp
model/placesmodel.cpp
model/placesitem.cpp
model/pathbarmodel.cpp
model/dirlister.cpp
model/positioner.cpp

dialogs/propertiesdialog.cpp
cio/cfilejob.cpp
cio/cfilesizejob.cpp

dialogs/createfolderdialog.cpp
dialogs/filepropertiesdialog.cpp
dialogs/openwithdialog.cpp
widgets/rubberband.cpp
widgets/itemviewadapter.cpp

desktop/desktop.cpp
desktop/desktopview.cpp
desktop/desktopsettings.cpp
desktop/dockdbusinterface.cpp

helper/datehelper.cpp
helper/thumbnailer.cpp
helper/pathhistory.cpp
helper/fm.cpp
helper/shortcut.cpp
helper/thumbnailerjob.cpp
helper/filelauncher.cpp
helper/keyboardsearchmanager.cpp

mimetype/mimeappmanager.cpp
mimetype/xdgdesktopfile.cpp

thumbnailer/thumbnailprovider.cpp
thumbnailer/thumbnailcache.cpp

desktopiconprovider.cpp

qml.qrc

${DBUS_SOURCES}
)

target_link_libraries(cutefish-filemanager
Expand All @@ -56,15 +84,17 @@ target_link_libraries(cutefish-filemanager
KF5::KIOFileWidgets
KF5::KIOWidgets
KF5::Solid
KF5::WindowSystem
KF5::ConfigCore

FishUI
# FishUI
)

file(GLOB TS_FILES translations/*.ts)
qt5_create_translation(QM_FILES ${TS_FILES})
add_custom_target(translations DEPENDS ${QM_FILES} SOURCES ${TS_FILES})
add_dependencies(cutefish-filemanager translations)

install(TARGETS cutefish-filemanager RUNTIME DESTINATION /usr/bin)
install(TARGETS cutefish-filemanager RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES cutefish-filemanager.desktop DESTINATION "/usr/share/applications")
install(FILES ${QM_FILES} DESTINATION /usr/share/cutefish-filemanager/translations)
41 changes: 37 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# File Manager
# File Manager Vi version

Cutefish File Manager, simple to use, beautiful, and retain the classic PC interactive design.
Cutefish File Manager, simple to use, beautiful, and retain the classic PC interactive design.

On this branch, the Cutefish File Manager has an even easier way to browse your files thanks to the vi mode. Instead of the classical shortcuts, vim fans will be pleased to use some of the vim shortcuts to browse their files.

![screenshot](screenshots/Screenshot_20211025_151224.png)

## Dependencies

### Ubuntu

```
sudo apt install libkf5solid-dev libkf5kio-dev -y
sudo apt install equivs curl git devscripts lintian build-essential automake autotools-dev --no-install-recommends

sudo mk-build-deps -i -t "apt-get --yes" -r
```

### Debian

```
sudo apt install build-essential cmake extra-cmake-modules libkf5kio-dev libkf5solid-dev libkf5windowsystem-dev libkf5config-dev qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools
```

### ArchLinux
Expand All @@ -19,9 +31,10 @@ sudo pacman -S extra-cmake-modules qt5-base qt5-quickcontrols2 taglib kio
## Build

```shell
git checkout vi-mode
mkdir build
cd build
cmake ..
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
```

Expand All @@ -31,6 +44,26 @@ make
sudo make install
```

## Keybindings

Most of those keybindings are coming from Vim, but not all of them. Here is a list of them :
- h,j,k,l : directions,
- y : (yank) copy,
- p : paste here,
- r : rename,
- Return/Enter : open/launch,
- % : display hidden files,
- u : undo last change,
- d : cut,
- x : delete,
- q : close the window,
- a : refresh,
- colon (:) : focus path input,
- v : select all files,
- backspace : go back

> Developper info : all of these shortcuts are noted in `helper/shortcut.h`

## License

This project has been licensed by GPLv3.
182 changes: 182 additions & 0 deletions application.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: Reion Wong <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "application.h"
#include "dbusinterface.h"
#include "window.h"
#include "desktop/desktop.h"
#include "thumbnailer/thumbnailprovider.h"
#include "filemanageradaptor.h"

#include <QCommandLineParser>
#include <QQmlApplicationEngine>
#include <QQmlContext>

#include <QDBusConnection>
#include <QPixmapCache>
#include <QTranslator>
#include <QFileInfo>
#include <QIcon>
#include <QDir>

// KIO
#include <KIO/CopyJob>
#include <KIO/Job>
#include <KIO/PreviewJob>
#include <KIO/DeleteJob>
#include <KIO/DropJob>
#include <KIO/FileUndoManager>
#include <KIO/JobUiDelegate>
#include <KIO/Paste>
#include <KIO/PasteJob>
#include <KIO/RestoreJob>

Application::Application(int& argc, char** argv)
: QApplication(argc, argv)
, m_instance(false)
{
if (QDBusConnection::sessionBus().registerService("com.cutefish.FileManager")) {
setOrganizationName("cutefishos");
setWindowIcon(QIcon::fromTheme("file-manager"));

new FileManagerAdaptor(this);
new DBusInterface;
QDBusConnection::sessionBus().registerObject("/FileManager", this);

// Translations
QLocale locale;
QString qmFilePath = QString("%1/%2.qm").arg("/usr/share/cutefish-filemanager/translations/").arg(locale.name());
if (QFile::exists(qmFilePath)) {
QTranslator *translator = new QTranslator(this);
if (translator->load(qmFilePath)) {
installTranslator(translator);
} else {
translator->deleteLater();
}
}

m_instance = true;
}
}

int Application::run()
{
if (!parseCommandLineArgs())
return 0;

return QApplication::exec();
}

void Application::openFiles(const QStringList &paths)
{
for (const QString &path : paths) {
openWindow(path);
}
}

void Application::moveToTrash(const QStringList &paths)
{
if (paths.isEmpty())
return;

QList<QUrl> urls;

for (const QString &path : paths) {
urls.append(QUrl::fromLocalFile(path));
}

KIO::Job *job = KIO::trash(urls);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, urls, QUrl(QStringLiteral("trash:/")), job);
}

void Application::emptyTrash()
{
Window *w = new Window;
w->load(QUrl("qrc:/qml/Dialogs/EmptyTrashDialog.qml"));
}

void Application::openWindow(const QString &path)
{
Window *w = new Window;
w->rootContext()->setContextProperty("arg", path);
w->addImageProvider("thumbnailer", new ThumbnailProvider());
w->load(QUrl("qrc:/qml/main.qml"));
}

QStringList Application::formatUriList(const QStringList &list)
{
QStringList val;

for (const QString &path : list) {
val.append(path == "." ? QDir::currentPath() : path);
}

if (val.isEmpty()) {
val.append(QDir::currentPath());
}

return val;
}

bool Application::parseCommandLineArgs()
{
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("File Manager"));
parser.addHelpOption();

parser.addPositionalArgument("files", "Files", "[FILE1, FILE2,...]");

QCommandLineOption desktopOption(QStringList() << "d" << "desktop" << "Desktop Mode");
parser.addOption(desktopOption);

QCommandLineOption emptyTrashOption(QStringList() << "e" << "empty-trash" << "Empty Trash");
parser.addOption(emptyTrashOption);

QCommandLineOption moveToTrashOption(QStringList() << "mtr" << "move-to-trash" << "Move To Trash");
parser.addOption(moveToTrashOption);

parser.process(arguments());

if (m_instance) {
QPixmapCache::setCacheLimit(2048);

if (parser.isSet(desktopOption)) {
Desktop desktop;
} else {
openFiles(formatUriList(parser.positionalArguments()));
}
} else {
QDBusInterface iface("com.cutefish.FileManager",
"/FileManager",
"com.cutefish.FileManager",
QDBusConnection::sessionBus(), this);

if (parser.isSet(emptyTrashOption)) {
// Empty Dialog
iface.call("emptyTrash");
} else if (parser.isSet(moveToTrashOption)) {
iface.call("moveToTrash", parser.positionalArguments());
} else {
iface.call("openFiles", formatUriList(parser.positionalArguments()));
}
}

return m_instance;
}
Loading