You are not logged in.

#1 2024-09-16 13:28:01

Wandering-Magi
Member
Registered: 2024-09-16
Posts: 5

Configuring MIME for dotfile

Just migrated over to base arch from Garuda in the last week. Decided to take off the training wheels after 2 years.

I'm running i3 as my WM, Alacritty as the terminal, and Ranger as the file explorer.

Currently I'm trying to configure my dpi in .xinitrc because the scaling of some apps is off. I've created/put it in ~/.config/X11/xorg.conf.d/. Now, I can open it in neovim by navigating there via "cd" or "nvim /...", but when trying to open it in Ranger, it tries to open it in a browser via xdg:

/usr/bin/xdg-open: line 1045: x-www-browser: command not found
/usr/bin/xdg-open: line 1045: firefox: command not found
/usr/bin/xdg-open: line 1045: iceweasel: command not found
/usr/bin/xdg-open: line 1045: seamonkey: command not found
/usr/bin/xdg-open: line 1045: mozilla: command not found
/usr/bin/xdg-open: line 1045: epiphany: command not found
/usr/bin/xdg-open: line 1045: konqueror: command not found
/usr/bin/xdg-open: line 1045: chromium: command not found
/usr/bin/xdg-open: line 1045: chromium-browser: command not found
/usr/bin/xdg-open: line 1045: google-chrome: command not found
/usr/bin/xdg-open: line 1045: www-browser: command not found
/usr/bin/xdg-open: line 1045: links2: command not found
/usr/bin/xdg-open: line 1045: elinks: command not found
/usr/bin/xdg-open: line 1045: links: command not found
/usr/bin/xdg-open: line 1045: lynx: command not found
/usr/bin/xdg-open: line 1045: w3m: command not found
xdg-open: no method available for opening '/home/magi/.config/X11/xorg.conf.d/.xinitrc'

Which, interestingly enough, it fails to do because I'm using Vivaldi as my web browser.
Some poking around has pointed me in the direction of MIME configurations, and that I should be setting up a mime config in ~/.config/mimeapps.list, which doesn't exist so I'll have to make one. It wasn't in any of the usual spots listed in the wiki and the only mime config I could find was in /usr/share/applications/mimeinfo.cache, but I'm lead to understand editing that is a fools errand as it gets replaced on updates.

But trying to get any more specific information about setting mime types for dotfile/config files has been useless. It just leads me to a lot of posts talking about/posting configs and dotfiles for mime/nvim/ranger/etc. but not a solution to this problem.
Is there any way to add neovim as a fallback for any general/empty filetype that Ranger doesn't know how to open? Or, assuming that's a solution born of ignorance, a better way to solve this problem?

Last edited by Wandering-Magi (2024-09-16 13:30:02)

Offline

#2 2024-09-17 12:59:32

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,060

Re: Configuring MIME for dotfile

As far as I kinow there is no mimetype for dot-files .

What are the outputs of

$ xdg-mime query filetype /path/to/file
$ xdg-mime query default <insert output of previous command>

for that xinitrc file ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2024-09-17 13:47:19

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,821

Re: Configuring MIME for dotfile

◉ xdg-mime query filetype ~/.xinitrc                    
text/x-shellscript

Post the xinitrc…

Offline

#4 2024-09-17 14:38:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: Configuring MIME for dotfile

Lone_Wolf wrote:

As far as I kinow there is no mimetype for dot-files

No, but a lot of related tools default to using a web browser for the default / catch-all handler for unrecongized types.  This is a ridiculous design choice.  Switching this to using an editor as a default is a very sensible goal, and that's how I understood the OP's question.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2024-09-18 04:56:18

Wandering-Magi
Member
Registered: 2024-09-16
Posts: 5

Re: Configuring MIME for dotfile

$ xdg-mime query filetype ~/.config/X11/xorg.conf.d/.xinitrc
inode/x-empty
$ xdg-mime query default inode/x-empty

Returns nothing, which is probably why it's going to a browser as the fallback.

The .xinitrc itself is empty, as I haven't put anything in it yet.

Trilby wrote:

Switching this to using an editor as a default is a very sensible goal, and that's how I understood the OP's question.

Exactly; If I can set the default fallback for generic/empty/unknown filetypes to neovim instead of a browser it would probably be for the best. Even if I had a recognized browser, it would be (mostly) useless to just output the text in a browser. In the mean time I've been using:

:open-with nvim

As a stop gap.

Offline

#6 2024-09-18 06:22:58

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,821

Re: Configuring MIME for dotfile

xdg-mime default nvim.desktop inode/x-empty

xdg-open parses $BROWSER, but that's probably not a good idea to tamper with b/c you'll open urls with that.

Offline

Board footer

Powered by FluxBB