Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upawesome WM window color black is the same for focused & unfocused #2780
Comments
andrewdavidwong
added
C: desktop-linux
help wanted
P: minor
UX
labels
Apr 27, 2017
andrewdavidwong
added this to the Far in the future milestone
Apr 27, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marmarek
Apr 27, 2017
Member
I think the important line is here: https://github.com/QubesOS/qubes-desktop-linux-awesome/blob/master/awesome-3.5.5-qubes.patch#L238-L239
Any better idea than having special case for black?
|
I think the important line is here: https://github.com/QubesOS/qubes-desktop-linux-awesome/blob/master/awesome-3.5.5-qubes.patch#L238-L239 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
3hhh
Apr 29, 2017
I tested a change of https://github.com/QubesOS/qubes-desktop-linux-awesome/blob/master/awesome-3.5.5-qubes.patch#L216 to
l = math.max(math.min((l+0.5) * factor, 1), 0)
which made it work for black VMs, but also all other colors more bright (unwanted).
The interesting part:
dom0 consoles stayed totally black, i.e. dom0 seems to be a special case not handled via the aforementioned lines.
So we already seem to have some special case for dom0 somewhere.
3hhh
commented
Apr 29, 2017
•
|
I tested a change of https://github.com/QubesOS/qubes-desktop-linux-awesome/blob/master/awesome-3.5.5-qubes.patch#L216 to The interesting part: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
3hhh
Apr 30, 2017
local function ensure_min_luminance(colour, minLuminance)
local r, g, b = color.parse_color(colour)
h, l, s = rgb_to_hls(r, g, b)
l = math.max(l,minLuminance)
r, g, b = hls_to_rgb(h, l, s)
return string.format('#%02x%02x%02x',
math.floor(r * 0xff), math.floor(g * 0xff), math.floor(b * 0xff))
end
function qubes.init()
local minLuminance = 0.3
local shiftUnfocused = 0.5
local blackSafe = ensure_min_luminance("#000000", minLuminance)
-- read labels
qubes.labels = { ['*'] = {
--all other (= dom0) windows
colour = shift_luminance(blackSafe, shiftUnfocused),
colour_focus = blackSafe
} }
local data = util.pread([[python -c "
import qubes.qubes
print(''.join('{}:{}\n'.format(l.index, l.color)
for l in qubes.qubes.QubesVmLabels.values()))
"]])
for index, colour in string.gmatch(data, '(%d):0x([0-9a-f]+)') do
colour = '#' .. colour
--ensure min luminance so we can shift it for unfocused windows
colour = ensure_min_luminance(colour,minLuminance)
qubes.labels[index] = { colour = shift_luminance(colour, shiftUnfocused),
colour_focus = colour }
end
endseems to do the trick incl. dom0 windows.
Actually it will ensure that all VM colors are sufficiently bright to be able to reduce the luminance/brightness when they are unfocused. So it'll also have an effect on e.g. dark blue VMs (default colour gets more bright - so focused dom0 is now e.g. gray).
I'll test this for some time...
3hhh
commented
Apr 30, 2017
•
local function ensure_min_luminance(colour, minLuminance)
local r, g, b = color.parse_color(colour)
h, l, s = rgb_to_hls(r, g, b)
l = math.max(l,minLuminance)
r, g, b = hls_to_rgb(h, l, s)
return string.format('#%02x%02x%02x',
math.floor(r * 0xff), math.floor(g * 0xff), math.floor(b * 0xff))
end
function qubes.init()
local minLuminance = 0.3
local shiftUnfocused = 0.5
local blackSafe = ensure_min_luminance("#000000", minLuminance)
-- read labels
qubes.labels = { ['*'] = {
--all other (= dom0) windows
colour = shift_luminance(blackSafe, shiftUnfocused),
colour_focus = blackSafe
} }
local data = util.pread([[python -c "
import qubes.qubes
print(''.join('{}:{}\n'.format(l.index, l.color)
for l in qubes.qubes.QubesVmLabels.values()))
"]])
for index, colour in string.gmatch(data, '(%d):0x([0-9a-f]+)') do
colour = '#' .. colour
--ensure min luminance so we can shift it for unfocused windows
colour = ensure_min_luminance(colour,minLuminance)
qubes.labels[index] = { colour = shift_luminance(colour, shiftUnfocused),
colour_focus = colour }
end
endseems to do the trick incl. dom0 windows. I'll test this for some time... |
3hhh commentedApr 27, 2017
•
edited
Edited 1 time
-
3hhh
edited Apr 27, 2017 (most recent)
In Qubes 3.2R2 qubes.get_colour_focus(c) and qubes.get_colour(c) of /usr/share/awesome/lib/qubes.lua return the same color (black) for windows labeled with black, i.e. dom0 or e.g. vault windows.
Expected behavior: Dark gray for the non-focused version in order to identify the focused window (similar behavior for all other colors appears to be implemented, just black isn't working).
Possible impact: Typing in the wrong VM ("focus steal").