You are not logged in.

#1 2021-02-28 16:30:38

madrafa
Member
Registered: 2021-02-19
Posts: 34

[SOLVED] nvim.desktop doesn't work in file manager.

I'm using bspwm with a few GUI programs, one of them thunar (file manager). However opening text files from thunar doesn't open nvim. Here are the settings:

$ xdg-mime query default text/plain
nvim.desktop

nvim.desktop file:

[Desktop Entry]
Name=Neovim
GenericName=Text Editor
GenericName[de]=Texteditor
Comment=Edit text files
Comment[af]=Redigeer tekslêers
Comment[am]=የጽሑፍ ፋይሎች ያስተካክሉ
Comment[ar]=حرّر ملفات نصية
Comment[az]=Mətn fayllarını redaktə edin
Comment[be]=Рэдагаваньне тэкставых файлаў
Comment[bg]=Редактиране на текстови файлове
Comment[bn]=টেক্স্ট ফাইল এডিট করুন
Comment[bs]=Izmijeni tekstualne datoteke
Comment[ca]=Edita fitxers de text
Comment[cs]=Úprava textových souborů
Comment[cy]=Golygu ffeiliau testun
Comment[da]=Redigér tekstfiler
Comment[de]=Textdateien bearbeiten
Comment[el]=Επεξεργασία αρχείων κειμένου
Comment[en_CA]=Edit text files
Comment[en_GB]=Edit text files
Comment[es]=Edita archivos de texto
Comment[et]=Redigeeri tekstifaile
Comment[eu]=Editatu testu-fitxategiak
Comment[fa]=ویرایش پروندههای متنی
Comment[fi]=Muokkaa tekstitiedostoja
Comment[fr]=Édite des fichiers texte
Comment[ga]=Eagar comhad Téacs
Comment[gu]=લખાણ ફાઇલોમાં ફેરફાર કરો
Comment[he]=ערוך קבצי טקסט
Comment[hi]=पाठ फ़ाइलें संपादित करें
Comment[hr]=Uređivanje tekstualne datoteke
Comment[hu]=Szövegfájlok szerkesztése
Comment[id]=Edit file teks
Comment[it]=Modifica file di testo
Comment[ja]=テキストファイルを編集します
Comment[kn]=ಪಠ್ಯ ಕಡತಗಳನ್ನು ಸಂಪಾದಿಸು
Comment[ko]=텍스트 파일을 편집합니다
Comment[lt]=Redaguoti tekstines bylas
Comment[lv]=Rediģēt teksta failus
Comment[mk]=Уреди текстуални фајлови
Comment[ml]=വാചക രചനകള് തിരുത്തുക
Comment[mn]=Текст файл боловсруулах
Comment[mr]=गद्य फाइल संपादित करा
Comment[ms]=Edit fail teks
Comment[nb]=Rediger tekstfiler
Comment[ne]=पाठ फाइललाई संशोधन गर्नुहोस्
Comment[nl]=Tekstbestanden bewerken
Comment[nn]=Rediger tekstfiler
Comment[no]=Rediger tekstfiler
Comment[or]=ପାଠ୍ଯ ଫାଇଲଗୁଡ଼ିକୁ ସମ୍ପାଦନ କରନ୍ତୁ
Comment[pa]=ਪਾਠ ਫਾਇਲਾਂ ਸੰਪਾਦਨ
Comment[pl]=Edytor plików tekstowych
Comment[pt]=Editar ficheiros de texto
Comment[pt_BR]=Edite arquivos de texto
Comment[ro]=Editare fişiere text
Comment[ru]=Редактор текстовых файлов
Comment[sk]=Úprava textových súborov
Comment[sl]=Urejanje datotek z besedili
Comment[sq]=Përpuno files teksti
Comment[sr]=Измени текстуалне датотеке
Comment[sr@Latn]=Izmeni tekstualne datoteke
Comment[sv]=Redigera textfiler
Comment[ta]=உரை கோப்புகளை தொகுக்கவும்
Comment[th]=แก้ไขแฟ้มข้อความ
Comment[tk]=Metin faýllary editle
Comment[tr]=Metin dosyalarını düzenle
Comment[uk]=Редактор текстових файлів
Comment[vi]=Soạn thảo tập tin văn bản
Comment[wa]=Asspougnî des fitchîs tecses
Comment[zh_CN]=编辑文本文件
Comment[zh_TW]=編輯文字檔
TryExec=nvim
Exec=nvim %F
Terminal=true
Type=Application
Keywords=Text;editor;
Icon=nvim
Categories=Utility;TextEditor;
StartupNotify=false
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;

What I've tried:

1. TryExec=nvim %F
2. Exec=$TERMINAL -e nvim
3. commenting out TryExec and just leaving Exec
4. TryExec=/usr/bin/nvim
5. Exec=/user/bin/nvim %F
6. And a bunch of other combinations that I don't even remember...

None of what I've tried works. Also, if I open nvim from rofi with the -drun option. It works just fine, it's on a file manager that doesn't work. I've tried others file managers too and it doesn't work. And finally if I open others kind of files from thunar, like png, it also works just fine. The default the I have for images is sxiv and I have no problem whatsoever opening images from thunar, it's only nvim or vim the problem.

Last edited by madrafa (2021-03-05 00:40:47)

Offline

#2 2021-02-28 17:03:48

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: [SOLVED] nvim.desktop doesn't work in file manager.

Have you ensured that the files you tried opening are really text/plain (or any of the ones that are matched in the MimeType line)?

Check with

xdg-mime query filetype {problematic file}

pkgshackscfgblag

Offline

#3 2021-02-28 20:07:45

madrafa
Member
Registered: 2021-02-19
Posts: 34

Re: [SOLVED] nvim.desktop doesn't work in file manager.

yes they are text/plain files 100% sure, I've already checked with

xdg-mime query filetype {problematic file}

Offline

#4 2021-02-28 21:21:27

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: [SOLVED] nvim.desktop doesn't work in file manager.

Does the following work?

xdg-open {file}

More importantly, though: does Thunar even know what to do with an application that runs in a terminal? From what I can find online, you have to launch a terminal and pass the nvim command to that (otherwise nvim can't really "show" anything).

With urxvt, this is what I do: https://github.com/ayekat/utils/blob/master/bin/xvim (+ a minimal Desktop file).


pkgshackscfgblag

Offline

#5 2021-03-05 00:40:21

madrafa
Member
Registered: 2021-02-19
Posts: 34

Re: [SOLVED] nvim.desktop doesn't work in file manager.

I solved this by setting terminal to false in the nvim desktop. Don't know why it works, but it does.

Offline

Board footer

Powered by FluxBB