You are not logged in.
Inspired by Taylorchu's mimi, I decided to make xdg-open replacement written in bash that has somewhat flexible configuration.
You can match either, extensions, mime types, mime groups, or regular expressions of the filename.
You can also specify applications that you wish to open in terminal, and linopen knows when the process should be opened in new terminal or in your current open terminal.
Example configuration
#
# linopen configuration
# enviroiment variables can be used
#
# Specify your terminal emulator here
# for terminal support.
terminal=xterm
# Specify all programs you want to
# open in terminal like this:
interm=vim
# There are 4 ways to match filetypes.
# The following examples are in the order
# which linopen chooses the program as well.
# 1. File extension
# .png:sxiv
# .mp4:mplayer
# .txt:vim
# 2. Mime type
# image/png:sxiv
# video/mp4:mplayer
# text/plain:vim
# 3. Mime category
image:sxiv
video:mplayer
audio:mplayer->interm # you can also specify the interm rule explictly after '->'
text:vim
# 4. Regexp
# Match some protocols by default
?'^http:\/\/':$BROWSER
?'^https:\/\/':$BROWSER
?'^www.':$BROWSER
# Directory rule for directories
# ideally you want to use file manager
# here if you are a GUI user.
directory:echo
# Default rule just echoes back whatever
# was feed. If you are using DE you could
# just map a file manager here and it would
# integrate with your system.
default:echo
Refer to the configuration file for more detailed how-to.
There is also 'open' symlink to xdg-open to emulate Mac Os X behaviour.
Last edited by Cloudef (2012-07-17 16:08:41)
Offline
Very nice!!
Just one thing, in your PKGBUILD the md5sum of open seems to be wrong.
Offline
Offline
In this case it would be better to change the PKGBUILD to this
# Maintainer: Cloudef <mailroxas@gmail.com>
# Intelligent and suckless replacement for xdg-open
pkgname=linopen
pkgver=1.0
pkgrel=1
pkgdesc='Intelligent and suckless replacement for xdg-open'
arch=('any')
url='http://cloudef.eu'
license=('WTFPL')
provides=('xdg-utils')
conflicts=('xdg-utils')
backup=('etc/linopen.conf')
source=('xdg-open' 'linopen.conf')
package() {
cd "$srcdir"
mkdir -p "${pkgdir}/usr/bin"
mkdir -p "${pkgdir}/etc"
ln -s "/usr/bin/xdg-open" "$pkgdir/usr/bin/open"
install -m755 xdg-open "${pkgdir}/usr/bin/"
install -m755 linopen.conf "${pkgdir}/etc/"
}
md5sums=('f5487fc4c305a20124da7bb164e6b04d'
'2c9078f3ee82d619dc150bb44837d9e8')
or (imho nicer) with this package function
package() {
install -Dm755 "$srcdir/xdg-open" "${pkgdir}/usr/bin/xdg-open"
install -Dm755 "$srcdir/linopen.conf" "${pkgdir}/etc/linopen.conf"
ln -s "/usr/bin/xdg-open" "$pkgdir/usr/bin/open"
}
Last edited by Army (2012-07-03 16:04:13)
Offline
Inspired by Taylorchu's mimi, I decided to make xdg-open replacement ... and linopen knows when the process should be opened in new terminal or in your current open terminal.
Love it when one program inspires another, especially if it improves upon it!
You've also got me thinking that I should add a 'run in terminal' option to my own opener, expro (reported earlier in the forum).
There is quite a collection of openers now - maybe they deserve a Wiki page in their own right (although mimeo is mentioned on the xdg-open page).
Offline
In this case it would be better to change the PKGBUILD to this
Done
You've also got me thinking that I should add a 'run in terminal' option to my own opener, expro (reported earlier in the forum).
As a tip, it might be possible to do automatic detection whether the program needs terminal at all, by checking what it is linked against with ldd. However it's not accurate. Especially if the program dynamically loads something. Best way I can think of is just defining manually on configuration, as the user knows the best.
Last edited by Cloudef (2012-07-03 16:06:31)
Offline
Feature request: I want to open video files in mplayer, but audio files as well. For audio files, I want mplayer to start in a terminal, for video files I don't. As far as I can see this isn't possible right now. If it is, please give me a heads up.
Offline
Feature request: I want to open video files in mplayer, but audio files as well. For audio files, I want mplayer to start in a terminal, for video files I don't. As far as I can see this isn't possible right now. If it is, please give me a heads up.
Good suggestion, I've added it to git now.
You can specify interm explictly for rule by appending '->interm' after program name. I also added output redirection for backgrouned applications to /dev/null.
Offline
Awesome, now everything works very well. Thanks Cloudef!
Offline
Offline
Hello I have a file with the extension .pez which I would like to open with prezi-desktop.
Thus, my linopen.conf
#
# linopen configuration
# enviroiment variables can be used
#
.pez:prezi-desktop
However, they are still opened with File Roller. Did I make something wrong?
Robert
Last edited by orschiro (2012-12-17 22:25:11)
Offline
Hello I have a file with the extension .pez which I would like to open with prezi-desktop.
Seems to work fine here.
Can you post your `pacman -Q linopen` and is that your full config?
linopen.conf requires default rule as fallback.
This should be the output with your config:
─┬╼ .loli//LOLI :: /home/loli
└╼ ] open -c asd.conf asd.pez
rule must exist in configuration: 'default:'
Last edited by Cloudef (2012-12-17 22:36:58)
Offline
[orschiro@thinkpad ~]$ pacman -Q linopen
linopen 1.4-2
Sorry, I was incorrect about the config. It is .linopenrc. I left the default one in /etc untouched.
EDIT:
The output is the same:
[orschiro@thinkpad ~]$ open -c .linopenrc testfile.pez
rule must exist in configuration: 'default:'
But why is it still opened with File Roller (see screenshot)?
Last edited by orschiro (2012-12-17 22:41:08)
Offline
But why is it still opened with File Roller (see screenshot)?
Because linopen does not work that way. It does not integrate with gnome or gnome-open stuff.
It's replacement for xdg-open, without all the weird mime files and .desktop stuff.
To use the linopen in your filemanager, you would need to have .desktop file that calls 'xdg-open %f' and it would choose the program to open it according to how linopen is configured.
If you use DE integration, I would recommend to set up things their way. I'm sure nautilus allows you to configure .pez files to open in prezi-desktop.
Offline
The presence of ~/.linopenrc seems to cause xdg-open to fail in certain situations. Specifying with -c either /etc/linopen.conf or ~/.linopenrc works. I remedied this by changing line 17 to:
[[ -f "$_LINOPEN_CFGRC" ]] && { egrep -v "^(#|$)" "$_LINOPEN_CFGRC"; return; }
I use linux and I dont understand nothing in this post.
Offline
The presence of ~/.linopenrc seems to cause xdg-open to fail in certain situations. Specifying with -c either /etc/linopen.conf or ~/.linopenrc works. I remedied this by changing line 17 to:
[[ -f "$_LINOPEN_CFGRC" ]] && { egrep -v "^(#|$)" "$_LINOPEN_CFGRC"; return; }
It seems to fail, if /etc/linopen.conf exists looking at the scripts logic.
I'll push a fix for this when I'm off from work. Thanks!
Offline