como fazer Tabs Outliner, para o navegador Chromium, pop-up no mouse mover para a borda da tela?

2

Então, temos a extensão Tablin Outliner

link

Esse é um gerenciador de guias verticais muito bom para o cromo. O problema é que ele ocupa muita tela, e eu não tenho um monitor widescreen. Portanto, é uma nova janela do Chrome que fica visível o tempo todo, ocupando o lado esquerdo da tela.

O problema é: como ele se oculta automaticamente depois que você move o mouse para fora dele e depois clica duas vezes em uma de suas guias listadas?

    
por Aquarius Power 02.04.2013 / 21:48

1 resposta

1

ok, eu consegui codificar um script para isso, você pode achar útil fornecer funcionalidade semelhante a outras situações. Se você quiser, eu também gostaria de saber:)

Além disso, se houver uma maneira melhor de fazer isso, também gostaria de saber:)

as variáveis iniciais são suas opções

#!/bin/bash -i

waitStart=5
delayRaiseTabOutliner=0.1
screenLeftMarginOpen=10
screenLeftMarginClose=200
bUseScreenLeftMarginClose=false
bGoToChromiumWhenTablinkIsDoubleClicked=true

function FUNCparent() {
    xwininfo -tree -id $1 |grep "Parent window id"
}
function FUNCparentest() {
    local check='printf %d $1'
    local parent=-1
    local parentest=-1

    #echo "Child is: $check" >&2

    while ! FUNCparent $check |grep -q "(the root window)"; do
      #echo "a $check" >&2 #DEBUG info
        xwininfo -id $check |grep "Window id" >&2 #report
        parent='FUNCparent $check |egrep -o "0x[^ ]* "'
        parent='printf %d $parent'
        check=$parent
        sleep 1
    done
    if((parent!=-1));then
        parentest=$parent
    fi

    if((parentest!=-1));then
        echo $parentest
        #echo "Parentest is: $check" >&2
    else
        echo $1
        #echo "Child has no parent." >&2
    fi
}

while true; do
    list=('xdotool search Chromium 2>/dev/null')
    chromiumWindowId=""
    for windowId in 'echo ${list[*]}'; do 
        if xwininfo -id $windowId |grep "Window id" |egrep -oq " - Chromium\"$"; then
            chromiumWindowId=$windowId
            xwininfo -id $chromiumWindowId |grep "Window id" #report
            break;
        fi
    done
    if [[ -z "$chromiumWindowId" ]]; then
        sleep $waitStart
        continue;
    fi

    list=('xdotool search "Tabs Outliner" 2>/dev/null')
    tabsOutlinerWindowId=""
    for windowId in 'echo ${list[*]}'; do 
        if xwininfo -id $windowId |grep "Window id" |egrep -oq "\"Tabs Outliner\"$"; then
            tabsOutlinerWindowId='FUNCparentest $windowId'
            xwininfo -id $tabsOutlinerWindowId |grep "Window id" #report
            break;
        fi
    done
    if [[ -z "$tabsOutlinerWindowId" ]]; then
        sleep $waitStart
        continue;
    fi

    previousWindowId=-1
    previousChromeTabName=""
    while true; do
        # check if chromium is still running
        if ! xdotool getwindowname $chromiumWindowId 2>&1 >/dev/null; then
            break;
        fi
        if ! xdotool getwindowname $tabsOutlinerWindowId 2>&1 >/dev/null; then
            break;
        fi

        # info about window below mouse (even if have not focus)
        eval 'xdotool getmouselocation --shell 2>/dev/null'
        windowId=$WINDOW
        mouseX=$X
        mouseY=$Y

# not working yet...        
        # must work only if over chromium application windows
        #activeWindow='xdotool getactivewindow'
        #activeWindow='FUNCparentest $activeWindow'

        #echo "windowId=$windowId, chromiumWindowId=$chromiumWindowId, tabsOutlinerWindowId=$tabsOutlinerWindowId, previousWindowId=$previousWindowId, activeWindow=$activeWindow" #DEBUG info

# not working yet...        
        # only allowed to work if chromium windows has focus
#       if((activeWindow!=chromiumWindowId && activeWindow!=tabsOutlinerWindowId));then
#           sleep $delayRaiseTabOutliner
#           continue
#       fi
        #echo "Chromium app is active."

        # from chromium to tabs outliner!
        if((windowId==chromiumWindowId));then
            if((mouseX<screenLeftMarginOpen));then
                xdotool windowactivate $tabsOutlinerWindowId
                echo "activate TabOutliner ('date')"
            fi
        fi

        # from tabs outliner to chromium
        bActivatedChromium=false
        # when a tabs outliner tab is double clicked, it changes chromium window current tab!
        if $bGoToChromiumWhenTablinkIsDoubleClicked; then
            if((windowId==tabsOutlinerWindowId));then
                currentChromeTabName='xprop -id $chromiumWindowId |grep "^WM_NAME(STRING) = \""'
                if [[ -z "$previousChromeTabName" ]]; then
                    previousChromeTabName="$currentChromeTabName"
                fi
                if [[ "$currentChromeTabName" != "$previousChromeTabName" ]]; then
                    xdotool windowactivate $chromiumWindowId
                    bActivatedChromium=true
                fi
                previousChromeTabName="$currentChromeTabName"
            fi
        fi

        if $bUseScreenLeftMarginClose;then
            if((windowId==tabsOutlinerWindowId));then
                if((mouseX>screenLeftMarginClose));then
                    xdotool windowactivate $chromiumWindowId
                    bActivatedChromium=true
                fi
            fi
        else
            if((previousWindowId==tabsOutlinerWindowId));then
                if((windowId==chromiumWindowId));then
                    xdotool windowactivate $chromiumWindowId
                    bActivatedChromium=true
                fi
            fi
        fi

        if $bActivatedChromium; then
            echo "activate Chromium ('date')"
        fi

        previousWindowId=$windowId

        sleep $delayRaiseTabOutliner
    done
done
    
por 03.04.2013 / 04:18

Tags