Add NeoUI passcode configurator, duress mode profile, and Bluetooth OBEX UI
This commit is contained in:
1 parent
51a1a91d42
commit
62ac46e498
100 files changed
+2736
-240
No files matched your search
@@ -106,9 +106,7 @@ void popUtf8(std::string& s) {
|
||||
}
|
||||
|
||||
std::string getXthemesDir() {
|
||||
const char* home = std::getenv("HOME");
|
||||
std::string dir =
|
||||
std::string((home && home[0]) ? home : "/home/user") + "/.xthemes";
|
||||
std::string dir = getHomeDirPath() + "/.xthemes";
|
||||
::mkdir(dir.c_str(), 0755);
|
||||
return dir;
|
||||
}
|
||||
@@ -147,6 +145,26 @@ void updateRootResourceManager(const std::string& xresContent,
|
||||
|
||||
void ensureDefaultThemesSeeded() {
|
||||
std::string dir = getXthemesDir();
|
||||
if (isDuressMode()) {
|
||||
std::string nordPath = dir + "/NordFrost.xth";
|
||||
if (::access(nordPath.c_str(), R_OK) != 0 &&
|
||||
::access("/etc/skel/.xthemes/NordFrost.xth", R_OK) == 0) {
|
||||
ThemeSpec ts;
|
||||
ts.name = "NordFrost";
|
||||
if (ts.loadFromFile("/etc/skel/.xthemes/NordFrost.xth")) {
|
||||
ts.name = "NordFrost";
|
||||
writeTextFile(nordPath, ts.serializeXresources());
|
||||
}
|
||||
}
|
||||
std::string xresPath = getXresourcesPath();
|
||||
if (::access(xresPath.c_str(), R_OK) != 0) {
|
||||
ThemeSpec nordSpec;
|
||||
nordSpec.loadFromFile(nordPath);
|
||||
writeTextFile(xresPath, nordSpec.serializeXresources());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::string defPath = dir + "/Default.xth";
|
||||
if (::access(defPath.c_str(), R_OK) != 0) {
|
||||
if (::access("/etc/skel/.xthemes/Default.xth", R_OK) == 0) {
|
||||
@@ -216,6 +234,9 @@ std::vector<ThemeFileEntry> loadInstalledThemes(const ThemeSpec& activeSpec) {
|
||||
if (fname.size() <= 4 || fname.substr(fname.size() - 4) != ".xth") {
|
||||
continue;
|
||||
}
|
||||
if (isDuressMode() && fname != "NordFrost.xth") {
|
||||
continue;
|
||||
}
|
||||
ThemeFileEntry item;
|
||||
item.name = fname.substr(0, fname.size() - 4);
|
||||
item.fullPath = dir + "/" + fname;
|
||||
@@ -469,16 +490,20 @@ int runThemesApp(int argc, char** argv) {
|
||||
actionsList.clear();
|
||||
if (!themes.empty()) {
|
||||
actionsList.push_back({1, kIconCheck, "Apply Selected Theme"});
|
||||
actionsList.push_back({2, kIconPalette, "Customize Theme Colors/Font"});
|
||||
if (!isDuressMode()) {
|
||||
actionsList.push_back({2, kIconPalette, "Customize Theme Colors/Font"});
|
||||
}
|
||||
}
|
||||
actionsList.push_back({3, kIconPlus, "Save Current as New Theme"});
|
||||
if (!themes.empty()) {
|
||||
actionsList.push_back({4, kIconCopy, "Duplicate Theme"});
|
||||
actionsList.push_back({5, kIconEdit, "Edit .xth in Nano"});
|
||||
}
|
||||
actionsList.push_back({6, kIconSort, "Reset Default Theme"});
|
||||
if (!themes.empty() && themes[selected].name != "Default") {
|
||||
actionsList.push_back({7, kIconTrash, "Delete Theme"});
|
||||
if (!isDuressMode()) {
|
||||
actionsList.push_back({3, kIconPlus, "Save Current as New Theme"});
|
||||
if (!themes.empty()) {
|
||||
actionsList.push_back({4, kIconCopy, "Duplicate Theme"});
|
||||
actionsList.push_back({5, kIconEdit, "Edit .xth in Nano"});
|
||||
}
|
||||
actionsList.push_back({6, kIconSort, "Reset Default Theme"});
|
||||
if (!themes.empty() && themes[selected].name != "Default") {
|
||||
actionsList.push_back({7, kIconTrash, "Delete Theme"});
|
||||
}
|
||||
}
|
||||
actionSelected = 0;
|
||||
};
|
||||
@@ -1145,13 +1170,13 @@ int runThemesApp(int argc, char** argv) {
|
||||
drawUI();
|
||||
} else {
|
||||
char d = mapDialKey(sym, kc, ev.xkey.state);
|
||||
if (d == '*' && !themes.empty()) {
|
||||
if (d == '*' && !themes.empty() && !isDuressMode()) {
|
||||
editSpec = themes[selected].spec;
|
||||
editThemeName = themes[selected].name;
|
||||
editField = 0;
|
||||
mode = ViewMode::Customize;
|
||||
drawUI();
|
||||
} else if (d == '#') {
|
||||
} else if (d == '#' && !isDuressMode()) {
|
||||
nameAction = NameModalAction::SaveCurrentAs;
|
||||
nameTitle = "Save Theme As";
|
||||
nameInput = "Custom";
|
||||
|
||||
Reference in new issue
Block a user