feat: Added New File option to the GNOME launcher and a --new cli option
This commit is contained in:
parent
1c305ca762
commit
4a916ebb89
6
dist/imhex.desktop
vendored
6
dist/imhex.desktop
vendored
@ -1,4 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=ImHex
|
||||
Comment=ImHex Hex Editor
|
||||
GenericName=Hex Editor
|
||||
@ -10,3 +11,8 @@ Categories=Development;IDE;
|
||||
StartupWMClass=imhex
|
||||
Keywords=static-analysis;reverse-engineering;disassembler;disassembly;hacking;forensics;hex-editor;cybersecurity;security;binary-analysis;
|
||||
MimeType=application/vnd.imhex.proj;
|
||||
Actions=NewFile;
|
||||
|
||||
[Desktop Action NewFile]
|
||||
Exec=imhex --new
|
||||
Name=Create New File
|
@ -12,6 +12,7 @@ namespace hex::plugin::builtin {
|
||||
void handleVerboseCommand(const std::vector<std::string> &args);
|
||||
|
||||
void handleOpenCommand(const std::vector<std::string> &args);
|
||||
void handleNewCommand(const std::vector<std::string> &args);
|
||||
|
||||
void handleCalcCommand(const std::vector<std::string> &args);
|
||||
void handleHashCommand(const std::vector<std::string> &args);
|
||||
|
@ -116,6 +116,10 @@ namespace hex::plugin::builtin {
|
||||
hex::subcommands::forwardSubCommand("open", fullPaths);
|
||||
}
|
||||
|
||||
void handleNewCommand(const std::vector<std::string> &) {
|
||||
hex::subcommands::forwardSubCommand("new", {});
|
||||
}
|
||||
|
||||
void handleCalcCommand(const std::vector<std::string> &args) {
|
||||
if (args.empty()) {
|
||||
hex::log::println("No expression provided!");
|
||||
@ -386,6 +390,10 @@ namespace hex::plugin::builtin {
|
||||
RequestOpenFile::post(arg);
|
||||
}
|
||||
});
|
||||
|
||||
hex::subcommands::registerSubCommand("new", [](const std::vector<std::string> &){
|
||||
RequestOpenWindow::post("Create File");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -66,6 +66,7 @@ IMHEX_PLUGIN_SUBCOMMANDS() {
|
||||
{ "verbose", "v", "Enables verbose debug logging", hex::plugin::builtin::handleVerboseCommand },
|
||||
|
||||
{ "open", "o", "Open files passed as argument. [default]", hex::plugin::builtin::handleOpenCommand },
|
||||
{ "new", "n", "Create a new empty file", hex::plugin::builtin::handleNewCommand },
|
||||
|
||||
{ "calc", "", "Evaluate a mathematical expression", hex::plugin::builtin::handleCalcCommand },
|
||||
{ "hash", "", "Calculate the hash of a file", hex::plugin::builtin::handleHashCommand },
|
||||
|
Loading…
x
Reference in New Issue
Block a user