Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 18 Sep 2018, 23:08
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Script to Replace Nautilus for Dropbox
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
s243a

Joined: 02 Sep 2014
Posts: 1124

PostPosted: Mon 18 May 2015, 01:21    Post subject:  Script to Replace Nautilus for Dropbox  

Fatdog (and likely other slackware based versions of pupplinux) does not come with nautilus

The consequence is that when you right click on the dropbox icon (located on the taskbar after typing "dropbox start -i") you get the error "no nautilus" and the folder does not open. I found on another site that the trick is to replace nautilus with a bash scrip.

Here is my hack:
Code:
#!/bin/bash
#echo 'hi'"$@" 1>&2
exec rox $2
exit 0

(script full name: /usr/local/bin/nautilus

The commented out echo was because I needed to see what the input arguments were which dropbox was passing to this script.

The arguments were:
Code:

--no-desktop /root/dropbox

rox does not recognize the "--no-desktop" option. The proper way to do this script would be to process each argument one by one and then either translate or remove each option as needed. I may do this later when I get time. The risk of my hack is that some other program may think that nautilus exists and act in appropriately as a consequence.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4832
Location: Kingwood, TX

PostPosted: Mon 18 May 2015, 08:22    Post subject:  

Here is a start... currently strips all options, but you can just add different case statements as needed for supported options
Code:
#!/bin/sh
for x in $@; do
[ $INITIALIZED ] || INITIALIZED=1 && set --
case "$x" in
 -*);; #remove all options
 *)set $@ $x
esac
done
rox $@

If there is a rox option that is similar to the nautilus option, the case statement would look like:
--some-nautilus-option) set $@ --equivalent-rox-option;;

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
s243a

Joined: 02 Sep 2014
Posts: 1124

PostPosted: Thu 01 Feb 2018, 01:50    Post subject:  

technosaurus wrote:
Here is a start... currently strips all options, but you can just add different case statements as needed for supported options
Code:
#!/bin/sh
for x in $@; do
[ $INITIALIZED ] || INITIALIZED=1 && set --
case "$x" in
 -*);; #remove all options
 *)set $@ $x
esac
done
rox $@

If there is a rox option that is similar to the nautilus option, the case statement would look like:
--some-nautilus-option) set $@ --equivalent-rox-option;;


I finally got around to trying this but I modified it some because I didn't understand some things in your script.

My script is

Code:

#!/bin/sh
ARGS=()
for x in $@; do
case "$x" in
 --no-desktop);; #remove all options
 *)ARGS+=($X)
esac
done
rox ${ARGS[*]}


And I had help from the two stack overflow threads:

- Expanding an array in BASH [duplicate]
- https://stackoverflow.com/questions/21542054/how-to-intercept-and-remove-a-command-line-argument-in-bash

I never tried your script as you wrote it because I don't understand what "set --" does. I don't know the function of the "INITIALIZED" variable, and I don't understand how you can assign to the same variable that you are removing stuff from in a loop. It's probably some things that I don't know about linux but no-one always writes 100% bug free code.

Anyway, I tested my script and it works. Maybe you script would also work. I don't know. Thanks for the help though because I used your script as the starting point Smile
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0356s ][ Queries: 12 (0.0065s) ][ GZIP on ]