diff --git a/programs/other/tte/notify.h b/programs/other/tte/notify.h
new file mode 100755
index 0000000000..f84b3adeba
--- /dev/null
+++ b/programs/other/tte/notify.h
@@ -0,0 +1,29 @@
+typedef unsigned int uint32_t;
+
+static inline
+int start_app(char *app_name, char *args){
+ #pragma pack(push, 1)
+ struct file_op_t
+ {
+ uint32_t fn;
+ uint32_t flags;
+ char* args;
+ uint32_t res1, res2;
+ char zero;
+ char* app_name __attribute__((packed));
+ } file_op;
+ #pragma pack(pop)
+ memset(&file_op, 0, sizeof(file_op));
+ file_op.fn = 7;
+ file_op.args = args;
+ file_op.app_name = app_name;
+
+ register int val;
+ asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op));
+
+ return val;
+}
+
+void notify(char *text) {
+ start_app("/sys/@notify", text);
+}
diff --git a/programs/other/tte/tte.c b/programs/other/tte/tte.c
index 83c6acacf4..35d31c5ea4 100644
--- a/programs/other/tte/tte.c
+++ b/programs/other/tte/tte.c
@@ -14,9 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+
/* Kolibri port by Siemargl 2018 and update by maxcodehack 2020
* my fixes mostly commented with triple comment ///
- * */
+ */
/*** Include section ***/
@@ -45,6 +46,8 @@
///#include
#include
+/// Notify
+#include "notify.h"
/*** Define section ***/
@@ -1723,7 +1726,8 @@ void initEditor() {
}
void printHelp() {
- printf("Usage: tte [OPTIONS] [FILE]\n\n");
+/*
+ printf("Usage: tte [OPTIONS] [FILE]\n\n");
printf("\nKEYBINDINGS\n-----------\n\n");
printf("Keybinding\t\tAction\n\n");
printf("Ctrl-Q,^Z \t\tExit\n");
@@ -1734,7 +1738,7 @@ void printHelp() {
printf("Ctrl-C \t\tCopy line\n");
printf("Ctrl-X \t\tCut line\n");
printf("Ctrl-V \t\tPaste line\n");
- /// printf("Ctrl-P \t\tPause tte (type \"fg\" to resume)\n");
+/// printf("Ctrl-P \t\tPause tte (type \"fg\" to resume)\n");
printf("\n\nOPTIONS\n-------\n\n");
printf("Option \t\tAction\n\n");
@@ -1742,6 +1746,29 @@ void printHelp() {
printf("-v | --version\t\tPrints the version of tte\n");
printf("\n\nFor now, usage of ISO 8859-1 is recommended.\n");
+*/
+
+ /// NOTIFY HOTKEYS
+ char* __help__ =
+ "'Hotkeys: \n\
+^Q, ^Z Exit \n\
+Ctrl-S Save \n\
+Ctrl-F Search. Esc, \n\
+ enter and arrows to interact once searching \n\
+Ctrl-E Flip line upwards \n\
+Ctrl-D Flip line downwards \n\
+Ctrl-C Copy line \n\
+Ctrl-X Cut line \n\
+Ctrl-V Paste line' -t -I";
+ notify(__help__);
+
+ /// NOTIFY OPTIONS
+ __help__ =
+ "'Options:\n\
+-h, --help Prints the help \n\
+-v, --version Prints the version of tte \n\
+For now, usage of ISO 8859-1 is recommended.\n' -t -I";
+ notify(__help__);
}
// 1 if editor should open, 0 otherwise, -1 if the program should exit
@@ -1754,7 +1781,11 @@ int handleArgs(int argc, char* argv[]) {
printHelp();
return -1;
} else if(strncmp("-v", argv[1], 2) == 0 || strncmp("--version", argv[1], 9) == 0) {
- printf("tte - version %s\n", TTE_VERSION);
+ char* _notify_version = "'Version:\n";
+ strcat(_notify_version, TTE_VERSION);
+ strcat(_notify_version, "' -t -I");
+ /// printf("tte - version %s\n", TTE_VERSION);
+ notify(_notify_version);
return -1;
}
}