2

I'm looking for a toggle shortcut - hide/show Plank dock via keyboard. How can I implement this feature? To make it clear I want to Plank behaves same way as if I use a mouse cursor on it in Intelligent Hide mode.

1 Answer 1

1

Do you mean something like this?

https://gfycat.com/CraftyCooperativeHarrierhawk

I implemented this just for fun. Basically it works like this:

  1. Added DBus Functionality to Plank. This required to open 2 functions in HideManager.vala (hide and show) and a new Function in Interfaces.vala (i called id Show). Basically its the wrong place to add such a Functionality because it should only be used for Items on the Dock. But because its just a prototype so i added it there just for convencience. This is just a Interface for DBusManager.vala so i implemented it there for our functionality.

    [DBus (name = "net.launchpad.plank.Items")]
    interface DBusItemsIface : GLib.Object
    {
        /* omitted */
    
        public abstract void show() throws GLib.IOError;
    }
    
    class DBusItems : GLib.Object, Plank.DBusItemsIface {
    
        /* ommited */
    
        public void show()
        {
            if(controller.hide_manager.Hidden)
                controller.hide_manager.show();
            else {
                controller.hide_manager.hide();
            }
        }
    }
    
    public class HideManager : GLib.Object
    {
        public void hide ()
        {
            /* ommited */
        }
    
        public void show ()
        {
            /* ommited */
        }
    }
    
  2. Now we can send with dbus-send a signal to activate this functionality

    dbus-send --session --type=method_call --dest=net.launchpad.plank.dock1 /net/launchpad/plank/dock1 net.launchpad.plank.Items.Show
    
  3. Now make a script with that command and start it with a global Shortcut in Gala

Was fun to do but i must say it isnt helpful at all. Because to be useful there should be a functionality in plank which could start applications with a shortcut (like long press Super -> Plank appears -> press 1 to start/switch to first starter)

1
  • Yep, I agree with you.
    – daGo
    Commented Jan 5, 2017 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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