Announcement

Collapse
No announcement yet.

[SOLVED] How can I start Dolphin automatically when USB stick is plugged in?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] How can I start Dolphin automatically when USB stick is plugged in?

    When I plug in a usb stick the device notifier let me select what to do. I would like to change this behavior and want to start Dolphin automatically when a usb drive is attached.
    Is there a way to do this?

    #2
    Re: How can I start Dolphin automatically when USB stick is plugged in?

    I may be wrong, but I don't think you can in KDE 4.3.x. It's a new feature coming in 4.4.

    Comment


      #3
      Re: How can I start Dolphin automatically when USB stick is plugged in?

      You're right Mountain Man
      Most important laptop specs (this is my main computer, with Kubuntu on it):<br /><br />4096MB RAM (DDR2)<br />500GB Hard Disk<br />ATI Mobility Radeon 4570HD Videocard with 512MB GDDR3 RAM, up to 2280MB VRAM<br />Intel® Core™ 2 Duo-processor T6600<br /><br />OS: Kubuntu 10.10

      Comment


        #4
        Re: How can I start Dolphin automatically when USB stick is plugged in?

        I tried to add a new udev rule:
        Code:
        #USB-Stick
        BUS=="usb", KERNEL=="sd?1", SYSFS{idVendor}=="090c", SYMLINK+="CORSAIR", RUN+="/usr/bin/dolphin /media/CORSAIR"
        and added /media/CORSAIR to fstab.
        But the stick is not mounted to /media/CORSAIR and I still get the menu from device notifier.

        Must I really wait for kde 4.4?

        Comment


          #5
          Re: How can I start Dolphin automatically when USB stick is plugged in?

          Earlier/automount:

          > Topic: Kubuntu Karmic does not mount USB device automatically.
          - The KDE 4 is using a device notifier (or manager) plasmoid to present the options for a new device.
          - Some of the plasmoids have the option to automount.

          > How do I make it so my usb or cd shows up on the desktop when inserted?


          Do It Yourself (only an example - limits: one USB stick at the time - etc...)

          Making a mountpoint

          1) Plugging the USB memory in, checking the device with the command:
          Code:
          sudo blkid
          Here it is:
          /dev/sde1: UUID="DA4F-DAF5" TYPE="vfat"
          2) Making a mountpoint:
          Code:
          sudo mkdir -p /media/usb1
          3) Setting rights:
          Code:
          sudo chmod 777 /media/usb1
          4) Editing the fstab
          Alt+F2: "kdesudo kate /etc/fstab"
          Backup first !

          Adding to the /etc/fstab:
          Code:
          # a mountpoint for the usb flash drive
          /dev/sde1 /media/usb1 auto noauto,user,rw 0 0

          Here the Usb memory sticks are telling:
          Code:
          lsusb
          SanDisk Corp. Cruzer Micro 1/2/4GB Flash Drive
          ...
          Chipsbank Microelectronics Co., Ltd CBM2080 Flash drive controller

          Writing a script (automount_open_with_dolphin)
          Code:
          #!/bin/sh
          
          while [ 1 ]
          do
            if [ ! "`lsusb | grep Flash`" ]; then
             mounted=0
            fi
          
            if [ "`lsusb | grep Flash`" -a "$mounted" = 0 ]; then
             mount /media/usb1
             dolphin /media/usb1
             mounted=1
            fi
          
            sleep 2
          done
          Dropping it in to the ~/.kde/Autostart and making it executable.

          Log out - log in.

          Plugging USb stick in. It seems to work...
          Before you edit, BACKUP !

          Why there are dead links ?
          1. Thread: Please explain how to access old kubuntu forum posts
          2. Thread: Lost Information

          Comment


            #6
            Re: How can I start Dolphin automatically when USB stick is plugged in?

            Thanks for providing the script!

            WhenI run this script I get the message
            Code:
            /dev/sdb1 does not exist
            Although blkid shows
            Code:
            /dev/sdb1: LABEL="MYLINUXLIVE" UUID="7067-E8B4" TYPE="vfat"

            Comment


              #7
              Re: How can I start Dolphin automatically when USB stick is plugged in?

              Yes, that is because there is some lag (5 sec ?) between detection of the device and when it is mountable.


              This seems to work ( ):
              Code:
              #!/bin/sh
              
              while [ 1 ]
              do
                if [ ! "`lsusb | grep Flash`" ]; then
                 mounted=0
                fi
              
                if [ "`lsusb | grep Flash`" -a "$mounted" = 0 ]; then
                 mount /media/usb1
                 if [ $? -ne 0 ]; then
                   mounted=0
                 else
                   dolphin /media/usb1
                   mounted=1
                 fi
                fi
              
                sleep 2
              done
              If there is an error (an exit code of non zero) then it waits a moment and tries to mount again...
              Before you edit, BACKUP !

              Why there are dead links ?
              1. Thread: Please explain how to access old kubuntu forum posts
              2. Thread: Lost Information

              Comment


                #8
                Re: How can I start Dolphin automatically when USB stick is plugged in?

                Originally posted by Rog131
                If there is an error (an exit code of non zero) then it waits a moment and tries to mount again...
                Yes, that works!
                Thanks for your script (and sorry for answering so late, but work kept me busy...)

                Comment

                Working...
                X