forked from mirrors/i3
Use I3SOCK environment variable for path in AnyEvent::I3 (#5987)
Commit 3ae5f31d0 introduced the I3SOCK environment variable. This
prevents us from having to call `i3 --get-socketpath'. In case the
variable doesn't exist, fall back to the old ways.
Signed-off-by: Wesley Schwengle <wesleys@opperschaap.net>
This commit is contained in:
@@ -156,7 +156,9 @@ instance on the current DISPLAY which is almost always what you want.
|
|||||||
sub new {
|
sub new {
|
||||||
my ($class, $path) = @_;
|
my ($class, $path) = @_;
|
||||||
|
|
||||||
$path = _call_i3('--get-socketpath') unless $path;
|
# We have I3SOCK now
|
||||||
|
$path ||= $ENV{I3SOCK};
|
||||||
|
$path ||= _call_i3('--get-socketpath');
|
||||||
|
|
||||||
# Check if we need to resolve ~
|
# Check if we need to resolve ~
|
||||||
if ($path =~ /~/) {
|
if ($path =~ /~/) {
|
||||||
@@ -165,6 +167,10 @@ sub new {
|
|||||||
$path =~ s/~/$home/g;
|
$path =~ s/~/$home/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!-S $path) {
|
||||||
|
die "$path is not a socket", $/;
|
||||||
|
}
|
||||||
|
|
||||||
bless { path => $path } => $class;
|
bless { path => $path } => $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user