0

I'm running ubuntu 18.04 with Xfce installed to replace GNOME. I'd like to be able to search gnome-software from the whisker menu. In the man page gnome-software doesn't say it has a search option though, I can only launch the store's default page. The same applies to the synaptic package manager.

In alternative if using a GUI application from the whisker menu isn't possible can I search applications from the terminal? I'd prefer not to use apt-cache search because I find it to messy to search for applications. I did find this question but I find implementing the accepted answer into something I could launch from the whisker menu quite confusing.

  • You could make a .desktop file and set terminal to true and exec to apt-cache dumpavail | awk '/Section:/' | sort | uniq and put the .desktop in usr/bin. I can't test right now, no Ubuntu but the .desktop should show in the menu and when clicked, open a terminal and run the command, more on .desktop: developer.gnome.org/integration-guide/stable/… – Mark Kirby May 12 '18 at 10:21
  • that only shows the sections though – dsSTORM May 12 '18 at 12:21
2

The terminal way is to set the whisker search action like this:

    Name: Enter package name(s) to searh for
    Pattern: !s
    Command: xfce4-terminal --execute /bin/bash -c "/usr/bin/apt-cache search %s ; /bin/bash"

%s - passes the string tiped in whisker to the command

/bin/bash - at the end will keep the terminal window open after apt-cache command finishes. Another option is to make a script for this.

Opening a GUI and inserting text at the right search box would be very tricky. But probably possible with the right tools.


One option (without the terminal): - Install dctrl-tools and zenity (for UI)

apt install dctrl-tools zenity
  • save next script and make it executable (chmod +x)
#!/bin/bash

PKG="$@"

PKGNAME="$(grep-available -sPackage -sVersion -sDescription . /var/lib/apt/lists/*_Packages |
grep -A 2 -E "^Package\: .*${PKG}" |
awk '{$1="";print $0}' |
zenity --list --width=900 --height=700 --column="Package" --column="Version avail" --print-column=1 \
       --column="Description" --column="" --hide-column=4 --title "package info" --text "pkg info")"

[[ ! -z ${PKGNAME} ]] && apt-cache show $PKGNAME | zenity --text-info --title="apt-cache show $PKGNAME" --width=800 --height=500

Set the whisker search action like this (replace /path/to/script e.g. /home/dsstorm/Desktop/pkginfo):

Name: Enter package name(s) to searh for
Pattern: !s
Command: /bin/bash -c "/path/to/script %s"
  • my problem with apt-cache search and aptitude is that they don't list everything, spotify can be installed from the gnome software center but neither apt-cache search or aptitude find it for example. Maybe a solution with apt-cache dumpavail may work but I have 0 experience with that command. Edit: I should add though that this style of solution is perfect, only that a few packages can't be found – dsSTORM May 12 '18 at 11:05
  • after messing around with apt-cache dumpavail I found that it too can't seem to find all the available packages. It seems apt-cache search is the simplest and most effective option. I'd change the command to xfce4-terminal --execute /bin/bash -c "/usr/bin/apt-cache search %s | less" (in my case I use gnome-terminal instead of xfce4-terminal, you can change the terminal to whichever you prefer) – dsSTORM May 12 '18 at 11:59
  • I've added an answer in which I detail how to create a search action and use a modified version of your command. Feel free to add this information to your answer (in which case I'll delete mine of course) – dsSTORM May 12 '18 at 12:14
  • 1
    I will update the answer with another option: with zenity UI and grep-available command (from the dctrl-tools package). It could be much more usefull if you can use the output from zenity --list. – user829010 May 15 '18 at 21:50
0

Inspired by Milos Pavlovitch's answer and given the fact that no matter which command you choose (apt-cache search, apt-cache dumpavail or aptitude) you'll still miss a few packages the most elegant workaround (terminal version) is this. Install aptitude with sudo apt-get install aptitude.

Right click on the whisker menu and select properties. Go to the search action tab and add this action:

Name: search package
Pattern: °
Command: gnome-terminal --execute /bin/bash -c "/usr/bin/aptitude search %s | less"

Note:

1) The pattern is just a character to invoke the action, for example if you want to search for emacs type °emacs

2) Change gnome-terminal with whatever terminal you actually use (on regular xubuntu nothing would happen if you leave gnome-terminal because it isn't installed for example, use xfce4-terminal instead)

3) The command will print some lines only, press enter to move forward or q to exit. The "p" at the beginning of the line stands for package.

0

"search gnome-software from the whisker menu"...

My answer almost replicates the Mint Mate "mintmenu" feature that you are looking for and wish to duplicate in the Whiskermenu.

You need to make sure apturl is intalled on your system first if you are going to want this to work.

First the steps:

1:) "right-click" the whiskermenu icon on the panel > "Properties" > "Search Actions" tab

2) "left-click" the "+" (plus sign) on the right of the name/pattern window

3) enter these details in the appropriate fields, Name: Install Package (or call it whatever you like since name is arbitrary), Pattern: ! (shebang/exclamation mark... also arbitrary, can be anything you like but should pick some symbol instead of letters), Command: apturl apt:%s, leave Regular expression box unchecked.

4) now Close

5) Open whisker menu, in Search field type !supertux (or type whatever program you want to install after the shebang, supertux is a game and you can just cancel when apturl dialog appears and asks if you want to install this item. I only use supertux for demonstration only., then press "Enter"

"Install additional software?" dialog should appear and either "Cancel" or "Install". If the program you are trying to install is already installed you will get a dialog telling you so. If you misspell you will get the error dialog or "doesn't exist" dialog.

Now if you just want to search for software in a similar fashion, first the steps:

1:) "right-click" the whiskermenu icon on the panel, "Properties", "Search Actions" tab

2) "left-click" the "+" (plus sign) on the right of the name/pattern window

3) enter this information in the appropriate fields

Name: Search Package Pattern: * Command: xfce4-terminal --execute /bin/bash -c "/usr/bin/aptitude search %s | less"

4) Close

5) open Whiskermenu, in search field, type *supertux

A terminal window will open and display the available programs for install according to the name you enter after the "*" symbol in the Whisker search field.

Instead of xfce4-terminal enter the name of the terminal program you use but keep the rest the same. The path of the user/bin/aptitude can be the path of the program you use for normal installs (aptitude is what I use, if you want to use that as well you have to install aptitude first.)

This search and apturl install feature is default in mintmenu in Mint Mate 19. If you do not have the Search Actions tab then you may have to update to get it?

I am using:

Mint xfce 19 Tara

Whiskermenu-plugin 2.3.1

I hope this helps and answers your question. I know other Mint Xfce4 users will be grateful for this little tip!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.