You are not logged in.
actually, I think you dont need xdg-utils anymore.
repo:https://github.com/taylorchu/mimi
aur:https://aur.archlinux.org/packages.php?ID=56438
important
how to setup default application
create a file ~/.config/mimi/mime.conf
in this file, it is your time to be creative
this is what i have:
text/html: chromium
image/png:feh
image/*:feh
note: you have to put "default" in this file. it should be a file manager. mimi will try to call the file manager to open the file's path if you did not tell mimi who to call!
Enjoy!!
Last edited by taylorchu (2012-11-29 09:56:17)
"After you do enough distro research, you will choose Arch."
Offline
Good idea!
I edited it a bit to handle websites
# $1 = Program
# $2 = Filename
launch() {
program="$1"
[ "$program" ] || program="$(grep "^default:" "$CONFIG" | cut -d : -f 2)"
"$program" "$2"
exit 0
}
CONFIG="$HOME/.config/mimi/mime.conf"
main() {
[[ -f "$CONFIG" ]] || err "No configuration file found."
filename="$@"
if [[ ! -f "$filename" ]]; then
[[ "$filename" == http://* ]] && launch "$BROWSER" "$filename"
[[ "$filename" == www.* ]] && launch "$BROWSER" "$filename"
filename=${filename##file://}
[[ -d "$filename" ]] || [[ -f "$filename" ]] || err "The file does not exist."
launch "" "$filename" # it's a directory or file with file:// syntax, try launching with 'default'
fi
ext=${filename##*.}
path=${filename%/*}
program=$(grep "^$ext:" "$CONFIG" | cut -d : -f 2)
launch "$program" "$filename"
}
main "$@"
E: Only check website if file does not exist (you can have file called www.google.fi, if you want)
E2: Add the missing bits and make it handle file:// syntax too, also make it open directories
Last edited by Cloudef (2012-02-06 09:01:15)
Offline
Nice idea! I'll give it a try!
Offline
Just wanted to say thank you.
Being able to explicitly enable certain behavior instead of it trying to guess is exactly what I've been looking for.
Now I can choose what opens with what and build the list as I intend.
Thank you
Last edited by Earnestly (2012-02-06 12:36:43)
Offline
Very nice idea ! Will look into it !
Thanks
Offline
This looks pretty interesting especially since I don't have Thunar on my laptop. I edited it a bit to include Clouddef's modification and additional mime-type support detected using file.
# $1 = Program
# $2 = Filename
launch() {
program="$1"
[ "$program" ] || program=$(grep "^$(file -b --mime-type ${2}):" "$CONFIG" | cut -d : -f 2) \
|| program="$(grep "^default:" "$CONFIG" | cut -d : -f 2)"
"$program" "$2"
exit 0
}
CONFIG="$HOME/.config/mimi/mime.conf"
main() {
[[ -f "$CONFIG" ]] || err "No configuration file found."
filename="$@"
if [[ ! -f "$filename" ]]; then
[[ "$filename" == http://* ]] && launch "$BROWSER" "$filename"
[[ "$filename" == www.* ]] && launch "$BROWSER" "$filename"
filename=${filename##file://}
[[ -d "$filename" ]] || [[ -f "$filename" ]] || err "The file does not exist."
launch "" "$filename" # it's a directory or file with file:// syntax, try launching with 'default'
fi
ext=${filename##*.}
path=${filename%/*}
program=$(grep "^$ext:" "$CONFIG" | cut -d : -f 2)
launch "$program" "$filename"
}
main "$@"
For every problem, there is a solution that is:
Clean
Simple and most of all...wrong!
Github page
Offline
i dont like mime so much because it needs to be looked up. in contrast, file ext is so easy to setup.
this app will be included in my live cd: march, along with "3x+ battery life configuration".
did anyone try to contact xdg-open's author? original xdg-open does not work really well.
"After you do enough distro research, you will choose Arch."
Offline
I know this is an old thread, hopefully no one minds .
I really like this xdg-util alternative. I don't have to check what the mimetype is of certain files and it doesn't confuse the many different types of xml-like files.
There were just 2 features that lacked imo, directories and urls, so I've added them (https://github.com/taylorchu/mimi/pull/1). Could you pull these features in?
Offline
did anyone try to contact xdg-open's author? original xdg-open does not work really well.
No, but I wrote Mimeo.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
@FrozenCow
thanks so much.
some changes since we have the first release.
1. add "directory": this keyword handles a folder.
2. add support for protocol:
ftp:filezilla # can be run as "xdg-open ftp://somewebsite..."
http:firefox
magnet:urxvt -e rtorrent # support for magnet links; so awesome
Last edited by taylorchu (2012-03-23 02:29:41)
"After you do enough distro research, you will choose Arch."
Offline
is there a way of making pcmanfm respect this? will shellfm?
otherwise -- awesome !
Offline
I would gladly get rid of xdg-utils, but:
% pacqi xdg-utils
Name : xdg-utils
...
Required By : libreoffice-common qt skype
...
Offline
@Demon: I don't have xdg-utils and I do use libreoffice-common and qt :S
Offline
@el mariachi
it only affects programs that use xdg-open.
"After you do enough distro research, you will choose Arch."
Offline
Is there any way to make dwb use mimi for loading magnet links?
Offline
I am not able to install mimi from the Aur.
I get:
packer -S mimi
==> Determining latest git revision...
-> Version found: 20120413
==> Making package: mimi 20120413-1 (Sex Abr 13 11:47:49 WEST 2012)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving Sources...
==> Extracting Sources...
==> Removing existing pkg/ directory...
==> Entering fakeroot environment...
==> Starting build()...
==> Connecting to GIT server....
fatal: working tree '/home/tanso' already exists.
==> ERROR: A failure occurred in build().
Aborting...
The build failed.
Am I doing something wrong ? /home/tanso is my HOME directory.
Mekyub
Follow me on twitter: https://twitter.com/johnbina
Offline
@Mektub
There is something wrong with your git. I am really sure.
@everyone
now support files with no extension
:urxvt -e vim
This means that when there is no extension, call urxvt and run vim
previously the code has some bugs to prevent the behavior.
"After you do enough distro research, you will choose Arch."
Offline
@Mektub
There is something wrong with your git. I am really sure.
taylorchu,
you were absolutely right. I had several variables initialized from some testes I had done and completely forgotten.
Many thanks,
Mektub
Follow me on twitter: https://twitter.com/johnbina
Offline
Very simple and convenient! I love it.
Offline
after being even more lazy these days, i released version 2.0. now it is completely based on "file".
by default, you dont have to configure, because it will use .desktop file when you install new program. (also a smart method is provided. compared to original xdg-open, it is less likely to choose wrong app in this mode)
NOTE: the old config file does not work anymore. please use the newer format, which is shown in the first post.
Last edited by taylorchu (2012-11-29 09:57:15)
"After you do enough distro research, you will choose Arch."
Offline
How does this new format work exactly, I guess i get it for text and image files but what about rar, zip, magnet? What do I put in front of those and how does it matter?
Offline
it is simply the result you get from running "file --mime-type $file"
you can google to find them out.
"After you do enough distro research, you will choose Arch."
Offline
I like it, but I would recommend the use of 'mimetype -b $file'.
For example with *.mkv files, 'file --mime-type' returns application/octet-stream, instead of 'video/x-matroska'.
ps. I wanted to do a formal pull request but it seems GitHub is having problems right now :-(
Offline
@asdf-chan
file is more widely used.
@everyone
the script logic is completed rewritten. it is almost plug and play now!
"After you do enough distro research, you will choose Arch."
Offline