Re: Need a little konqueror help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 27 Apr 2020, Michael wrote:

>sorry snipped it all, got too long :(
>
>Bug workaround, (temporary, quick and dirty, not tested, I used ‘$HOME/trash/’
>for sed testing so make sure to fix the paths!...)
>
>Hmmm, I pretty sure I switched panel-one for panel-two, so fix that too ;)
>
>
>Part A:
>- Open Konqueror
>- Like Thierry did setup with two pane paths being different
>- change left pane to /home
>- change right pane to something else (here /video)
>- Save it as profile ‘konqtemplate’
>
>Part B:
>- Fine the profile in .trinity/share/apps/konqueror/profiles
>- Change the /home to ‘/konquerortemplatepanelone’
>- Change the /video to ‘/konquerortemplatepaneltwo’
>- Copy  konqtemplate to  konqtemplate.template (the .template probably needs
>to be in some other directory)
>
>Part C:
>- Create a batch file to wrapper your ‘konqueror --profile
>konqtemplate /URI/for/the/OTHER/pane’ command
>- Basic structure
>
># cat konq2p
>{snip, that was going to break}
>See: konq2p attached.
>
>Part D:
>- Run the command
>
>konq2p “$dir pane one” [“$dir pane two”]

Michael,

Ok, I said I'd take a crack at it today, and I did.
I took your idea as an "idea platform" to launch my
own solution and it's attached.   `rfs_konqueror`

Instead of your idea to use a template file, I dumped the
template directly into my bash script as a HEREDOC.  Read
the comments in the head of the script to try and understand
the weirdness in the code.  :-)

I just used the script to upload itself to my VPS, where I'm
now doing this email.

I'm just a modest hacker in bash, so I'm sure you or others
will see errors, or "things" that could be better fixed up.
Be kind.  I welcome critiques.  :-)



I learned several things today.  But, the Big One was that
bash variables can be used in a HEREDOC!!  Heretofore I had
only used static data with HEREDOCs, and never thought that
bash would interpret any variables as they were pulled out.


Wow!  What a day!  HEREDOCs with bash variables, and file
permissions fully copied by konqueror!

Best regards,
Jonesy
-- 
  Marvin L Jones     | Marvin     | W3DHJ  | linux
   Pueblo, Colorado  |  @         | Jonesy |  FreeBSD __
    38.238N 104.547W |   jonz.net | DM78rf |          SK
#!/bin/bash

#    rfs_konqueror -- 2 pane konqueror with remote file system

#    Use:
#         $ rfs_konqueror script_name  [directory_name]

#    28-Apr-20 -- First light, Marvin L Jones
#
#    Mount a remote file system and open konqueror with
#    2 panes -- one in the remote fs, one in $HOME/...somewhere.

#    "script_name" is any of several unique bash scripts that
#    mount (sshfs) remote file systems on a unique $HOME/
#    directory for each unique mount.
#    E.g., `vps` is a script to sshfs mount the remote VPS
#    server on $HOME/VPS
#    Likewise `example.net` would be a script to mount the
#    root directory of the website on $HOME/EXAMPLE.NET
#
#    Convention: lowercase script_name corresponds 1-to-1
#    with UPPERCASE mount point in $HOME.
#
#    "directory_name" is an optional directory in $HOME
#    on which the pane for the _local_ directory opens.
#    The default is "$HOME"
#
#    Flow:
#    Mount the remote file system, and cd onto the mount point
#    to prevent it being umount'ed while we're active.
#    Then a dual-pane konqueror profile is built (if not yet
#    existing) specifying the local $HOME/..../ directory
#    and the remote directory.
#    Then konqueror is executed with this profile.
#    When konqueror ends, we cd out of the remote mount point
#    and umount the remote fs.
#    (We leave the profile for possible future use....)
#
#    It is expected that this script will only be executed
#    from desktops objects.  But, command line junquies
#    could make use of it.

cd                                   # Move to $HOME.

cmd="$1"                             # Script for the remote dir

dir=$(echo "$cmd" | tr 'a-z' 'A-Z')  # dir (mount point) for the remote dir

if [ $# -eq 2 ]
then
  ldir="$HOME/$2/"                   # Specific $HOME/directory for pane 1
else
  ldir="$HOME/"                      # Default ... simpoly $HOME
fi

if [ ! -d $dir ]
 then
   #  Set up for pop-up messages if we can...
   if  [ `which kdialog` ]
    then
       kdialog --error "The mount point $dir/ does not exist ! !"  \
               --title "Error: $dir"
    else
      if  [ `which zenity` ]
       then
         zenity --error --title="Error $dir"  \
                --text="The mount point $dir/ does not exist ! !" 2>/dev/null
      fi
   fi
  exit 1
 fi

$HOME/bin/$cmd                       # Execute the sshfs mount for the remote fs.

cd $HOME/$dir                        # Move into & hold the remote dir.

if [ "$(ls -ol)" = "total 0" ]       # Verify it ain't the empty mount point.
 then
  echo "not mounted"
   #  Set up for pop-up messages if we can...
   if  [ `which kdialog` ]
    then
       kdialog --error "Unable to mount $dir/ ! !"  \
               --title "$dir Mount"
    else
      if  [ `which zenity` ]
       then
         zenity --error --title="$dir mount"  \
                --text="Unable to mount $dir/ ! !" 2>/dev/null
      fi
   fi
  exit 2
 fi

profiles="$HOME/.trinity/share/apps/konqueror/profiles/"   # konqueror's profiles dir.

if [ ! -e "$profiles$cmd" ]                                # If this profile does not (yet)
 then                                                      # exist -- create it.
  while read setting
   do
    printf "$setting\n" >> "$profiles$cmd"                 # Output settings to new profile
#   Warning. There are "$" in an actual profile -- which need to be escaped below.
   done <<SETTINGS
[Main Window Settings Toolbar bookmarkToolBar]
Hidden=true
IconText=IconTextRight
Index=3

[Main Window Settings Toolbar extraToolBar]
IconText=IconOnly
Index=0

[Main Window Settings Toolbar locationToolBar]
IconText=IconOnly
Index=2

[Main Window Settings Toolbar mainToolBar]
Index=1

[Profile]
ContainerT0_Children=View1,View2
ContainerT0_Orientation=Horizontal
ContainerT0_SplitterSizes=466,550
ContainerT0_activeChildIndex=1
FullScreen=false
Name[\$e]=$cmd
RootItem=Tabs0
Tabs0_Children=ContainerT0
Tabs0_activeChildIndex=0
View1_LinkedView=false
View1_LockedLocation=false
View1_PassiveMode=false
View1_ServiceName=konq_iconview
View1_ServiceType=inode/directory
View1_ToggleView=false
View1_URL[\$e]=file://$ldir
View2_LinkedView=false
View2_LockedLocation=false
View2_PassiveMode=false
View2_ServiceName=konq_iconview
View2_ServiceType=inode/directory
View2_ToggleView=false
View2_URL[\$e]=file://$HOME/$dir/
XMLUIFile=konqueror.rc
SETTINGS
#         Warning. There are "$" in and actual profile -- which need to be escaped above.

fi

konqueror --profile $cmd             # What all this commotion was about.

cd                                   # Get off the mount point.
$HOME/bin/$cmd -u                    # Unmount the remote fs.
exit 0                               # Our work here is done.
---------------------------------------------------------------------
To unsubscribe, e-mail: trinity-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: trinity-users-help@xxxxxxxxxxxxxxxxxxxxxxxxxx
Read list messages on the web archive: http://trinity-users.pearsoncomputing.net/
Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting

[Index of Archives]     [Trinity Devel]     [KDE]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]     [Trinity Desktop Environment]

  Powered by Linux