Implement showing window icons in titlebar (#4439)
This feature defaults to off, and can be turned on for individual windows, or (with for_window) for all new windows. See the userguide change. This commit is partially based on work by: • Marius Muja • mickael9 • Esteve Varela Colominas • Bernardo Menicagli
This commit is contained in:
committed by
GitHub
parent
eaa5e636f9
commit
abbf6a85d7
@ -73,6 +73,7 @@ my $expected = {
|
||||
workspace_layout => 'default',
|
||||
current_border_width => -1,
|
||||
marks => $ignore,
|
||||
window_icon_padding => -1,
|
||||
};
|
||||
|
||||
# a shallow copy is sufficient, since we only ignore values at the root
|
||||
|
@ -176,6 +176,7 @@ is(parser_calls('unknown_literal'),
|
||||
scratchpad
|
||||
swap
|
||||
title_format
|
||||
title_window_icon
|
||||
mode
|
||||
bar
|
||||
)) . "'\n" .
|
||||
|
62
testcases/t/314-window-icon-padding.t
Normal file
62
testcases/t/314-window-icon-padding.t
Normal file
@ -0,0 +1,62 @@
|
||||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
#
|
||||
# Please read the following documents before working on tests:
|
||||
# • https://build.i3wm.org/docs/testsuite.html
|
||||
# (or docs/testsuite)
|
||||
#
|
||||
# • https://build.i3wm.org/docs/lib-i3test.html
|
||||
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
||||
#
|
||||
# • https://build.i3wm.org/docs/ipc.html
|
||||
# (or docs/ipc)
|
||||
#
|
||||
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||
# (unless you are already familiar with Perl)
|
||||
#
|
||||
# Verifies title_window_icon behavior.
|
||||
use i3test i3_autostart => 0;
|
||||
|
||||
sub window_icon_padding {
|
||||
my ($ws) = @_;
|
||||
my ($nodes, $focus) = get_ws_content($ws);
|
||||
ok(@{$nodes} == 1, 'precisely one container on workspace');
|
||||
return $nodes->[0]->{'window_icon_padding'};
|
||||
}
|
||||
|
||||
my $config = <<"EOT";
|
||||
# i3 config file (v4)
|
||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||
EOT
|
||||
my $pid = launch_with_config($config);
|
||||
|
||||
my $tmp = fresh_workspace;
|
||||
|
||||
cmd 'open';
|
||||
is(window_icon_padding($tmp), -1, 'window_icon_padding defaults to -1');
|
||||
|
||||
cmd 'title_window_icon on';
|
||||
isnt(window_icon_padding($tmp), -1, 'window_icon_padding no longer -1');
|
||||
|
||||
exit_gracefully($pid);
|
||||
|
||||
################################################################################
|
||||
# Verify title_window_icon can be used with for_window as expected
|
||||
################################################################################
|
||||
|
||||
$config = <<"EOT";
|
||||
# i3 config file (v4)
|
||||
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||
|
||||
for_window [class=".*"] title_window_icon padding 3px
|
||||
EOT
|
||||
$pid = launch_with_config($config);
|
||||
|
||||
$tmp = fresh_workspace;
|
||||
|
||||
open_window;
|
||||
is(window_icon_padding($tmp), 3, 'window_icon_padding set to 3');
|
||||
|
||||
exit_gracefully($pid);
|
||||
|
||||
done_testing;
|
Reference in New Issue
Block a user