7

The problem

When I activate the Unity Dash it remembers the last application, file or folder that I accessed using the Dash. If the previous item was a folder and this time I am looking for an application, the Dash fails to find the application.

How to reproduce

  1. launch the Dash by pressing the 'super' key
  2. type your username to find your home folder (other folder names will do)
  3. press 'enter' to launch Files
  4. launch the Dash again
  5. type 'firefox' or any other application (without first pressing 'escape')

The workaround

Pressing escape immediately after launching the Dash, thus clearing the previous search term.

The question

Can I configure Dash to forget the previous search term and does anyone know if this is the expected behaviour?

  • Interesting. Never came across that. Another workaround would be to press Super+A. – pLumo Jan 5 '17 at 15:38
  • Its not expected, mine doesn't do this. – George Udosen Jan 5 '17 at 15:40
  • Thanks @RoVo. If there were a keyboard combination for 'search all' I could remap Super. – Anthony Hepple Jan 5 '17 at 15:47
  • Hi @George. I have unity version 7.4.0 on Ubuntu 16.04. May I ask what versions you have? – Anthony Hepple Jan 5 '17 at 15:49
  • Ubuntu 16.04.1 LTS & Unity 7.4.0 same as yours. – George Udosen Jan 5 '17 at 16:01
3

Simple solution would be to just right-click on the dash itself and select the specific category you want to search - Dash will be cleared automatically for that.

enter image description here

I've noticed that the re-opened Dash, has the previous text highlighted. Hitting backspace key allows for clearing and carrying out new searches without issues. If only we could automate doing that . . . Well, we can with application called xdotool and a bit of scripting magic.

Install xdotool via apt-get install xdotool and save the following script. Its basic task is to determine whether or not the active window is Dash, and automate hitting BackSpace key to clear Dash. This is meant to run as python script_name.py and to be launched when user logs in by adding this script to Startup Applications.

#!/usr/bin/env python
import dbus,time,subprocess,os

def run_cmd(cmdlist):
    """ utility: reusable function for running external commands """
    new_env = dict(os.environ)
    new_env['LC_ALL'] = 'C'
    try:
        stdout = subprocess.check_output(cmdlist, env=new_env)
    except subprocess.CalledProcessError:
        pass
    else:
        if stdout:
            return stdout


def get_dbus(bus_type, obj, path, interface, method, arg):
    """ utility: executes dbus method on specific interface"""
    if bus_type == "session":
        bus = dbus.SessionBus()
    if bus_type == "system":
        bus = dbus.SystemBus()
    proxy = bus.get_object(obj, path)
    method = proxy.get_dbus_method(method, interface)
    try:
        if arg:
            return method(arg)
        else:
            return method()
    except dbus.exceptions.DBusException:
        return None

def active_is_dash():
    base = ['session','org.ayatana.bamf']
    dbus_call = base + ['/org/ayatana/bamf/matcher', 'org.ayatana.bamf.matcher','ActiveWindow',None]
    active_window = str(get_dbus(*dbus_call))
    dbus_call =  base + [active_window,'org.ayatana.bamf.view','Name',None] 
    active_name = str(get_dbus(*dbus_call))
    if active_name == 'unity-dash': return True


command = 'xdotool key BackSpace'.split()
flag = None
while True:
    time.sleep(0.25)
    if active_is_dash():
        time.sleep(0.25)
        if not flag: run_cmd(command)
        flag = True
    else: flag = False
| improve this answer | |
  • Thanks for the suggestions and the effort. Whilst your script would do the job, I feel it's a rather heavy handed solution. As for right-clicking, reaching for the mouse would make me less productive but I'm sure it'll be good for others. – Anthony Hepple Jan 7 '17 at 21:09
  • You're welcome, and sorry i cannot provide a better solution. I know it would be a great feature if Dash had automatic cleaning , but to the best of my knowledge such options aren't available, at least not in current Unity version. Perhaps it will come in future – Sergiy Kolodyazhnyy Jan 7 '17 at 21:24
0

I discovered that clearing my usage data via

Settings > Security & Privacy > Files & Applications

greatly improved both the performance and behaviour of the the Dash. It didn't entirely solve the problem I was experiencing but it did reduce the number of times it occurred. For instance, in step 5., if I type 'fire' then pause for a second (allowing the Dash to complete a search) before typing 'fox', the application is found.

I also found a seemingly related bug report.

| improve this answer | |

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.