活动/非活动 Unity 窗口标题栏的不同颜色?

RRe*_*lax 13 colors themes unity window

哇 - 这似乎很难解决!我已经搜索并看到其他人有类似的问题/抱怨关于能够快速识别活动窗口,例如, 突出显示窗口甚至更多 但是,我还没有找到任何真正的解决方案!

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

添加窗口阴影没有多大帮助,因为全屏窗口没有阴影。另外,阴影非常微妙,所以它不是快速简单的标识符。

我习惯了 MS Windows,在那里很容易更改窗口的标题栏颜色,并且具有非常高的对比度。我可以立即看到哪个窗口是活动窗口。我经常 - 这是在 Ubuntu 上几周之后 - 在用 Ubuntu 解决这个问题时遇到问题。

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

Mos*_*zdi 5

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

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

.titlebar:backdrop  {
    background: #777777;
    color:white;
} 
Run Code Online (Sandbox Code Playgroud)

请注意,您可以选择不同的颜色来满足您的喜好。然后刷新侏儒:

setsid gnome-shell --replace
Run Code Online (Sandbox Code Playgroud)

我刚刚尝试过,它对我有用。在此处输入图片说明


Win*_*nix 5

开箱即用的解决方案

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

缺点是需要手动将窗口重新对齐到原始坐标。下一节将介绍一种更好的方法,涉及分配给快捷键的脚本。


使用快捷键显示活动窗口

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

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

显示window3.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

Run Code Online (Sandbox Code Playgroud)

突出显示活动窗口的脚本

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

Revealwindow2.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

Run Code Online (Sandbox Code Playgroud)

有些窗口不允许调整大小。在这种情况下,窗口将仅向下移动到右侧,然后返回到左侧。您仍然可以获得相同的视觉线索,即活动窗口,只是移动不同。