-
Notifications
You must be signed in to change notification settings - Fork 2
/
GlobalParameters.cpp
41 lines (33 loc) · 990 Bytes
/
GlobalParameters.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "GlobalParameters.hpp"
#include "td/utils/Slice-decl.h"
#include <unistd.h>
namespace tdcurses {
GlobalParameters &global_parameters() {
static GlobalParameters ptr;
return ptr;
}
void GlobalParameters::copy_to_primary_buffer(td::CSlice text) {
auto p = vfork();
if (!p) {
execlp(copy_command_.c_str(), copy_command_.c_str(), "--primary", "--", text.c_str(), NULL);
}
}
void GlobalParameters::copy_to_clipboard(td::CSlice text) {
auto p = vfork();
if (!p) {
execlp(copy_command_.c_str(), copy_command_.c_str(), "--", text.c_str(), NULL);
}
}
void GlobalParameters::open_document(td::CSlice file_path) {
auto p = vfork();
if (!p) {
execlp(file_open_command_.c_str(), file_open_command_.c_str(), "--", file_path.c_str(), NULL);
}
}
void GlobalParameters::open_link(td::CSlice url) {
auto p = vfork();
if (!p) {
execlp(link_open_command_.c_str(), link_open_command_.c_str(), url.c_str(), (char *)NULL);
}
}
} // namespace tdcurses