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 #####################################################################
58 # ensure that reloading cleans up the old bar configs
59 #####################################################################
62 $bars = $i3->get_bar_config()->recv;
63 is(@$bars, 1, 'still one bar configured');
65 exit_gracefully($pid);
67 #####################################################################
68 # validate a more complex configuration
69 #####################################################################
73 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
76 # Start a default instance of i3bar which provides workspace buttons.
77 # Additionally, i3status will provide a statusline.
78 status_command i3status --bar
90 socket_path /tmp/foobar
96 focused_workspace #ffffff #285577
97 active_workspace #888888 #222222
98 inactive_workspace #888888 #222222
99 urgent_workspace #ffffff #900000
104 $pid = launch_with_config($config);
106 $i3 = i3(get_socket_path(0));
107 $bars = $i3->get_bar_config()->recv;
108 is(@$bars, 1, 'one bar configured');
110 $bar_id = shift @$bars;
112 $bar_config = $i3->get_bar_config($bar_id)->recv;
113 is($bar_config->{status_command}, 'i3status --bar', 'status_command correct');
114 ok($bar_config->{verbose}, 'verbose on');
115 ok(!$bar_config->{workspace_buttons}, 'workspace buttons disabled');
116 is($bar_config->{mode}, 'dock', 'dock mode');
117 is($bar_config->{position}, 'top', 'position top');
118 is_deeply($bar_config->{outputs}, [ 'HDMI1', 'HDMI2' ], 'outputs ok');
119 is($bar_config->{tray_output}, 'HDMI2', 'tray_output ok');
120 is($bar_config->{font}, 'Terminus', 'font ok');
121 is($bar_config->{socket_path}, '/tmp/foobar', 'socket_path ok');
122 is_deeply($bar_config->{colors},
124 background => 'ff0000',
125 statusline => '00ff00',
126 focused_workspace_text => 'ffffff',
127 focused_workspace_bg => '285577',
128 active_workspace_text => '888888',
129 active_workspace_bg => '222222',
130 inactive_workspace_text => '888888',
131 inactive_workspace_bg => '222222',
132 urgent_workspace_text => 'ffffff',
133 urgent_workspace_bg => '900000',
136 exit_gracefully($pid);
138 #####################################################################
139 # ensure that multiple bars get different IDs
140 #####################################################################
143 # i3 config file (v4)
144 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
147 # Start a default instance of i3bar which provides workspace buttons.
148 # Additionally, i3status will provide a statusline.
149 status_command i3status --bar
159 $pid = launch_with_config($config);
161 $i3 = i3(get_socket_path(0));
162 $bars = $i3->get_bar_config()->recv;
163 is(@$bars, 2, 'two bars configured');
164 isnt($bars->[0], $bars->[1], 'bar IDs are different');
166 my $bar1_config = $i3->get_bar_config($bars->[0])->recv;
167 my $bar2_config = $i3->get_bar_config($bars->[1])->recv;
169 isnt($bar1_config->{outputs}, $bar2_config->{outputs}, 'outputs different');
171 exit_gracefully($pid);