bin: create xdg-mime-file to edit mimeapps

This commit is contained in:
xeruf 2022-06-01 01:01:54 +02:00
parent 179fd73cf7
commit 58e1f64f8a
3 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,5 @@
[Added Associations]
application/java-archive=org.kde.ark.desktop;
application/pdf=org.kde.okular.desktop;
application/rss+xml=nvim.desktop;
application/x-java-archive=java-2.desktop;java.desktop;jconsole-java11-openjdk.desktop;
application/x-ms-shortcut=firefox.desktop;
@ -20,7 +19,7 @@ text/plain=nvim.desktop;emacs.desktop;okularApplication_txt.desktop;
x-scheme-handler/tg=telegram.desktop;
[Default Applications]
application/pdf=org.kde.okular.desktop;
application/pdf=org.pwmt.zathura.desktop;
application/x-java-archive=java-2.desktop;
application/x-ms-shortcut=firefox.desktop;
application/x-mswinurl=firefox.desktop;

View File

@ -17,7 +17,7 @@ test "$1" = "-v" &&
set -eo xtrace &&
shift
inspect=false
# Show file info without preview
# inspect: Show file info without preview
test "$1" = "-i" &&
inspect=true &&
shift
@ -30,7 +30,7 @@ fileinfo() {
tput setaf 6
for arg
do case "$arg" in (-*) continue;; esac
$elevate file -E "$arg"
$elevate file --exclude elf -E "$arg"
# TODO do not grep bitrate but extract properly
#probe="$($elevate ffprobe "$arg" 2>&1)"
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&

View File

@ -0,0 +1,9 @@
#!/bin/sh -e
# Use xdg-mime with a file's mime type
xdg-mime query default "$(xdg-mime query filetype "$1")"
test $# -gt 1 &&
desktop="$(find /usr/share/applications -name "*$2*" | fzf -0 -1)" &&
xdg-mime default "$desktop" "$(xdg-mime query filetype "$1")" &&
echo -n "Updated to: " &&
xdg-mime query default "$(xdg-mime query filetype "$1")"
# || echo "Cannot find application $2 in /usr/share/applications!"