mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-21 18:52:49 +00:00
Fix issues with opening the bluetooth widget
On my system, the bluetooth widget wouldn't execute the first time the button is clicked. This probably due to the fact I forgot a NULL at the end of the execl call. Now I just call system and "call" it a day
This commit is contained in:
parent
4373ab7654
commit
78f3119544
2 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
|
||||
#define UNUSED [[maybe_unused]]
|
||||
#define LOG(x) std::cout << x << '\n'
|
||||
|
@ -66,8 +67,7 @@ struct Process
|
|||
pid_t pid;
|
||||
};
|
||||
|
||||
template<typename... Args>
|
||||
inline Process OpenProcess(Args... args)
|
||||
inline Process OpenProcess(const std::string& command)
|
||||
{
|
||||
pid_t child = fork();
|
||||
ASSERT(child != -1, "fork error");
|
||||
|
@ -75,7 +75,7 @@ inline Process OpenProcess(Args... args)
|
|||
if (child == 0)
|
||||
{
|
||||
// Child
|
||||
execl(args...);
|
||||
system(command.c_str());
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -340,7 +340,7 @@ namespace System
|
|||
void StartBTScan()
|
||||
{
|
||||
StopBTScan();
|
||||
btctlProcess = OpenProcess("/bin/sh", "/bin/sh", "-c", "bluetoothctl scan on", NULL);
|
||||
btctlProcess = OpenProcess("/bin/sh -c \"bluetoothctl scan on\"");
|
||||
}
|
||||
void StopBTScan()
|
||||
{
|
||||
|
@ -403,7 +403,7 @@ namespace System
|
|||
|
||||
void OpenBTWidget()
|
||||
{
|
||||
OpenProcess("/bin/sh", "/bin/sh", "-c", "gBar bluetooth");
|
||||
OpenProcess("/bin/sh -c \"gBar bluetooth\"");
|
||||
}
|
||||
|
||||
std::string BTTypeToIcon(const BluetoothDevice& dev)
|
||||
|
|
Loading…
Reference in a new issue