tests: get the socket path from the X11 atom I3_SOCKET_PATH
The hard-coded socket paths are not useful when running the test suite in parallel.
This commit is contained in:
parent
18513e1638
commit
49ea805905
|
@ -8,9 +8,6 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
|
||||||
# Use Mouse+Mod1 to drag floating windows to their wanted position
|
# Use Mouse+Mod1 to drag floating windows to their wanted position
|
||||||
floating_modifier Mod1
|
floating_modifier Mod1
|
||||||
|
|
||||||
# temporary path during development
|
|
||||||
ipc-socket /tmp/nestedcons
|
|
||||||
|
|
||||||
# Open empty container
|
# Open empty container
|
||||||
bindsym Mod1+Shift+Return open
|
bindsym Mod1+Shift+Return open
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ use i3test;
|
||||||
use X11::XCB qw(:all);
|
use X11::XCB qw(:all);
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN {
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
fresh_workspace;
|
fresh_workspace;
|
||||||
|
|
||||||
cmd 'split h';
|
cmd 'split h';
|
||||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# verify that there is no dock window yet
|
# verify that there is no dock window yet
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN {
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
cmd 'split h';
|
cmd 'split h';
|
||||||
|
|
|
@ -9,7 +9,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use i3test;
|
use i3test;
|
||||||
use List::MoreUtils qw(all);
|
use List::MoreUtils qw(all);
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Request workspaces
|
# Request workspaces
|
||||||
|
|
|
@ -5,7 +5,7 @@ use i3test;
|
||||||
use List::MoreUtils qw(all none);
|
use List::MoreUtils qw(all none);
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Request tree
|
# Request tree
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use List::Util qw(first);
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
# We move the pointer out of our way to avoid a bug where the focus will
|
# We move the pointer out of our way to avoid a bug where the focus will
|
||||||
# be set to the window under the cursor
|
# be set to the window under the cursor
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ BEGIN {
|
||||||
use_ok('X11::XCB::Window');
|
use_ok('X11::XCB::Window');
|
||||||
}
|
}
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
||||||
use_ok('X11::XCB::Window');
|
use_ok('X11::XCB::Window');
|
||||||
}
|
}
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN {
|
||||||
use_ok('X11::XCB::Window');
|
use_ok('X11::XCB::Window');
|
||||||
}
|
}
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ BEGIN {
|
||||||
use_ok('X11::XCB::Window');
|
use_ok('X11::XCB::Window');
|
||||||
}
|
}
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
sub check_order {
|
sub check_order {
|
||||||
|
|
|
@ -10,7 +10,7 @@ BEGIN {
|
||||||
use_ok('X11::XCB::Window');
|
use_ok('X11::XCB::Window');
|
||||||
}
|
}
|
||||||
|
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
sub check_order {
|
sub check_order {
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
subtest 'Window without WM_TAKE_FOCUS', sub {
|
subtest 'Window without WM_TAKE_FOCUS', sub {
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use List::Util qw(first);
|
||||||
use i3test;
|
use i3test;
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
my $window = open_standard_window($x);
|
my $window = open_standard_window($x);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $x = X11::XCB::Connection->new;
|
my $x = X11::XCB::Connection->new;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,12 @@ sub set_wm_class {
|
||||||
# start a window and see that it does not get assigned with an empty config
|
# start a window and see that it does not get assigned with an empty config
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
my $socketpath = File::Temp::tempnam('/tmp', 'i3-test-socket-');
|
||||||
|
|
||||||
my ($fh, $tmpfile) = tempfile();
|
my ($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
diag("Starting i3");
|
diag("Starting i3");
|
||||||
|
@ -52,6 +54,9 @@ my $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c
|
||||||
my $process = Proc::Background->new($i3cmd);
|
my $process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
@ -86,7 +91,7 @@ sleep 0.25;
|
||||||
($fh, $tmpfile) = tempfile();
|
($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
say $fh q|assign "special" → targetws|;
|
say $fh q|assign "special" → targetws|;
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
|
@ -95,6 +100,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
|
||||||
$process = Proc::Background->new($i3cmd);
|
$process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
@ -134,6 +142,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
|
||||||
$process = Proc::Background->new($i3cmd);
|
$process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
# initialize the target workspace, then go to a fresh one
|
# initialize the target workspace, then go to a fresh one
|
||||||
|
@ -172,7 +183,7 @@ exit_gracefully($process->pid);
|
||||||
($fh, $tmpfile) = tempfile();
|
($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
say $fh q|assign "special" → ~|;
|
say $fh q|assign "special" → ~|;
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
|
@ -181,6 +192,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
|
||||||
$process = Proc::Background->new($i3cmd);
|
$process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
|
@ -22,10 +22,12 @@ my $i3_path = abs_path("../i3");
|
||||||
# other and no split containers are created
|
# other and no split containers are created
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
my $socketpath = File::Temp::tempnam('/tmp', 'i3-test-socket-');
|
||||||
|
|
||||||
my ($fh, $tmpfile) = tempfile();
|
my ($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
diag("Starting i3");
|
diag("Starting i3");
|
||||||
|
@ -33,6 +35,9 @@ my $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c
|
||||||
my $process = Proc::Background->new($i3cmd);
|
my $process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
@ -57,7 +62,7 @@ exit_gracefully($process->pid);
|
||||||
($fh, $tmpfile) = tempfile();
|
($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
say $fh "workspace_layout stacked";
|
say $fh "workspace_layout stacked";
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
|
@ -66,6 +71,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
|
||||||
$process = Proc::Background->new($i3cmd);
|
$process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
|
@ -15,6 +15,7 @@ my $x = X11::XCB::Connection->new;
|
||||||
|
|
||||||
# assuming we are run by complete-run.pl
|
# assuming we are run by complete-run.pl
|
||||||
my $i3_path = abs_path("../i3");
|
my $i3_path = abs_path("../i3");
|
||||||
|
my $socketpath = File::Temp::tempnam('/tmp', 'i3-test-socket-');
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# 1: test the wrapping behaviour without force_focus_wrapping
|
# 1: test the wrapping behaviour without force_focus_wrapping
|
||||||
|
@ -23,7 +24,7 @@ my $i3_path = abs_path("../i3");
|
||||||
my ($fh, $tmpfile) = tempfile();
|
my ($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
diag("Starting i3");
|
diag("Starting i3");
|
||||||
|
@ -31,6 +32,9 @@ my $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c
|
||||||
my $process = Proc::Background->new($i3cmd);
|
my $process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
my $tmp = fresh_workspace;
|
my $tmp = fresh_workspace;
|
||||||
|
@ -69,7 +73,7 @@ exit_gracefully($process->pid);
|
||||||
($fh, $tmpfile) = tempfile();
|
($fh, $tmpfile) = tempfile();
|
||||||
say $fh "# i3 config file (v4)";
|
say $fh "# i3 config file (v4)";
|
||||||
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
|
||||||
say $fh "ipc-socket /tmp/nestedcons";
|
say $fh "ipc-socket $socketpath";
|
||||||
say $fh "force_focus_wrapping true";
|
say $fh "force_focus_wrapping true";
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
|
@ -78,6 +82,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
|
||||||
$process = Proc::Background->new($i3cmd);
|
$process = Proc::Background->new($i3cmd);
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
|
# force update of the cached socket path in lib/i3test
|
||||||
|
get_socket_path(0);
|
||||||
|
|
||||||
diag("pid = " . $process->pid);
|
diag("pid = " . $process->pid);
|
||||||
|
|
||||||
$tmp = fresh_workspace;
|
$tmp = fresh_workspace;
|
||||||
|
|
|
@ -14,9 +14,10 @@ use Try::Tiny;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|
||||||
use Exporter ();
|
use Exporter ();
|
||||||
our @EXPORT = qw(get_workspace_names get_unused_workspace fresh_workspace get_ws_content get_ws get_focused open_empty_con open_standard_window get_dock_clients cmd does_i3_live exit_gracefully workspace_exists focused_ws);
|
our @EXPORT = qw(get_workspace_names get_unused_workspace fresh_workspace get_ws_content get_ws get_focused open_empty_con open_standard_window get_dock_clients cmd does_i3_live exit_gracefully workspace_exists focused_ws get_socket_path);
|
||||||
|
|
||||||
my $tester = Test::Builder->new();
|
my $tester = Test::Builder->new();
|
||||||
|
my $_cached_socket_path = undef;
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
my $window_count = 0;
|
my $window_count = 0;
|
||||||
|
@ -69,7 +70,7 @@ sub open_empty_con {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_workspace_names {
|
sub get_workspace_names {
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $tree = $i3->get_tree->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @outputs = @{$tree->{nodes}};
|
my @outputs = @{$tree->{nodes}};
|
||||||
my @cons;
|
my @cons;
|
||||||
|
@ -96,7 +97,7 @@ sub fresh_workspace {
|
||||||
|
|
||||||
sub get_ws {
|
sub get_ws {
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $tree = $i3->get_tree->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
|
|
||||||
my @outputs = @{$tree->{nodes}};
|
my @outputs = @{$tree->{nodes}};
|
||||||
|
@ -143,7 +144,7 @@ sub get_focused {
|
||||||
sub get_dock_clients {
|
sub get_dock_clients {
|
||||||
my $which = shift;
|
my $which = shift;
|
||||||
|
|
||||||
my $tree = i3("/tmp/nestedcons")->get_tree->recv;
|
my $tree = i3(get_socket_path())->get_tree->recv;
|
||||||
my @outputs = @{$tree->{nodes}};
|
my @outputs = @{$tree->{nodes}};
|
||||||
# Children of all dockareas
|
# Children of all dockareas
|
||||||
my @docked;
|
my @docked;
|
||||||
|
@ -164,7 +165,7 @@ sub get_dock_clients {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cmd {
|
sub cmd {
|
||||||
i3("/tmp/nestedcons")->command(@_)->recv
|
i3(get_socket_path())->command(@_)->recv
|
||||||
}
|
}
|
||||||
|
|
||||||
sub workspace_exists {
|
sub workspace_exists {
|
||||||
|
@ -173,7 +174,7 @@ sub workspace_exists {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub focused_ws {
|
sub focused_ws {
|
||||||
my $i3 = i3("/tmp/nestedcons");
|
my $i3 = i3(get_socket_path());
|
||||||
my $tree = $i3->get_tree->recv;
|
my $tree = $i3->get_tree->recv;
|
||||||
my @outputs = @{$tree->{nodes}};
|
my @outputs = @{$tree->{nodes}};
|
||||||
my @cons;
|
my @cons;
|
||||||
|
@ -186,7 +187,7 @@ sub focused_ws {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub does_i3_live {
|
sub does_i3_live {
|
||||||
my $tree = i3('/tmp/nestedcons')->get_tree->recv;
|
my $tree = i3(get_socket_path())->get_tree->recv;
|
||||||
my @nodes = @{$tree->{nodes}};
|
my @nodes = @{$tree->{nodes}};
|
||||||
my $ok = (@nodes > 0);
|
my $ok = (@nodes > 0);
|
||||||
$tester->ok($ok, 'i3 still lives');
|
$tester->ok($ok, 'i3 still lives');
|
||||||
|
@ -196,7 +197,7 @@ sub does_i3_live {
|
||||||
# Tries to exit i3 gracefully (with the 'exit' cmd) or kills the PID if that fails
|
# Tries to exit i3 gracefully (with the 'exit' cmd) or kills the PID if that fails
|
||||||
sub exit_gracefully {
|
sub exit_gracefully {
|
||||||
my ($pid, $socketpath) = @_;
|
my ($pid, $socketpath) = @_;
|
||||||
$socketpath ||= '/tmp/nestedcons';
|
$socketpath ||= get_socket_path();
|
||||||
|
|
||||||
my $exited = 0;
|
my $exited = 0;
|
||||||
try {
|
try {
|
||||||
|
@ -210,4 +211,22 @@ sub exit_gracefully {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Gets the socket path from the I3_SOCKET_PATH atom stored on the X11 root window
|
||||||
|
sub get_socket_path {
|
||||||
|
my ($cache) = @_;
|
||||||
|
$cache ||= 1;
|
||||||
|
|
||||||
|
if ($cache && defined($_cached_socket_path)) {
|
||||||
|
return $_cached_socket_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $x = X11::XCB::Connection->new;
|
||||||
|
my $atom = $x->atom(name => 'I3_SOCKET_PATH');
|
||||||
|
my $cookie = $x->get_property(0, $x->get_root_window(), $atom->id, GET_PROPERTY_TYPE_ANY, 0, 256);
|
||||||
|
my $reply = $x->get_property_reply($cookie->{sequence});
|
||||||
|
my $socketpath = $reply->{value};
|
||||||
|
$_cached_socket_path = $socketpath;
|
||||||
|
return $socketpath;
|
||||||
|
}
|
||||||
|
|
||||||
1
|
1
|
||||||
|
|
Loading…
Reference in New Issue