창을 포인터 공포증으로 만드는 방법은 무엇입니까?

창을 포인터 공포증으로 만드는 방법은 무엇입니까?

포인터를 움직일 때마다 창이 움직여야 한다는 뜻입니다. CCSM을 사용하여 다른 창의 "항상 위에"를 유지하기 위해 조정한 "아날로그 시계 스크린렛"과 "파일 진행 대화 상자"가 있지만 때로는 작업을 방해하는 경우가 있습니다.

이것이 가능하지 않다면 포인터를 움직일 때 숨겨서 바로 아래 응용 프로그램을 클릭할 수 있도록 하는 방법이 있습니까?

게다가 그것이 가능하지 않다면, 창문이 마치 거기에 없는 것처럼 동작하도록 만들 수 있을까요? 즉, 창은 표시되지만 포인터는 창을 인식하지 못하고 창 아래에 있는 응용 프로그램에서는 정상적으로 작동해야 합니다. 가능하다면 응용 프로그램의 투명성을 변경하고 작동하게 하시겠습니까?

답변1

Bash 스크립트 및 xdotool == cursophobia.sh

개요
나는 당신에게 도움이 될 해결책을 가지고 있다고 생각합니다. 창을 선택할 수 있는 bash 스크립트입니다. 창이 선택되면 스크립트는 미리 정의된 간격으로 창과 커서 위치를 지속적으로 폴링합니다. 커서가 너무 가까워지면 창이 방해가 되지 않는 곳으로 이동합니다.

의존
이 스크립트는 xdotool. 설치하려면 다음을 실행하세요.sudo apt-get install xdotool

스크립트: cursophobia.sh
다음 내용으로 새 bash 스크립트를 생성하고 실행 가능하게 만듭니다.

#!/bin/bash

windowSelectionDelay=5  # How long to wait for user to select a window?
buffer=10               # How close do we need to be to border to get scared?
jump=20                 # How far do we jump away from pointer when scared?
poll=.25                # How often in seconds should we poll window and mouse?
                        # locations. Increasing poll should lighten CPU load.

# ask user which window to make phobic
for s in $(seq 0 $((windowSelectionDelay - 1)))
do
    clear
    echo "Activate the window that you want to be cursophobic: $((windowSelectionDelay - s))"  
    sleep 1
done
wID=$(xdotool getactivewindow)

# find some boundary info and adjustments
# determine where the window is now
info=$(xdotool getwindowgeometry $wID)
base=$(grep -oP "[\d]+,[\d]+" <<< "$info")

# move the window to 0 0 and get real location
xdotool windowmove $wID 0 0
info=$(xdotool getwindowgeometry $wID)
realMins=$(grep -oP "[\d]+,[\d]+" <<< "$info")
xMin=$(cut -f1 -d, <<< "$realMins")
yMin=$(cut -f2 -d, <<< "$realMins")

# find offset values for no movement. This is necessary because moving 0,0
# relative to the current position sometimes actually moves the window
xdotool windowmove --relative $wID 0 0
info=$(xdotool getwindowgeometry $wID)
diff=$(grep -oP "[\d]+,[\d]+" <<< "$info")
xOffset=$[xMin - $(cut -f1 -d, <<< "$diff")]
yOffset=$[yMin- $(cut -f2 -d, <<< "$diff")]

# move window back to original location
x=$(cut -f1 -d, <<< "$base")
y=$(cut -f2 -d, <<< "$base")
xdotool windowmove $wID $[x + xOffset] $[y + yOffset]

dispSize=$(xdotool getdisplaygeometry)
xMax=$(cut -f1 -d ' ' <<< "$dispSize")
yMax=$(cut -f2 -d ' ' <<< "$dispSize")

clear
echo "You can minimize this window, but don't close it, or your window will overcome its cursophobia"
# start an infinite loop polling to see if we need to move the window.
while :
do
    # get information about where the window is
    info=$(xdotool getwindowgeometry $wID)
    position=$(grep -oP "[\d]+,[\d]+" <<< "$info")
    geometry=$(grep -oP "[\d]+x[\d]+" <<< "$info")
    height=$(cut -f2 -dx <<< "$geometry")
    width=$(cut -f1 -dx <<< "$geometry")
    top=$(cut -f2 -d, <<< "$position")
    left=$(cut -f1 -d, <<< "$position")
    bottom=$((top + height))
    right=$((left + width))

    # save mouse coordinates to x & y
    eval "$(xdotool getmouselocation | cut -f 1-2 -d ' ' | tr ' :' '\n=')"

    # If the mouse is too close to the window, move the window
    if [ $x -gt $((left - buffer)) ] && [ $x -lt $((right + buffer)) ] && [ $y -gt $((top - buffer)) ] && [ $y -lt $((bottom + buffer)) ]; then
        #figure out what side we're closest to so we know which direction to move the window
        t="$((y - top)):0 $((jump + (y - top)))"
        l="$((x - left)):$((jump + (x - left))) 0"
        b="$((bottom - y)):0 -$((jump + (bottom - y)))"
        r="$((right - x)):-$((jump + (right - x))) 0"
        coord="$(echo -e "$t\n$l\n$b\n$r" | sort -n | head -n 1 | cut -f2 -d:)"

        # set the offset values for x and y
        newX=$(cut -f1 -d ' ' <<< "$coord")
        newY=$(cut -f2 -d ' ' <<< "$coord")

        #check to make sure we're not out of bounds
        if [ $((right + newX)) -gt $xMax ]; then
            newX=$((-1 * left + xOffset))
        elif [ $((left + newX)) -lt $xMin ]; then
            newX=$((xMax - width))
        fi
        if [ $((bottom + newY)) -gt $yMax ]; then
            newY=$((-1 * top + yOffset))
        elif [ $((top + newY)) -lt $yMin ]; then
            newY=$((yMax - height))
        fi

        # move the window if it has focus
        [ $(xdotool getactivewindow) -eq $wID ] && xdotool windowmove --relative $wID $((newX + xOffset)) $((newY + yOffset))
    fi
    sleep $poll
done

맨 위의 4개 변수를 원하는 대로 편집하는 것을 잊지 마세요. 이 스크립트가 CPU에 작업을 수행하는 경우 poll변수를 더 큰 값으로 늘려보세요.

cursophobia.sh 작동 중
스크립트를 작성하고 실행 가능하게 만든 후에는 실행하십시오. 창을 선택하라는 메시지가 표시됩니다. 커서포빅을 원하는 창을 클릭하고 카운트다운이 끝날 때까지 기다리세요. 카운트다운이 끝나면 선택한 창은 호기심이 많아집니다. 커서에 대한 두려움을 극복하도록 창을 도울 준비가 되면 터미널 창을 닫거나 Ctrl+를 사용하여 터미널 창에서 스크립트를 종료하세요.c

다중 디스플레이
이로 인해 Cursophobic 창이 단일 디스플레이로 제한됩니다. 여러 디스플레이에서 작동하도록 편집할 수 있습니다.

관련 정보