Announcement

Collapse
No announcement yet.

<solved> Make a .desktop file work on the desktop panel.

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

    <solved> Make a .desktop file work on the desktop panel.

    I have a desktop in a midisze tower case thats sits to the far left of my desk. I do a lot of dvd and cd ripping so disks go in and out of my dvd drive often.

    Rather than reaching over, pushing the little button - waiting arm streched out - dvd hovering until tray opens - and pushing the button again - I wrote a little .desktop file called "eject" that opens and closes the drive.

    Now I click - drop dvd - click.

    My Point is (finally...) I want to have a widget or panel item to do this. Anyone now how to write a simple widget that can hold a simple sinlge line command

    I tried drag and drop to the panel - didn't work.

    Please Read Me

    #2
    Re: Make a .desktop file work on the desktop panel.

    Create a menu entry with the following command:

    /usr/bin/eject -T

    You may have to add a dev path if you have more than one DVD/CDROM.

    Give it a suitable icon.

    Save the menu edits.

    Unlock widgets.

    Navigate to Eject icon and click right mouse. Select save to panel.

    Lock widgets.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Re: Make a .desktop file work on the desktop panel.

      K-Menu

      Add the command to the menu and then to the panel

      Right click the K > Menu editor. Add the command to the Menu. Save and exit the Menu editor
      Right click your "Eject" application -> Add to the Panel.


      With the KDE 4.4 you could use the mouse action favorites launcher

      > Favorites Launcher

      > Topic: configuring desktop mouse actions

      Add the "eject" command to the K-Menu -> Add to the Favorites -> Launch through the mouse action.



      Plasma widgets

      > Yasp-Scripted
      A plasmoid to execute scripts.

      Add the "Yasp scripted" to the panel - and set the script path (plasmoid settings).

      eject.script
      Code:
      icons size="50" icon="media-eject.png" click="eject"
      Will draw a button (media-eject) and execute the "eject" command when clicked.

      man eject
      NAME
      eject - eject removable media

      SYNOPSIS
      eject -h
      eject [-vnrsfmqp] [<name>]
      ...
      DESCRIPTION
      Eject allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) to be ejected under software control....

      > On/Off Switch
      Description:
      On/Off Switch is a simple plasmoid that executes commands when the switch is toggled.
      > Mountoid
      Description:
      This plasmoid provides a way to mount/unmount devices from fstab (e.g. network shares), show free space and open mount point location in a file manager.
      + an option to eject


      [img width=338 height=400]http://img340.imageshack.us/img340/3451/optionsg.png[/img]


      DIY

      > Development/Tutorials/Plasma
      > Introducing KDE 4 plasmoids
      > Plasmate 0.1-alpha2
      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


        #4
        Re: Make a .desktop file work on the desktop panel.

        Well, I didn't make a desktop file (*.desktop) but a shell script (*.sh) and it works fine.

        Code:
        #!/bin/sh
        exec /usr/bin/eject -T &
        Then I open Dolphin and clicked on Desktop "folder" and rightclicked on the shell script to change its properties like the icon it'd use. I found one, Amarok's eject icon. Now every time I click on it, it'll be executed as expected. It either ejects the cd tray or closes it.
        Multibooting: Kubuntu Noble 24.04
        Before: Jammy 22.04, Focal 20.04, Precise 12.04 Xenial 16.04 and Bionic 18.04
        Win XP, 7 & 10 sadly
        Using Linux since June, 2008

        Comment


          #5
          Re: Make a .desktop file work on the desktop panel.

          Originally posted by GreyGeek
          Create a menu entry with the following command:

          /usr/bin/eject -T

          You may have to add a dev path if you have more than one DVD/CDROM.

          Give it a suitable icon.

          Save the menu edits.

          Unlock widgets.

          Navigate to Eject icon and click right mouse. Select save to panel.

          Lock widgets.
          Did all that - It's there, but doesn't work in either panel or kmenu, Desktop icon still makes it happen - odd...

          EDIT: Odder still, "ksystraycmd eject -T" works in the console.

          Please Read Me

          Comment


            #6
            Re: Make a .desktop file work on the desktop panel.

            Another oddity - if I right click on the new icon in the taskbar OR open it via Alt-D,s it crashes kwin for a moment, and when kwin re-loads itself, the eject icon is missing!

            Please Read Me

            Comment


              #7
              Re: Make a .desktop file work on the desktop panel.

              mmm... Just rechecked my panel icon. It works.

              My DVDROM doesn't have the ability to close automatically, unlike yours, so I suspect there is a lot of hardware dependency in the behavior for my solution.
              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
              – John F. Kennedy, February 26, 1962.

              Comment


                #8
                Re: Make a .desktop file work on the desktop panel.

                I guess some of the issue was the desktop file itself - I had created it using opensuse 11.1 and the data was different than with kubuntu.

                I re-created it and then the drag and drop of the icon from my desktop folder to the panel and it worked.

                Now my only issues are cosmetic - the proper icon won't display - instead it shows the default icon for an executable, and The name that shows during "hover" is the file name instead of the name in the file definition and there's no comment at all.

                Please Read Me

                Comment


                  #9
                  Re: Make a .desktop file work on the desktop panel.

                  I guess you're talking about his solution, but remember you can name it leaving some white spaces if you like... even if you create a shell script... you just need to include the shebang and forget about the file extension.
                  Multibooting: Kubuntu Noble 24.04
                  Before: Jammy 22.04, Focal 20.04, Precise 12.04 Xenial 16.04 and Bionic 18.04
                  Win XP, 7 & 10 sadly
                  Using Linux since June, 2008

                  Comment


                    #10
                    Re: Make a .desktop file work on the desktop panel.

                    Originally posted by kyonides
                    I guess you're talking about his solution, but remember you can name it leaving some white spaces if you like... even if you create a shell script... you just need to include the shebang and forget about the file extension.
                    Yes, sorry I wasn't clear - and I did name it like you suggested. I'd still like to make it a bit more "gee whiz"

                    Please Read Me

                    Comment


                      #11
                      Re: Make a .desktop file work on the desktop panel.

                      At the end I didn't like my solution because now all shell scripts want to show that eject icon... a very notorious side effect...

                      Well, now I created a desktop file with the command info provided by GreyGeek for the shell script as a separate file and now it works fine...

                      Code:
                      [Desktop Entry]
                      Comment=Ejects CDs or closes the CD ROM tray
                      Comment[es]=Expulsa CDs o cierra la bandeja del lector
                      Name=Eject CD
                      Name[es]=Expulsar CD
                      Type=Link
                      URL=/home/user/EjectCD
                      Icon=media-eject
                      X-Ubuntu-Gettext-Domain=desktop_kdebase
                      Multibooting: Kubuntu Noble 24.04
                      Before: Jammy 22.04, Focal 20.04, Precise 12.04 Xenial 16.04 and Bionic 18.04
                      Win XP, 7 & 10 sadly
                      Using Linux since June, 2008

                      Comment


                        #12
                        Re: Make a .desktop file work on the desktop panel.

                        I have no idea what you mean by "it works"

                        Did you mean it ejects the DVD?
                        Does the name and comments appear during hover correctly?
                        Does the Icon appear correctly?

                        Please Read Me

                        Comment


                          #13
                          Re: Make a .desktop file work on the desktop panel.

                          That's exactly what I meant.
                          Multibooting: Kubuntu Noble 24.04
                          Before: Jammy 22.04, Focal 20.04, Precise 12.04 Xenial 16.04 and Bionic 18.04
                          Win XP, 7 & 10 sadly
                          Using Linux since June, 2008

                          Comment


                            #14
                            Re: Make a .desktop file work on the desktop panel.

                            Now this is starting to tick me off...

                            I followed kyonides step-by-step and I still am in the same place. It opens the drive but the floating info is not being displayed and the icon is still the gear icon (executable) rather than anything in the .desktop file.

                            And ps to Rog

                            Right click your "Eject" application -> Add to the Panel.
                            This option doesn't appear anywhere for me. Not in kmenu, in the folder view or in kmenuedit

                            Please Read Me

                            Comment


                              #15
                              Re: Make a .desktop file work on the desktop panel.

                              The "Add to Panel" option won't show IF you locked the widgets. Unlock them and that right menu menu option will show up.
                              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                              – John F. Kennedy, February 26, 1962.

                              Comment

                              Working...
                              X