1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

feat(Notepad): add notepad desktop entry & IPC commands file handling

This commit is contained in:
purian23
2026-07-04 16:10:56 -04:00
parent bfda5f2d66
commit 81a4d3b4e0
23 changed files with 129 additions and 1 deletions
+19
View File
@@ -212,6 +212,25 @@ Item {
});
}
function openExternalFile(path) {
if (!path)
return;
for (var i = 0; i < NotepadStorageService.tabs.length; i++) {
var tab = NotepadStorageService.tabs[i];
if (tab && !tab.isTemporary && tab.filePath === path) {
textEditor.autoSaveToSession();
switchToTab(i);
return;
}
}
textEditor.autoSaveToSession();
NotepadStorageService.createTabForFile(path);
root.currentFileName = path.split('/').pop();
root.currentFileUrl = "file://" + path;
}
function loadFromFile(fileUrl) {
if (hasUnsavedChanges()) {
root.pendingFileUrl = fileUrl;
@@ -9,6 +9,7 @@ FloatingWindow {
id: win
property alias shouldBeVisible: win.visible
property alias notepad: notepad
function show() {
visible = true;
@@ -41,7 +41,7 @@ Item {
readonly property var mimeMapping: ({
[root.appCategory.WebBrowser]: ["x-scheme-handler/https", "x-scheme-handler/http", "text/html", "application/xhtml+xml"],
[root.appCategory.FileManager]: ["inode/directory", "x-scheme-handler/file"],
[root.appCategory.TextEditor]: ["text/plain", "application/x-zerosize", "text/x-c++src", "text/x-csrc", "text/x-python", "text/x-shellscript", "application/json"],
[root.appCategory.TextEditor]: ["text/plain", "text/markdown", "application/x-zerosize", "text/x-c++src", "text/x-csrc", "text/x-python", "text/x-shellscript", "application/json"],
[root.appCategory.ImageViewer]: ["image/png", "image/jpeg", "image/gif", "image/bmp", "image/webp", "image/avif", "image/svg+xml"],
[root.appCategory.VideoPlayer]: ["video/mp4", "video/x-matroska", "video/webm", "video/avi", "video/mpeg", "video/quicktime", "video/x-msvideo"],
[root.appCategory.MusicPlayer]: ["audio/mpeg", "audio/x-flac", "audio/wav", "audio/ogg", "audio/aac", "audio/webm"],