2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
5 # Checks that the bar config is parsed correctly.
10 #####################################################################
11 # test a config without any bars
12 #####################################################################
16 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
19 my $pid = launch_with_config($config);
21 my $i3 = i3(get_socket_path(0));
22 my $bars = $i3->get_bar_config()->recv;
23 is(@$bars, 0, 'no bars configured');
25 exit_gracefully($pid);
27 #####################################################################
28 # now provide a simple bar configuration
29 #####################################################################
33 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
36 # Start a default instance of i3bar which provides workspace buttons.
37 # Additionally, i3status will provide a statusline.
38 status_command i3status --foo
42 $pid = launch_with_config($config);
44 $i3 = i3(get_socket_path(0));
45 $bars = $i3->get_bar_config()->recv;
46 is(@$bars, 1, 'one bar configured');
48 my $bar_id = shift @$bars;
50 my $bar_config = $i3->get_bar_config($bar_id)->recv;
51 is($bar_config->{status_command}, 'i3status --foo', 'status_command correct');
52 ok(!$bar_config->{verbose}, 'verbose off by default');
53 ok($bar_config->{workspace_buttons}, 'workspace buttons enabled per default');
54 is($bar_config->{mode}, 'hide', 'hide mode by default');
55 is($bar_config->{position}, 'bottom', 'position bottom by default');
57 exit_gracefully($pid);
59 #####################################################################
60 # validate a more complex configuration
61 #####################################################################
65 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
68 # Start a default instance of i3bar which provides workspace buttons.
69 # Additionally, i3status will provide a statusline.
70 status_command i3status --bar
82 socket_path /tmp/foobar
88 focused_workspace #ffffff #285577
89 active_workspace #888888 #222222
90 inactive_workspace #888888 #222222
91 urgent_workspace #ffffff #900000
96 $pid = launch_with_config($config);
98 $i3 = i3(get_socket_path(0));
99 $bars = $i3->get_bar_config()->recv;
100 is(@$bars, 1, 'one bar configured');
102 my $bar_id = shift @$bars;
104 my $bar_config = $i3->get_bar_config($bar_id)->recv;
105 is($bar_config->{status_command}, 'i3status --bar', 'status_command correct');
106 ok($bar_config->{verbose}, 'verbose on');
107 ok(!$bar_config->{workspace_buttons}, 'workspace buttons disabled');
108 is($bar_config->{mode}, 'dock', 'dock mode');
109 is($bar_config->{position}, 'top', 'position top');
110 is_deeply($bar_config->{outputs}, [ 'HDMI1', 'HDMI2' ], 'outputs ok');
111 is($bar_config->{tray_output}, 'HDMI2', 'tray_output ok');
112 is($bar_config->{font}, 'Terminus', 'font ok');
113 is($bar_config->{socket_path}, '/tmp/foobar', 'socket_path ok');
114 is_deeply($bar_config->{colors},
116 background => 'ff0000',
117 statusline => '00ff00',
118 focused_workspace_text => 'ffffff',
119 focused_workspace_bg => '285577',
120 active_workspace_text => '888888',
121 active_workspace_bg => '222222',
122 inactive_workspace_text => '888888',
123 inactive_workspace_bg => '222222',
124 urgent_workspace_text => 'ffffff',
125 urgent_workspace_bg => '900000',
128 exit_gracefully($pid);