Announcement

Collapse
No announcement yet.

[SOLVED] Kmenu opens files differently from Dolphin

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

    [SOLVED] Kmenu opens files differently from Dolphin

    Hi,

    I have a little script which turns off my monitor called TurnOffMonitor.desktop. When I click on it in Dolphin, my monitor turns off (which is what I want), but when I create a shortcut in Kmenu and click on that, it opens the script in Kate. This is a problem, because I want to associate the shortcut with the home key on my laptop, so it effectively has a monitor power button. Going through Dolphin's not what I'm after. Anyone know how to get Kmenu to run scripts rather than open them in Kate?

    Cheers,
    Aston

    #2
    Re: Kmenu opens files differently from Dolphin

    More information would be helpful .

    How did you make the desktop file ?
    What is in the desktop file ?
    How the Linux/KDE is seeing the desktop file ?


    Working at here

    Right click an empty area in the Dolphin > Crate New > Link to Application.
    The desktop template is presented.

    General tab -> Adding the name: Monitor Off.
    Application tab -> Adding the command: sleep 1 && xset dpms force off.

    Press OK.

    Right click the "Monitor Off.desktop" > Properties.
    General tab -> Click the Icon > Pick the Icon.

    Press OK.

    The Monitor Off.desktop has:
    Code:
    [Desktop Entry]
    Comment[en_US]=
    Comment=
    Exec=sleep 1 && xset dpms force off
    GenericName[en_US]=
    GenericName=
    Icon=video-display
    MimeType=
    Name[en_US]=
    Name=
    Path=
    StartupNotify=true
    Terminal=false
    TerminalOptions=
    Type=Application
    X-DBUS-ServiceName=
    X-DBUS-StartupType=
    X-KDE-SubstituteUID=false
    X-KDE-Username=
    X-Ubuntu-Gettext-Domain=desktop_kdebase

    The Linux/KDE is seeing the desktop file as
    :~$ file "/home/rog/Desktop/Monitor Off.desktop"
    /home/rog/Desktop/Monitor Off.desktop: ASCII text
    or/and
    kmimetypefinder "/home/rog/Desktop/Monitor Off.desktop"
    application/x-desktop
    (accuracy 100)

    Adding to the K-Menu

    [img width=400 height=232]http://img254.imageshack.us/img254/4044/kmenueditor.png[/img]

    Right click K > Menu Editor
    Drag and drop the Monitor Off.desktop to the "Utilities". Adding the shortcut - "Advanced" tab.
    Save and exit the Menu editor


    Here the K-Menu/shortcut is working OK.


    Information

    man sleep
    NAME
    sleep - delay for a specified amount of time

    SYNOPSIS
    sleep NUMBER[SUFFIX]...
    sleep OPTION

    DESCRIPTION
    Pause for NUMBER seconds.
    man xset
    NAME
    xset - user preference utility for X

    dpms flags...
    The dpms option allows the DPMS (Energy Star) parameters to be set. The option can take up to
    three numerical values, or the `force' flag followed by a DPMS state. The `force' flags forces
    the server to immediately switch to the DPMS state specified...
    man file
    NAME
    file — determine file type
    kmimetypefinder --help
    Usage: kmimetypefinder [Qt-options] [KDE-options] [options] filename

    Gives the mimetype for a given file

    Notes

    The Menu editor is a .desktop file editor/maker (> Topic: GtoK: .desktop files) and a xml "editor".

    When you add a menu item, the Menu editor will make a desktop file to the ~/.local/share/applications/. The Menu editor also adds a marking to the ~/.config/menus/applications-kmenuedit.menu.
    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


      #3
      Re: Kmenu opens files differently from Dolphin

      I actually downloaded the shortcut rather than making it, when I open it in Kate I get

      #!/usr/bin/env xdg-open
      [Desktop Entry]
      Comment=Turn Off the Monitor
      Categories=Application;Utilities;
      Exec=xset dpms force off
      GenericName=Turn Off Monitor
      Icon=weather-clear-night
      Name=Turn Off Monitor
      NoDisplay=false
      StartupNotify=false
      Terminal=0
      TerminalOptions=
      Type=Application
      X-KDE-SubstituteUID=false
      X-KDE-Username=

      It's sitting in /home/aston/Applicaitons/TurnOffMonitor.desktop

      Doing it the way you do it, where I actually type the sleep command the Kmenu entry, works, so that does actually solve my problem and thanks. What I was trying to do, is rather than putting "sleep 1 && xset dpms force off" in the command field I was putting "/home/aston/Applications/TurnOffMonitor.desktop". It seems to be pretty sporadic whether or not this works, before I last re-installed Kubuntu, that's exactly how I was using it, bun now all I get is Kate.

      If Kmenu is creating a link pointing to a link, that could be a problem, but when I tried looking for /usr/share/, (what does .local mean?) there's no applications directory, so I couldn't figure out how to drop the .desktop file directly in there.

      Anyway, problem solved, just still trying to poke around and figure some things out.

      Cheers,
      Aston

      Comment

      Working...
      X