LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Google Chrome works in GNOME when started from a command line, but it's not displayed in the applications menu. (https://www.linuxquestions.org/questions/fedora-35/google-chrome-works-in-gnome-when-started-from-a-command-line-but-its-not-displayed-in-the-applications-menu-4175575004/)

PTrenholme 03-15-2016 07:52 PM

Google Chrome works in GNOME when started from a command line, but it's not displayed in the applications menu.
 
First, be aware that I'm running a Fedora 25 system, so this may not be a real problem. :)

Anyhow, the google-chrome.desktop file in in the /usr/lib/applications/ directory, and is displayed on the menus of most of the other desktop environments (e.g., Mate, LXQT, ...).

When started from a terminal, it seems to work with no problems. (In fact, I'm typing this query using Chrome started in that way.)

I assumed that the problem was because several of the GNOME .menu files list google-chrome in the <exclude>...</exclude> sections, editing those file to remove references to "google-chrome" did not make the application appear on the menu.

I also tried remodeling the google-chrome.desktop file so it looked more like the Midori.desktop file, since the GNOME documentation talks about their "modifications" to the XDG_Desktop standard. That only resulted in the Midori application no longer being displayed. (I assume that I inadvertantly saved a messed-up copy while I was editing the Chrome .desktop file.)

So, my questions:
  1. Has anyone seen this problem on other Fedora releases?
  2. Are there other .desktop file that are not available from the "Activities" action of GNOME?
  3. If you've had a similar problem, have you solved it?

If you're interested, here's a bash script I wrote that I use to start detached commands from a terminal window. (I needed this because I find the KDE desktop much easier to use then the GNOME one, and, for some -- as yet undetermined -- reason, the KDM works, but the shell crashes when plasmashell is started. So, if I want to use KDM, I have to work mostly from terminal windows.)

Code:

$ cat ~/bin/Init
#!/bin/bash
help()
{
  local i name lc
  lc=${1,,?}
  name=$(basename ${0})
  if ( [ -z "${1}" ] || [[ "${lc}" =~ ^-+h ]] )
  then
    cat <<EOF >&1
${name}: Run a command, detached, supressing all terminal output.

Usage: ${name} command [arguments ...]

Special command values:
  -h|--help                Print this message to stderr and exit
  -s|--setup[=n[oauto]]    Run the set of predetrmined commands.
  -r|--run= n1 n2 ...      Run the pre-defined command <n> (See --list.)
  -l|--list                List pre-defined commands
  -a|--auto                List any command(s) automatically run
                          after the --setup command(s) are started.
                          unless the "noauto" optiom of "--setup" is used.

EOF
  exit 0
  fi
#elif
  if [[ "${lc}" =~ ^-+l ]]
  then
    for (( i=1; i<=${#CMD[@]}; ++i ))
    do
      echo "  $i = ${CMD[$i]}" >&1
    done
    echo "" >&1
    exit 0
  fi
#elif
  if [[ "${lc}" =~ ^-+a ]]
  then
    for (( i=1; i<=${#AUTO[@]}; ++i ))
    do
      echo "  ${AUTO[$i]}" >&1
    done
    echo "" >&1
    exit 0
  fi
#else return
}
# Function to run a command in as a detached process
dispatch()
{
  echo -n '"'${1}'"' >&1
  if ( [ -n "${*}" ] && [ -n "$(type ${1})" ] )
  then
    "$*" &>/dev/null &
    job=$!
    disown
    echo " started as process #${job}" >&1
  else
    echo " does not appear to be a valid command." >&1
  fi
}
#
# Main program
#
# Initialize CMD and AUTO
CMD=(  [1]="konsole" [2]="google-chrome" [3]="gkrellm" )
AUTO=( [1]="Update --refresh" )
# Do we have any help arguments?
help "${*}"
# Convert the first argument to lowercase
lc=${1,,?}
# Do we have the "--setup" option?
if [[ "${lc}" =~ ^-+s ]]
then
  # dispatch all the commands in the CMD array
  for (( i=1; i<=${#CMD[@]}; ++i ))
  do
    dispatch ${CMD[${i}]}
  done
  # If the "noauto" option is not used, dispatch all commands in the AUTO array
  if ![[ "${*,,}" =~ ^-+s.*=?[[:space:]]*n ]]
  then
    for (( i=1; i<= ${#AUTO[@]}; ++i ))
    do
      dispatch ${AUTO[${i}]}
    done
  fi
  exit 0
fi
#
# Not an "--setup" command. Is it a --run command?
if [[ "${lc}" =~ ^-+r ]]
then
  # Set the initial number of arguments to consume to 2
  j=2
  # The user may wik to start a subset of the available commands
  # so we need to support "--run 1 3", etc.
  while [ $# -gt 0 ]
  do
    cmd=${CMD[${!j}]}
    if [[ -z "${cmd}" ]]
    then
      echo "\"${!j}\" is not a valid command number."
      help "-l"
    fi
    # Get rid of the processed arguments
    shift $j
    # and reduce the number of arguments to 1
    j=1
    dispatch "${cmd}"
  done
  exit 0
fi
# If we get here, then assume that ${@} is a (single) command to be dispatched
dispatch ${@}


Ztcoracat 03-21-2016 09:00 PM

Maybe try installing alacarte and use that to add the icon to your Applications Menu. It worked for me.
<OR> see my Blog on How To Create A Desktop Entry.

Doug G 03-21-2016 10:26 PM

How did you install Chrome? I used the google repository on fedora 23/xfce and the install put Google Chrome in the application menu, and I could easily create a desktop launcher with a drag & drop from the menu.

PTrenholme 03-27-2016 10:24 PM

Quote:

Originally Posted by Doug G (Post 5519485)
How did you install Chrome? I used the google repository on fedora 23/xfce and the install put Google Chrome in the application menu, and I could easily create a desktop launcher with a drag & drop from the menu.

Unsurprisingly, Chrome is not in the Rawhide repository. I installed it from the Google stable repository. (Which works fine with F-23.)

PTrenholme 03-27-2016 10:27 PM

Solved.
 
Quote:

Originally Posted by Ztcoracat (Post 5519460)
Maybe try installing alacarte and use that to add the icon to your Applications Menu. It worked for me.
<OR> see my Blog on How To Create A Desktop Entry.

Alacarte did the trick. Thanks.

Ztcoracat 03-28-2016 05:03 PM

Quote:

Originally Posted by PTrenholme (Post 5522242)
Alacarte did the trick. Thanks.

Cool!
Glad it worked for you-:)

Doug G 03-28-2016 06:47 PM

Yes, thanks. I'd forgotten about alacarte, and it wasn't installed on my f23 system. It is now :)


All times are GMT -5. The time now is 03:17 AM.