그래서 우리는 탭 아웃라이너 확장을 가지고 있습니다.
https://chrome.google.com/webstore/detail/tabs-outliner/eggkanocgddhmammlbiijnphhppkpkmkl
이것은 Chromium을 위한 매우 훌륭한 수직 탭 관리자입니다. 문제는 화면을 너무 많이 차지하는 데다가 와이드스크린 모니터가 없다는 점입니다. 따라서 항상 표시되는 새로운 크롬 창이 화면 왼쪽을 차지합니다.
문제는 마우스를 다른 곳으로 옮기고 나열된 탭 중 하나를 두 번 클릭한 후 자동으로 숨기도록 하려면 어떻게 해야 합니까?
답변1
좋아요, 저는 이를 위한 스크립트를 작성했습니다. 다른 상황에 유사한 기능을 제공하는 것이 유용할 수도 있습니다. 그렇다면 저도 알고 싶습니다 :)
그리고 더 좋은 방법이 있으면 저도 알고 싶습니다 :)
시작 변수는 당신의 선택입니다
#!/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