mirror of https://github.com/SeanOMik/swm.git
Misc config changes, added simple autostart
This commit is contained in:
parent
87ae18459f
commit
6ee58399a9
|
@ -9,10 +9,12 @@
|
|||
class Config {
|
||||
public:
|
||||
ProgramsConfig programs;
|
||||
std::string path;
|
||||
|
||||
Config(const std::string& config_path) {
|
||||
toml::value toml = toml::parse(config_path);
|
||||
this->path = config_path;
|
||||
|
||||
toml::value toml = toml::parse(path + "config.toml");
|
||||
programs = ProgramsConfig(toml["Programs"]);
|
||||
}
|
||||
};
|
16
src/main.cpp
16
src/main.cpp
|
@ -1,3 +1,4 @@
|
|||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
@ -10,14 +11,16 @@
|
|||
|
||||
#include "xdg.hpp"
|
||||
|
||||
void autostart(Config conf);
|
||||
|
||||
int main() {
|
||||
|
||||
#ifndef __DEBUG__
|
||||
Config config("config.toml");
|
||||
Config config(std::filesystem::canonical("./"));
|
||||
#else
|
||||
std::string path = xdg::ConfigHomeDir();
|
||||
path += "/swm/config.toml";
|
||||
Config config(path);
|
||||
path += "/swm/";
|
||||
Config config(std::filesystem::canonical(path));
|
||||
#endif
|
||||
|
||||
// Check if X is running
|
||||
|
@ -50,4 +53,11 @@ int main() {
|
|||
xcb_disconnect(connection);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// I stole this from a DWM patch, There has got to be a better way to do this!
|
||||
void autostart(Config conf) {
|
||||
// The & daemonizes the shell script, we need this unless we want to be blocked from starting
|
||||
std::string autostart_command = "cd " + conf.path + "; sh ./autostart.sh &";
|
||||
system(autostart_command.c_str());
|
||||
}
|
Loading…
Reference in New Issue