开箱即用的解决方案

开箱即用的解决方案

哇 - 这似乎很难解决!我搜索了一下,发现其他人也有类似的问题/抱怨,无法快速识别活动窗口,例如, 更加聚焦地突出显示窗口 但是,我还没有找到任何真正的解决方案!

我有 3 个显示器,并且是“色盲”或“阴影盲”(比“色盲”高一级),我发现活动窗口和非活动窗口之间的差异非常细微,我无法分辨哪个是什么。

添加窗口阴影并没有多大帮助,因为全屏窗口没有阴影。另外,阴影非常微妙,因此无法快速轻松地识别。

我习惯使用微软 Windows,因为可以很容易地更改窗口的标题栏颜色,并且对比度很高。我可以立即知道哪个窗口是活动窗口。我经常在 Ubuntu 上遇到这个问题,在 Ubuntu 上已经过去了几个星期。

对我来说,简单的解决方案是为窗口的标题栏设置 2 种不同的高对比度颜色。这做不到吗?我尝试寻找其他主题,但它们似乎都坚持“所有窗口都有相同(或在我看来)颜色的标题栏,无论是否处于活动状态”。我发现这个问题非常令人沮丧。我还尝试了暗淡的非活动窗口插件,但它没有做太多事情,也没有任何帮助。(Ubuntu 16.04。3 个显示器、nvidia 控制器及其视频驱动程序)

答案1

你检查过答案了吗这个问题? 创建或编辑~/.config/gtk-3.0/gtk.css为:

.titlebar {
    background: #3089FF;
    color:white; 
}

.titlebar:backdrop  {
    background: #777777;
    color:white;
} 

请注意,您可以根据自己的喜好选择不同的颜色。然后刷新 gnome:

setsid gnome-shell --replace

我刚刚尝试过并且它对我有用。在此处输入图片描述

答案2

开箱即用的解决方案

有一个快速的小技巧,按下Alt+ F7,摇动鼠标,然后Left-Click当窗口回到您想要的位置时按下鼠标。

缺点是需要花费时间手动将窗口重新对齐到其原始坐标。下一节将介绍一种更好的方法,即使用脚本指定快捷键。


使用快捷键显示活动窗口

revealwindow2这是下一节中介绍的改进脚本。该脚本会缩小和扩大窗口,这会使浏览器窗口负担过重,必须重新格式化网页布局。

这个新脚本revealwindow3可以分配给快捷键,因此无论您身在何处,您都知道活动窗口:

显示窗口3.gif

revealwindow3bash 脚本

#!/bin/bash

# NAME: revealwindow3
# CALL: Best method is to call via hotkey.

# DESC: Reveal active window by moving it in circle on screen.
# PARM: Pare 1 override default # pixels for moving
#       For Ask Ubuntu Question:
#       https://askubuntu.com/questions/943147/different-colors-for-active-inactive-unity-window-title-bars

# DATE: November 19, 2019.

# NOTE: Enhancement to revealwindow2 which shrinks and expand sizes of window
#       which taxes browsers, etc. that have to reformat the window. Also cause
#       of epileptic like shock.

# Dependancy
command -v xdotool >/dev/null 2>&1 || { echo >&2 \
        "xdotool package required but it is not installed.  Aborting."; \
        exit 3; }

# Defaults

STEP_PIXELS=25
SLEEP=.025

if [[ "$#" -eq 1 ]] ; then
    [[ "$1" -lt 5 ]] || [[ "$1" -gt 1000 ]] && { \
        echo "STEP_PIXELS must be between 5 and 1000" ; exit 2; }
    STEP_PIXELS="$1"
fi

# Get Window Information
    WinID=$(xdotool getactivewindow)
  WinLeft=$(xwininfo -id "$WinID" | grep 'ute upper-left X:' | cut -d: -f2)
   WinTop=$(xwininfo -id "$WinID" | grep 'ute upper-left Y:' | cut -d: -f2)
#echo "Win Flds: $WinLeft x $WinTop x $WinWidth x $WinHeight"

# Array of steps
StepArr=( R R R R R D D D D L L L L L U U U U U )

CurrLeft=$(( WinLeft - (STEP_PIXELS *2) ))
[[ $CurrLeft -lt 0 ]] && CurrLeft=0
CurrTop=$(( WinTop - (STEP_PIXELS *3) ))
[[ $CurrTop -lt 0 ]] && CurrTop=0

function XdoMove () {
    local i
    i="$1"
    case "$1" in
    R)
        CurrLeft=$(( CurrLeft + STEP_PIXELS )) ;;
    D)
        CurrTop=$(( CurrTop + STEP_PIXELS )) ;;
    L)
        CurrLeft=$(( CurrLeft - STEP_PIXELS ))
        [[ $CurrLeft -lt 0 ]] && CurrLeft=0 ;;
    U)
        CurrTop=$(( CurrTop - STEP_PIXELS ))
        [[ $CurrTop -lt 0 ]] && CurrTop=0 ;;
    esac

    xdotool windowmove "$WinID" "$CurrLeft" "$CurrTop"
    sleep $SLEEP
}

xdotool windowmove "$WinID" "$CurrLeft" "$CurrTop"
for i in "${StepArr[@]}" ; do XdoMove "$i" ; done


# Restore original Window size and position just in case
xdotool windowmove "$WinID" "$WinLeft" "$WinTop"

sleep .1 # Need time for xorg to update itself.

# Compensate for Window refusing to move to top (Y) coordinate specified
   InfoTop=$(xwininfo -id "$WinID" | grep 'ute upper-left Y:' | cut -d: -f2)

if [[ $InfoTop -ne $WinTop ]] ; then
    Adjust=$((InfoTop - WinTop))
    AdjTop=$((WinTop - Adjust))
    xdotool windowmove "$WinID" "$WinLeft" "$AdjTop"
    echo "Top adjusted by: -$Adjust from: $WinTop to: $AdjTop"
fi


用于突出显示活动窗口的脚本

此方法使用快捷键。我使用Ctrl+ Alt+,W因为左小指 + 左中指 + 左拇指是一个简单的组合。将快捷键分配给脚本reavelwindow2

显示窗口2.gif

该脚本分 10 步缩小活动窗口,然后分 5 步扩大。最初我使用编写了脚本,wmctrl但它对我来说不起作用。所以我改用xdotool

#!/bin/bash

# NAME: revealwindow2
# CALL: Best method is to call via hotkey.

# DESC: Shrink and expand size of active window.
#       For Ask Ubuntu Question:
#       https://askubuntu.com/questions/943147/different-colors-for-active-inactive-unity-window-title-bars

# DATE: November 17, 2019. Modified November 18, 2019.

# Dependancy
command -v xdotool >/dev/null 2>&1 || { echo >&2 \
        "xdotool package required but it is not installed.  Aborting."; \
        exit 3; }

# Get Window Information
    WinID=$(xdotool getactivewindow)
  WinLeft=$(xwininfo -id "$WinID" | grep 'ute upper-left X:' | cut -d: -f2)
   WinTop=$(xwininfo -id "$WinID" | grep 'ute upper-left Y:' | cut -d: -f2)
 WinWidth=$(xwininfo -id "$WinID" | grep 'Width:' | cut -d: -f2)
WinHeight=$(xwininfo -id "$WinID" | grep 'Height:' | cut -d: -f2)
#echo "Win Flds: $WinLeft x $WinTop x $WinWidth x $WinHeight"

WidthStep=$(( WinWidth / 10 ))
HeightStep=$(( WinHeight / 10 ))

function XdoResize () {
    local i
    i="$1"
    NewLeft=$(( i * WidthStep/2 + WinLeft ))
    NewTop=$(( i * HeightStep/2 + WinTop ))
    NewWidth=$(( WinWidth - ( i * WidthStep) ))
    NewHeight=$(( WinHeight - ( i * HeightStep) ))

    xdotool windowsize "$WinID" "$NewWidth" "$NewHeight"
    xdotool windowmove "$WinID" "$NewLeft" "$NewTop"
    sleep .012
}

# Shrink window with xdotool
for (( i=1; i<10; i++ )) ; do XdoResize $i ; done

# Expand window with xdotool
for (( i=5; i>0; i-- )) ; do XdoResize $i ; done

# Restore original Window size and position just in case
xdotool windowsize "$WinID" "$WinWidth" "$WinHeight"
xdotool windowmove "$WinID" "$WinLeft" "$WinTop"

sleep .1 # Need time for xorg to update itself.

# Compensate for Window refusing to move to top (Y) coordinate specified
   InfoTop=$(xwininfo -id "$WinID" | grep 'ute upper-left Y:' | cut -d: -f2)

if [[ $InfoTop -ne $WinTop ]] ; then
    Adjust=$((InfoTop - WinTop))
    AdjTop=$((WinTop - Adjust))
    xdotool windowmove "$WinID" "$WinLeft" "$AdjTop"
    echo "Top adjusted by: -$Adjust from: $WinTop to: $AdjTop"
fi

有些窗口不允许调整大小。在这种情况下,窗口将向下移动到右侧,然后再向上移动到左侧。您仍然会得到相同的视觉线索,即活动窗口,只是移动方式不同。

答案3

按照 Ubuntu16.04 文档,您可以打开设置并转到通用访问部分。您只需打开高对比度即可。

您可以在“设置”>“通用访问”>“观看”>“高对比度”中找到此选项。如果您使用的是较早版本的 Ubuntu,该选项仍然有效。

相关内容