Skip to content

Commit a229e87

Browse files
authored
Merge pull request #1515 from vandabbin/fix-force-tty-config
fix: set tty mode if force_tty is true in config file
2 parents c59a9ff + 0f6c688 commit a229e87

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/btop.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,13 +837,17 @@ static auto configure_tty_mode(std::optional<bool> force_tty) {
837837
if (force_tty.has_value()) {
838838
Config::set("tty_mode", force_tty.value());
839839
Logger::debug("TTY mode set via command line");
840-
}
840+
}
841+
else if (Config::getB("force_tty")) {
842+
Config::set("tty_mode", true);
843+
Logger::debug("TTY mode set via config");
844+
}
841845

842846
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
843847
else if (Term::current_tty.starts_with("/dev/tty")) {
844848
Config::set("tty_mode", true);
845849
Logger::debug("Auto detect real TTY");
846-
}
850+
}
847851
#endif
848852

849853
Logger::debug("TTY mode enabled: {}", Config::getB("tty_mode"));

src/btop_menu.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,9 +1455,13 @@ static int optionsMenu(const string& key) {
14551455
theme_refresh = true;
14561456
Config::flip("lowcolor");
14571457
}
1458+
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
1459+
else if (option == "force_tty" and not Term::current_tty.starts_with("/dev/tty")) {
1460+
#else
14581461
else if (option == "force_tty") {
1462+
#endif
14591463
theme_refresh = true;
1460-
Config::flip("tty_mode");
1464+
Config::set("tty_mode", Config::getB("force_tty"));
14611465
}
14621466
else if (is_in(option, "rounded_corners", "theme_background"))
14631467
theme_refresh = true;

0 commit comments

Comments
 (0)