How to make clicking/running directory execute a file?
How to make clicking/running directory execute a file?
RoxApps, or AppDirs do this, but I find no info. on the mechanism.
File associations it seems are only for files... Makes sense.
# So how to setup dir. associations?
The dir. has an extension: .sqApp
Want running the dir. to run the file SqApp inside it.
CLI would be the best because then a GUI click would be easy to setup.
For GUI I think I`ll have to pick a file browser like Xfe and mod it to work.
I dislike "Open With", never use it, I need control of click and Rt. click.
File associations it seems are only for files... Makes sense.
# So how to setup dir. associations?
The dir. has an extension: .sqApp
Want running the dir. to run the file SqApp inside it.
CLI would be the best because then a GUI click would be easy to setup.
For GUI I think I`ll have to pick a file browser like Xfe and mod it to work.
I dislike "Open With", never use it, I need control of click and Rt. click.
- ravensrest
- Posts: 365
- Joined: Fri 22 Feb 2008, 16:43
- Location: Grants Pass, Oregon
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: How to make clicking/running directory execute a file?
If you take file browser rox then everything is ready.sunburnt wrote:...For GUI I think I`ll have to pick a file browser like Xfe and mod it to work.
I dislike "Open With", never use it, I need control of click and Rt. click.
right click > menu
left click > AppRun is executed
working example: gparted
# ls -la
insgesamt 16
drwxr-xr-x 2 root root 4096 Jun 13 19:00 .
drwxr-xr-x 22 root root 4096 Jun 13 17:52 ..
-rwxr-xr-x 1 root root 125 Jun 13 17:47 AppInfo.xml
lrwxrwxrwx 1 root root 27 Jun 13 18:58 AppRun -> ../../../sbin/gparted_shell
-rw-r--r-- 1 root root 2903 Jun 13 19:00 .DirIcon
#
AppInfo.xml:
Code: Select all
<?xml version="1.0"?>
<AppInfo>
<Summary>GParted</Summary>
<Summary xml:lang="de">Partitionen-Editor</Summary>
</AppInfo>
- Attachments
-
- gparted_in_rox_apps.png
- gparted integrated into rox/apps
- (17.19 KiB) Downloaded 442 times
Hi ravensrest; I forgot to mention it`s stand-alone like the ROX Apps.
The point is to have the dir. be the only thing required to run the app.
Hey Karl; No, not click in CLI just GUI. The CLI need is like the mime Q.
I`m looking for a method to get running a dir. to exec. a file inside it.
# Appinfo.xml only has app. info.:
I saw a patch for Bash-201 someone wrote in C that makes this happen.
Too old to be of any use now.
Hi L18L; Yeah, I know about Rox and Gobo Linix, but I don`t care for ROX-Filer.
I like the Xfe / Win.Explorer type GUI.
One would hope that there is a Rox exec. or lib. that does the work.
# But the real Q is... How to get Bash to do it? Then the GUI is a snap.
.
The point is to have the dir. be the only thing required to run the app.
Hey Karl; No, not click in CLI just GUI. The CLI need is like the mime Q.
I`m looking for a method to get running a dir. to exec. a file inside it.
# Appinfo.xml only has app. info.:
Code: Select all
<?xml version="1.0"?>
<AppInfo>
<Summary>Abiword text editor</Summary>
</AppInfo>
Too old to be of any use now.
Hi L18L; Yeah, I know about Rox and Gobo Linix, but I don`t care for ROX-Filer.
I like the Xfe / Win.Explorer type GUI.
One would hope that there is a Rox exec. or lib. that does the work.
# But the real Q is... How to get Bash to do it? Then the GUI is a snap.
.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
sunburnt wrote:...# But the real Q is... How to get Bash to do it? Then the GUI is a snap.
.
Code: Select all
# rox /usr/local/apps/gparted/
#
(give a directory to a web server and it will take a default file)
Hi L18L; The file rox is a shell script, I can do that too, but that`s not it.
I don`t want to have to run a shell script to run another shell script.
I put an AppRun file in a dir. and ROX-Filer changed the icon, so that`s it.
Bash in a VT does nothing with RoxApp dirs. Only running the file works.
I`d be happy if Bash would recognize a dir. by extension like a file.
I can easily write a script to do this, but it`s not what I had in mind.
If Bash had sockets, behaviors could be added without patching it.
But I will probably have to settle for writing a AppDir script for Xfe.
I don`t want to have to run a shell script to run another shell script.
I put an AppRun file in a dir. and ROX-Filer changed the icon, so that`s it.
Bash in a VT does nothing with RoxApp dirs. Only running the file works.
I`d be happy if Bash would recognize a dir. by extension like a file.
I can easily write a script to do this, but it`s not what I had in mind.
If Bash had sockets, behaviors could be added without patching it.
But I will probably have to settle for writing a AppDir script for Xfe.
Bash can recognize directories by at least two methods I know of.I`d be happy if Bash would recognize a dir. by extension like a file.
1) the test command using the -d switch. For details type help test on the CLI
2) an ls file listing output. Example below:
ls -l | grep ^d would display only the directories
3) I suppose there are other ways I just don't know about.
~~~~~~~~~~~~
Just a short idea :
how about a function in .bashrc ?
like
which can be left/escaped by "return" or "exit" command.
how about a function in .bashrc ?
like
Code: Select all
toggle_mybash(){
something=1
while [ $something ];do
read -p "Enter [command] : # " ENTRY
[ "$ENTRY" ] || continue
EVTL_COMMAND=${ENTRY%% *}
EVTL_PARAMETERS=${ENTRY##* }
if test `which $EVTL_COMMAND` ;then
$EVTL_COMMAND "$EVTL_PARAMETERS"
elif test -d "$ENTRY" ;then
[ -x "$ENTRY"/AppRun ] && "$ENTRY"/AppRun
elif test -f "$ENTRY" ;then
"$ENTRY"
elif test "`type $ENTRY`" ;then
$ENTRY
elif test "$ENTRY" ;then
"$ENTRY"
else
"$ENTRY"
fi;done; };toggle_mybash
Hi Bruce B; The thought was that Bash would recognize an "extension" on a dir. just like it does for a file.
Then this would allow for mime behavior with dirs. as well as files.
Of course Bash doesn`t really use mime any way, but it could / should.
That`s why I was dreaming of Bash plug-ins.
Karl; This comes about as close as I think it can get.
I was thinking maybe something could be done in profile.local or .bashrc.
Q: Wouldn`t all the tests after running AppRun be easier with just "else"?
I think this could work for the junction hack I made, and Bash mime too!
I`ll see how the whole idea pans out and let you know.
Then this would allow for mime behavior with dirs. as well as files.
Of course Bash doesn`t really use mime any way, but it could / should.
That`s why I was dreaming of Bash plug-ins.
Karl; This comes about as close as I think it can get.
I was thinking maybe something could be done in profile.local or .bashrc.
Q: Wouldn`t all the tests after running AppRun be easier with just "else"?
I think this could work for the junction hack I made, and Bash mime too!
I`ll see how the whole idea pans out and let you know.
i think that this can implemented in the bash source code . I am guessing the soure already uses a C case loop for this like i have often seen in main()s parsing parameters .
Don't know if you want a full bash or just your_bash .
which command seems not to work on shell buitins like return, here type is needed .
Don't know if you want a full bash or just your_bash .
which command seems not to work on shell buitins like return, here type is needed .
I tried your function and it works of course, but console is plain-vanilla.
There`s no command history and probably other behaviors are lost too.
But I`m thinking that a special sh fork could run the loop and be used?
This would keep Bash from being hijacked and made partly unusable.
Notice that the sh shell didn`t respond, but entering the bash shell did.
### Here`s your script I modded and added to .bashrc
I can write a C exec. in BaCon of this and it will be better.
The code could be added to Bash`s daemon loop, but I wouldn`t know how...
But I think more development on it is needed.
I`m going to try it for mime and with my junction hack.
This shell mod and mime are Bash items, but the junction is really a kernel item.
# I`m taking my boy to see the movie: The Avengers ( action and funny! ).
So I`ll be gone for 4 hours or more.
Thanks for the point in the right direction Karl, I`m hopeful about this!
Ihr Freund... Terry B.
.
There`s no command history and probably other behaviors are lost too.
But I`m thinking that a special sh fork could run the loop and be used?
This would keep Bash from being hijacked and made partly unusable.
Code: Select all
sh-4.1# /mnt/sdb3/AppDir/Fox-1.6.45
sh: /mnt/sdb3/AppDir/Fox-1.6.45: is a directory
sh-4.1# bash
sh# ^[sddfsf: command not found ............... bash not taking arrows, etc.
sh# : type:
sh#
sh# ^[[A^[[B
bash: type: : not found
bash: : command not found
sh# /mnt/sdb3/AppDir/Fox-1.6.45 .................. command works
sh#
### Here`s your script I modded and added to .bashrc
Code: Select all
shmod(){ # intercept commands and process them
while :
do
read -p "sh# " ENTRY
[ "$ENTRY" ] || continue
EVTL_COMMAND=${ENTRY%% *}
EVTL_PARAMETERS=${ENTRY##* }
if test `which $EVTL_COMMAND` ;then
$EVTL_COMMAND "$EVTL_PARAMETERS"
elif test -d "$ENTRY" ;then
[ -x "$ENTRY"/AppRun ] && "$ENTRY"/AppRun
elif test -f "$ENTRY" ;then
"$ENTRY"
elif test "`type $ENTRY`" ;then
$ENTRY
elif test "$ENTRY" ;then
"$ENTRY"
else
"$ENTRY"
fi
done;
}
shmod
The code could be added to Bash`s daemon loop, but I wouldn`t know how...
But I think more development on it is needed.
I`m going to try it for mime and with my junction hack.
This shell mod and mime are Bash items, but the junction is really a kernel item.
# I`m taking my boy to see the movie: The Avengers ( action and funny! ).
So I`ll be gone for 4 hours or more.
Thanks for the point in the right direction Karl, I`m hopeful about this!
Ihr Freund... Terry B.
.