F15: Follow-mouse focus and hacks for GNOME shell?

sguazt marco.guazzone at gmail.com
Wed Jun 1 08:22:22 UTC 2011


On Wed, Jun 1, 2011 at 9:00 AM, Ian Malone <ibmalone at gmail.com> wrote:
> On 1 June 2011 07:50, Hiisi <hiisi at fedoraproject.org> wrote:
>> On 1 June 2011 07:16, Rahul Sundaram <metherid at gmail.com> wrote:
>>> On 06/01/2011 01:40 AM, sguazt wrote:
>>>> Didn't find a way to set this type of focus under GNOME shell.
>>>>
>>>> Searching in the Web I've found these 2 hacks:
>>>>
>>>> gconftool-2 -s /apps/metacity/general/focus_mode -t string sloppy
>>>>
>>>> or
>>>>
>>>> gconftool-2 -s /apps/metacity/general/focus_mode -t string mouse
>>>>
>>
>> I was looking for the same functionality. Just was too lame to google
>> for them. Thanks!
>>
>>>> Are they safe?
>>>
>>> Safe?  idk.  works fine
>>>
>>
>>
>> Safe? I don't care ;- )
>>
>
> My mouse burst into flames after doing this! Don't try it!
>
> (No not really, actually follow focus carried over from F13 without me
> having to do anything. So one Gnome3 thing works.)
>
lol... Obviously I meant "safe" wrt the gnome-shell behavior ;)

For what concerns the workspace-cycle I found these two links:
- http://ubuntuforums.org/archive/index.php/t-637598.html
- http://www.yet-another-geek.org/archives/14-Cycle-through-your-workspaces-in-a-loop-on-Ubuntu.html

Which inspired my this shell script:

--- [cycle_workspaces.sh] ---
#!/bin/sh

## Based on:
## - http://ubuntuforums.org/archive/index.php/t-637598.html
## - http://www.yet-another-geek.org/archives/14-Cycle-through-your-workspaces-in-a-loop-on-Ubuntu.html

function usage
{
    echo "Usage: $0 {--prev|--next}"
    exit
}

function notify
{
    # to add before "wmctrl -s $newws"

    numws=$1
    msg=$(($numws+1))
    # Use 'notify-send': nice but under Gnome-Shell the notification remains
    # in the systray.
    #notify-send "Desktop $msg" -i gnome-terminal
    # Use 'xosd': faster
    font="-adobe-helvetica-*-*-*-*-24-*-*-*-*-*-*-*"
    osd_opt="--delay=1 --outline=4 --outlinecolour=black --color=white
--pos=middle --align=center --lines=1 --font='$font'"
    killall -q osd_cat
    echo "< $msg >" | osd_cat $osd_opt - &
}

## main ##

if [ -n "$1" ]; then
    case $1 in
        --prev)
            dir=-1
            ;;
        --next)
            dir=1
            ;;
        *)
            usage
    esac
    maxws=$(wmctrl -d | wc -l)
    cmd='/\*/{ rv=($1+'$dir')%'$maxws'; } END { print (rv < 0) ?
('$maxws'-1) : rv; }'
    newws=$(wmctrl -d | awk "$cmd")
#FIXME: 'notify' function still has problems
#    notify $newws
    wmctrl -s $newws
else
    usage
fi
--- [/cycle_workspaces.sh] ---

To make it works you have to run gconf-editor and set the following keys:
- /apps/metacity/global_keybindings/run_command_1 --> <Mod4>Up
- /apps/metacity/global_keybindings/run_command_2 --> <Mod4>Down
- /apps/metacity/keybinding_commands/command_1  -->
/path/to/cycle_workspaces.sh --prev
- /apps/metacity/keybinding_commands/command_2  -->
/path/to/cycle_workspaces.sh --next

Unfortunately I have two issues:
1. I lost the super-eye-candy workspace switcher notifier (I mean the
workspace change notifier that appears when you change the workspace
with <Ctrl>Up or <Ctrl>Down)
2. I am unable to make the function "notify" work. If I use
'notify-send' the notification remains in the systray area and it's so
baaaaad. If I use xosd (osd_cat) I get an error about "unrecognized
fond"; however If I run the same command from CLI it works.

Any idea or improvement?

Cheers,

-- Marco


More information about the users mailing list