Skip to content

Commit b2e2660

Browse files
committed
i3: only check return value of i3 --get-socketpath
1 parent 4620bdd commit b2e2660

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

desktopsupport/i3.cpp

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
#include "i3.h"
22
#include "../debug.h"
3-
#include <boost/throw_exception.hpp>
4-
#include <stdio.h>
53
#include <sstream>
64
#include <iostream>
7-
#include <thread>
8-
#include <chrono>
95
#include <QApplication>
106

11-
namespace {
12-
typedef std::unique_ptr<
13-
FILE,
14-
decltype(&pclose)
15-
> FILEptr;
16-
}
17-
187
using namespace std;
198

209
DesktopEnvironmentHandlerQuality i3DesktopSupport::quality() const {
@@ -42,6 +31,7 @@ const std::string i3OutputHandle::name() const {
4231

4332
OutputList i3DesktopSupport::getOutputs() const {
4433
/** FIXME: Dummy code */
34+
/** FIXME: Parse output of i3-msg --get-outputs with a JSON parser */
4535
OutputList list;
4636
list.emplace_back( new i3OutputHandle("DVI-I-1", true) );
4737
list.emplace_back( new i3OutputHandle("VGA-0", false) );
@@ -91,11 +81,13 @@ const string i3DesktopSupport::getSocketpath() {
9181
if ( ! spath.empty() ) {
9282
return spath;
9383
}
94-
/** Socketpath not cached */
9584

96-
/** FIXME: Port this to boost or similar */
97-
FILEptr fd( popen("i3 --get-socketpath", "r"), pclose );
85+
/** FIXME: Actually check the return STRING, not just the retval */
86+
int ret = system("i3 --get-socketpath");
9887

88+
if ( ret == 0 ) {
89+
spath = "OK";
90+
}
9991

100-
return "/run/user/1000/i3/ipc-socket.1468";
92+
return spath;
10193
}

0 commit comments

Comments
 (0)