6

There is a Launcher icon for Expo Mode Super+S located in the Launcher. Is there a way to put a Launcher icon for Spread Mode Super+W in the Launcher?

6

Normally, you could do this with compiz's d-bus integration, but it appears to be broken in natty.

Instead, we can do this with xdotool.

Install xdotool:

sudo apt-get install xdotool

Create a script called ~/scripts/compiz-scale.sh to invoke scale:

#! /bin/sh
# Assumes compiz binding for Initiate Window Picker is Super-Tab
xdotool keydown Super && xdotool key Tab
xdotool keyup Super

(If you have a different binding, just replace Super with the meta key you use and Tab with the letter you use.)

Make the script executable:

chmod u+x ~/scripts/compiz-scale.sh

Create an app file called ~/scripts/compiz-scale.desktop to run your script:

#!/usr/bin/env xdg-open
# link me to /usr/share/applications/

[Desktop Entry]
Comment=Switch programs
Exec=/home/YOURUSERNAME/scripts/compiz-scale.sh
Icon=gnome-klotski
Name=Scale
Terminal=false
Type=Application
Version=1.0

Be sure to replace YOURUSERNAME with your user name.

In order to add to the launcher, the app file must be part of the system configuration. (If you just want it available as a search result, you can put it in ~/.local/share/applications .) We'll add a link to the file you created (so your setup is portable to new installs).

sudo ln -s ~/scripts/compiz-scale.desktop /usr/share/applications/compiz-scale.desktop

Now invoke the dash and search for "Scale". Your new app should show up. Click and drag it to the launcher. You should now be able to invoke scale from your launcher.

However, if you change your key binding it will break and you'll have to update your script. Also, it can't be invoked multiple times quickly. The launcher seems to have some double-click detection that prevents an app from being launched twice, so you have to wait before you can click again.

5
  • First Install xdotool Install xdotool from the software center
  • Create a file ~/.local/share/applications/spread.desktop
  • Open that file using gedit (or your preferred text editor)
  • Now paste the following into that file (and replace the icon path)

    [Desktop Entry]
    Name=Spread Mode
    Exec=xdotool key --delay 10 super+w
    Icon=plugin-scale
    Terminal=false
    Type=Application
    StartupNotify=true1
    
  • Now Browse to ~/.local/share/applications/

  • Find the spread.desktop and make it executable (Here's how to do that)
  • Now Drag that file into the launcher and you are done.
  • I face the same problem as the answer given by fossfreedom. You need to wait like 4-5 seconds before you can use it again. Also your link to the program does not work. I clicked it and it opened the software center but it said program not found. However I searched for xdotool and found it. – nik90 Apr 17 '11 at 8:46
  • If these are the only solutions available then I would award the bounty to fossfreedom since he was the first to come up with a answer. – nik90 Apr 17 '11 at 8:54
  • The faenza icon set has an icon for spread mode: Icon=plugin-scale – idbrii May 5 '11 at 22:40
2
+50

To do this right click the desktop and create a launcher.

Give it a name such as "Spread Mode" and choose an appropriate icon

In the command field copy and paste the following

xte "keydown Super_L" "key w" "keyup
Super_L"

next, in a terminal:

sudo apt-get install xautomation

Drag and drop the new Spread Mode Launcher Icon into the Unity Launcher.

  • I just verified your answer...it works, however once I click it to show the spread mode, I need to wait another 5 seconds to click it again to show the spread mode...It works but it would be nice if I could do that without that delay... – nik90 Apr 16 '11 at 23:15
  • @nik90 solve with this: askubuntu.com/questions/744658/… – iuridiniz Mar 23 '17 at 4:30
1

Create a launcher and exec this:

dbus-send --session --print-reply --dest=org.freedesktop.compiz /org/freedesktop/compiz/scale/allscreens/initiate_all_key org.freedesktop.compiz.activate string:"root" int32:`xwininfo -root | grep id: | awk '{ print $4 }'`

(copy and save this to the filename you used at the Exec line)

I did not create this but found it on this feature request. So kudos go to Daniel Fore

Originally this was not created for Unity but for 'elementary OS'. Should work though.

  • Kudos on the lighting fast response. I found that before, but it doesn't work on natty: Method "activate" with signature "si" on interface "org.freedesktop.compiz" doesn't exist. (Even if I turn on dbus in compiz config.) – idbrii May 3 '11 at 18:26
0

The super+w keyboard shortcut for scale is on by default in Unity as well.

  • 1
    Almost always my hands are on the keyboard and I use that shortcut, but for the occasion when I'm using the mouse, I don't want to switch back and forth. Hence my search for a clickable item. And I don't like hot corners because they're so easy to hit by accident... something to do with Fitts Law : D – idbrii May 3 '11 at 23:45
0

In addition to the button/launcher, note that you can also assign it to a 'hot spot' corner of the screen. (Similar to the way Gnome 3 does this; when you move the mouse to the very top-left, it will show all open windows in spread mode.)

To do this in Unity it's a bit harder than it should be, but still straightforward:

  • install the Compiz Config Settings Manager
  • install xdotool
  • Open Compiz Config Settings Manager and go to Commands
  • For Command0 (or any available one) enter xdotool key Super+w
  • Click the Edge Bindings tab and press the button to assign a key for Command0 (will show None if none has been defined yet.
  • Now set the area of the screen to assign the command to. Top Left works well, because for some reason this is completely un-used in Unity; normally you can't even click there to open the dash/lenses!
0

I don't think you can because the workspace icon is hardcoded into the launcher.

If you open CCSM and go to scale plugin you can set a corner of the screen to do this task.

open CCSM > Scale > Bindings

  • Yours may not have been an appropriate answer to this question, but it helped me find the right darn tab in CCSM to set that screen corner for spread mode. Thanks! :) – nem75 Apr 21 '11 at 21:33

Your Answer

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