Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ nix = { workspace = true, features = [
"mman",
] }

[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
[target.'cfg(any(any(target_os = "linux", target_os = "freebsd"), target_os = "windows"))'.dependencies]
crash-handler = { version = "0.6.3", optional = true }
minidumper = { version = "0.8.3", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies]
freedesktop-desktop-entry = "0.5.0"
x11rb.workspace = true
zbus.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion app/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use warp_util::path::app_target_dir;

fn main() -> Result<()> {
cfg_aliases! {
linux_or_windows: { any(target_os = "linux", windows) },
linux_or_windows: { any(any(target_os = "linux", target_os = "freebsd"), windows) },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] This makes #[cfg(linux_or_windows)] include FreeBSD, so sentry_minidump is compiled there when crash_reporting is enabled; the upstream crash-handler/minidump-writer crates only export Linux/Android, Windows, and macOS implementations, so keep this alias Linux/Windows-only until a FreeBSD minidump backend exists.

Copy link
Copy Markdown
Author

@rudrabhoj rudrabhoj Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's understandable. minidump crate is a project external to warp and it doesn't support FreeBSD yet, it should be fine. I'll soon submit PR to minidump too until then I think this shouldn't be a blocker for a FreeBSD port of warp.

enable_crash_recovery: { linux_or_windows },
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/app_services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Finder such that the user can open a new Warp tab or window
//! in a given directory.

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
pub mod linux;
#[cfg(target_os = "macos")]
mod mac;
Expand All @@ -17,7 +17,7 @@ use warpui::AppContext;
pub fn init(_ctx: &mut AppContext) {
log::info!("Initializing app services");

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
linux::init(_ctx);
#[cfg(target_os = "macos")]
mac::init();
Expand All @@ -28,6 +28,6 @@ pub fn init(_ctx: &mut AppContext) {
pub fn teardown(_ctx: &mut AppContext) {
log::info!("Tearing down app services...");

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
linux::teardown(_ctx);
}
2 changes: 1 addition & 1 deletion app/src/auth/auth_view_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn init(app: &mut AppContext) {
// to solve it in a more general way later). In the meantime, we
// add a basic ctrl+v binding for the auth view, since there is no
// terminal to interact with yet.
#[cfg(any(target_os = "linux", target_os = "windows"))]
#[cfg(any(any(target_os = "linux", target_os = "freebsd"), target_os = "windows"))]
app.register_fixed_bindings([FixedBinding::new(
"cmdorctrl-v",
AuthViewAction::PasteAuthUrl,
Expand Down
2 changes: 1 addition & 1 deletion app/src/auth/login_slide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn init(app: &mut AppContext) {
),
]);

#[cfg(any(target_os = "linux", target_os = "windows"))]
#[cfg(any(any(target_os = "linux", target_os = "freebsd"), target_os = "windows"))]
app.register_fixed_bindings([FixedBinding::new(
"cmdorctrl-v",
LoginSlideAction::PasteAuthUrl,
Expand Down
2 changes: 1 addition & 1 deletion app/src/auth/paste_auth_token_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn init(app: &mut AppContext) {
),
]);

#[cfg(any(target_os = "linux", target_os = "windows"))]
#[cfg(any(any(target_os = "linux", target_os = "freebsd"), target_os = "windows"))]
app.register_fixed_bindings([FixedBinding::new(
"cmdorctrl-v",
PasteAuthTokenModalAction::PasteIntoEditor,
Expand Down
2 changes: 1 addition & 1 deletion app/src/code_review/code_review_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7765,7 +7765,7 @@ impl BackingView for CodeReviewView {
AppContext::show_native_platform_modal(ctx, dialog);
} else if cfg!(all(
not(target_family = "wasm"),
any(target_os = "linux", target_os = "windows")
any(any(target_os = "linux", target_os = "freebsd"), target_os = "windows")
)) {
// Find the workspace to show the Warp-native modal
if let Some(workspace) = ctx
Expand Down
4 changes: 2 additions & 2 deletions app/src/crash_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ fn choose_crash_recovery_mechanism(
return None;
}

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
{
let force_x11 = settings::ForceX11::read_from_preferences(user_preferences);
// Prioritize X11 crash recovery first. If the user has actively
Expand Down Expand Up @@ -441,7 +441,7 @@ fn handle_parent_crash(
warp_logging::on_parent_process_crash();

match recovery_mechanism {
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
RecoveryMechanism::X11 => {
let force_x11 = settings::ForceX11::read_from_preferences(user_preferences);
if force_x11 != Some(true) {
Expand Down
6 changes: 3 additions & 3 deletions app/src/crash_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod mac;
#[cfg(linux_or_windows)]
mod sentry_minidump;

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
mod linux;

use std::borrow::Cow;
Expand Down Expand Up @@ -262,7 +262,7 @@ fn get_environment() -> Cow<'static, str> {
cfg_if::cfg_if! {
if #[cfg(target_os = "macos")] {
let operating_system = "mac";
} else if #[cfg(target_os = "linux")] {
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
let operating_system = "linux";
}
else if #[cfg(target_os = "windows")] {
Expand Down Expand Up @@ -547,7 +547,7 @@ impl VirtualEnvironment {
/// Detects the current virtual environment, if any.
fn detect() -> Option<Self> {
cfg_if::cfg_if! {
if #[cfg(target_os = "linux")] {
if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
linux::get_virtualized_environment()
} else {
None
Expand Down
8 changes: 4 additions & 4 deletions app/src/crash_reporting/sentry_minidump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl MinidumpGuard {
.context("Failed to attach crash signal handler")?;

// Ensure that the crash server process can ptrace Warp.
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
crash_handler.set_ptracer(Some(child.id()));

let guard = MinidumpGuard {
Expand Down Expand Up @@ -341,9 +341,9 @@ impl MinidumpGuard {

/// Simulate a crash.
pub fn crash(&self) {
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
self.crash_handler.simulate_signal(libc::SIGSEGV as _);
#[cfg(not(target_os = "linux"))]
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
self.crash_handler.simulate_exception(None);
}
}
Expand Down Expand Up @@ -424,7 +424,7 @@ enum MinidumpCommand {
/// already be in the minidump, but it's useful to surface prominently in Sentry.
fn format_crash_details(crash_context: &CrashContext) -> Option<String> {
cfg_if::cfg_if! {
if #[cfg(target_os = "linux")] {
if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
Some(format!("Killed by signal {} / {}", crash_context.siginfo.ssi_signo, crash_context.siginfo.ssi_code))
} else if #[cfg(target_os = "windows")] {
Some(format!("Exception {}", crash_context.exception_code))
Expand Down
6 changes: 3 additions & 3 deletions app/src/debug_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(crate) fn run() -> anyhow::Result<()> {
));

// Log some additional windowing system information on Linux.
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
{
use winit::raw_window_handle::HasDisplayHandle as _;

Expand All @@ -54,7 +54,7 @@ pub(crate) fn run() -> anyhow::Result<()> {
}
}

#[cfg(any(target_os = "linux", windows))]
#[cfg(any(any(target_os = "linux", target_os = "freebsd"), windows))]
{
use std::ops::Deref as _;

Expand Down Expand Up @@ -90,7 +90,7 @@ pub(crate) fn run() -> anyhow::Result<()> {
));
}

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
{
let lspci_info = collect_output_or_suggest_install("lspci");
println!("##################################################");
Expand Down
12 changes: 6 additions & 6 deletions app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,12 +734,12 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
// Collect errors that occur in run_internal() before the Sentry client is initialized,
// so they can be replayed to Sentry once it's ready.
#[cfg_attr(
not(all(feature = "release_bundle", any(windows, target_os = "linux"))),
not(all(feature = "release_bundle", any(windows, any(target_os = "linux", target_os = "freebsd")))),
expect(unused_mut)
)]
let mut pre_sentry_errors: Vec<anyhow::Error> = Vec::new();

#[cfg(all(feature = "release_bundle", target_os = "linux"))]
#[cfg(all(feature = "release_bundle", any(target_os = "linux", target_os = "freebsd")))]
if let LaunchMode::App { .. } = launch_mode {
match app_services::linux::pass_startup_args_to_existing_instance(
launch_mode.args().as_ref(),
Expand Down Expand Up @@ -805,7 +805,7 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
// When the SettingsFile feature flag is enabled, public settings live in
// the TOML-backed store. When disabled, they live in the platform-native
// store (same backend as private). Use the correct one for pre-app reads.
#[cfg_attr(not(any(enable_crash_recovery, target_os = "linux")), expect(unused))]
#[cfg_attr(not(any(enable_crash_recovery, any(target_os = "linux", target_os = "freebsd"))), expect(unused))]
let prefs_for_public_settings: &dyn warpui_extras::user_preferences::UserPreferences =
if FeatureFlag::SettingsFile.is_enabled() {
public_preferences.as_ref()
Expand Down Expand Up @@ -854,7 +854,7 @@ fn run_internal(mut launch_mode: LaunchMode) -> Result<()> {
app_builder.set_dock_menu_builder(|_| app_menus::dock_menu());
}

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
{
use crate::settings::ForceX11;
use warpui::platform::linux::{self, AppBuilderExt};
Expand Down Expand Up @@ -979,7 +979,7 @@ fn initialize_app(
cfg_if::cfg_if! {
if #[cfg(feature = "integration_tests")] {
warpui_extras::secure_storage::register_noop(&data_domain, ctx);
} else if #[cfg(target_os = "linux")] {
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
warpui_extras::secure_storage::register_with_fallback(&data_domain, warp_core::paths::state_dir(), ctx)
} else if #[cfg(target_os = "windows")] {
warpui_extras::secure_storage::register_with_dir(&data_domain, warp_core::paths::state_dir(), ctx)
Expand Down Expand Up @@ -1915,7 +1915,7 @@ fn app_callbacks(is_integration_test: bool) -> warpui::platform::AppCallbacks {
let general_settings = GeneralSettings::as_ref(ctx);
// On Linux or Windows, if we're about to close the final window, we should quit the app instead.
// On Mac, we do this conditionally based on a user setting.
let quit_on_last_window_closed = cfg!(any(target_os = "linux", windows))
let quit_on_last_window_closed = cfg!(any(any(target_os = "linux", target_os = "freebsd"), windows))
|| *general_settings.quit_on_last_window_closed;
if ctx.window_ids().count() == 1 && quit_on_last_window_closed {
log::info!("No windows left, terminating app");
Expand Down
2 changes: 1 addition & 1 deletion app/src/quit_warning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ impl<'a> QuitWarningDialog<'a> {
shown = true;
} else if cfg!(all(
not(target_family = "wasm"),
any(target_os = "linux", windows)
any(any(target_os = "linux", target_os = "freebsd"), windows)
)) {
// Find a window to show the Warp-native modal in. If there is no active window, use
// one of the windows with a running process.
Expand Down
2 changes: 1 addition & 1 deletion app/src/settings/cloud_preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Platform {
return Self::Mac;
}

if cfg!(all(not(target_family = "wasm"), target_os = "linux")) {
if cfg!(all(not(target_family = "wasm"), any(target_os = "linux", target_os = "freebsd"))) {
return Self::Linux;
}

Expand Down
10 changes: 5 additions & 5 deletions app/src/settings/cloud_preferences_syncer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ fn test_sync_local_pref_to_cloud_after_initial_sync() {

let mut server_api = mock_object_client_with_base_expectations();
let is_mac = cfg!(all(not(target_family = "wasm"), target_os = "macos"));
let is_linux = cfg!(all(not(target_family = "wasm"), target_os = "linux"));
let is_linux = cfg!(all(not(target_family = "wasm"), any(target_os = "linux", target_os = "freebsd")));

let mut all_client_ids = expect_sync_preferences_setting(&mut server_api);
all_client_ids.append(&mut expect_sync_server_stored_privacy_settings(
Expand Down Expand Up @@ -429,7 +429,7 @@ fn test_sync_local_pref_to_cloud_after_initial_sync() {
.set_value(true, ctx);
if cfg!(all(not(target_family = "wasm"), target_os = "macos")) {
let _ = test_settings.mac_only_cloud_setting.set_value(true, ctx);
} else if cfg!(all(not(target_family = "wasm"), target_os = "linux")) {
} else if cfg!(all(not(target_family = "wasm"), any(target_os = "linux", target_os = "freebsd"))) {
let _ = test_settings.linux_only_cloud_setting.set_value(true, ctx);
}
let _ = test_settings.non_cloud_setting.set_value(true, ctx);
Expand All @@ -455,7 +455,7 @@ fn run_initial_sync_test(is_onboarded: bool) {

let mut server_api = mock_object_client_with_base_expectations();
let is_mac = cfg!(all(not(target_family = "wasm"), target_os = "macos"));
let is_linux = cfg!(all(not(target_family = "wasm"), target_os = "linux"));
let is_linux = cfg!(all(not(target_family = "wasm"), any(target_os = "linux", target_os = "freebsd")));

let mut all_client_ids = expect_sync_preferences_setting(&mut server_api);

Expand Down Expand Up @@ -748,7 +748,7 @@ fn test_sync_cloud_pref_to_local_on_initial_load_or_collab_update() {
.await;

let is_mac = cfg!(all(not(target_family = "wasm"), target_os = "macos"));
let is_linux = cfg!(all(not(target_family = "wasm"), target_os = "linux"));
let is_linux = cfg!(all(not(target_family = "wasm"), any(target_os = "linux", target_os = "freebsd")));
app.read(|ctx| {
let settings = TestSettings::as_ref(ctx);
assert!(
Expand Down Expand Up @@ -856,7 +856,7 @@ fn test_cloud_preferences_setting_initial_load_skipped_when_setting_is_off() {
});

let is_mac = cfg!(all(not(target_family = "wasm"), target_os = "macos"));
let is_linux = cfg!(all(not(target_family = "wasm"), target_os = "linux"));
let is_linux = cfg!(all(not(target_family = "wasm"), any(target_os = "linux", target_os = "freebsd")));
app.read(|ctx| {
let settings = TestSettings::as_ref(ctx);
assert!(
Expand Down
2 changes: 1 addition & 1 deletion app/src/settings/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define_settings_group!(GPUSettings, settings: [
type: bool,
// Opt for the low power (integrated) GPU on Windows / Linux since discrete GPUs tend to be
// more unstable.
default: cfg!(any(target_os = "linux", windows)),
default: cfg!(any(any(target_os = "linux", target_os = "freebsd"), windows)),
supported_platforms: SupportedPlatforms::ALL,
sync_to_cloud: SyncToCloud::Never,
private: false,
Expand Down
4 changes: 2 additions & 2 deletions app/src/settings/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn register_all_settings(ctx: &mut AppContext) {
SameLinePromptBlockSettings::register(ctx);
SemanticSelection::register(ctx);

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
super::LinuxAppConfiguration::register(ctx);

#[cfg(feature = "local_fs")]
Expand Down Expand Up @@ -261,7 +261,7 @@ fn init_platform_native_preferences() -> user_preferences::Model {
cfg_if::cfg_if! {
if #[cfg(test)] {
Box::<user_preferences::in_memory::InMemoryPreferences>::default()
} else if #[cfg(any(target_os = "linux", feature = "integration_tests"))] {
} else if #[cfg(any(any(target_os = "linux", target_os = "freebsd"), feature = "integration_tests"))] {
match user_preferences::file_backed::FileBackedUserPreferences::new(super::user_preferences_file_path()) {
Ok(prefs) => Box::new(prefs) as user_preferences::Model,
Err(err) => {
Expand Down
4 changes: 2 additions & 2 deletions app/src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod init;
pub mod initializer;
mod input;
mod input_mode;
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
mod linux;
pub mod macros;
pub mod manager;
Expand Down Expand Up @@ -52,7 +52,7 @@ pub use gpu::*;
pub use init::*;
pub use input::*;
pub use input_mode::*;
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
pub use linux::*;
pub use native_preference::*;
pub use onboarding::*;
Expand Down
2 changes: 1 addition & 1 deletion app/src/settings/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl SelectionSettings {
/// lack this separate clipboard, and so we map middle-click to the normal clipboard on those
/// platforms.
pub fn read_for_middle_click_paste(&self, ctx: &mut AppContext) -> Option<ClipboardContent> {
if cfg!(target_os = "linux") {
if cfg!(any(target_os = "linux", target_os = "freebsd")) {
return self.maybe_read_from_linux_selection_clipboard(ctx);
}
(self
Expand Down
6 changes: 3 additions & 3 deletions app/src/settings_view/appearance_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ impl AppearanceSettingsPageView {
// If we're on a non-Linux platform, render the dropdown item in the
// actual font. We currently don't do this on Linux because
// pre-loading all of the fonts is too expensive.
if cfg!(not(target_os = "linux")) {
if cfg!(not(any(target_os = "linux", target_os = "freebsd"))) {
if let Some(family_id) = ctx.font_cache().family_id_for_name(&font_name) {
initial_dropdown_item = initial_dropdown_item.with_font_override(family_id);
}
Expand Down Expand Up @@ -1901,7 +1901,7 @@ impl AppearanceSettingsPageView {
// If we're on a non-Linux platform, render the dropdown item in the
// actual font. We currently don't do this on Linux because
// pre-loading all of the fonts is too expensive.
if cfg!(not(target_os = "linux")) {
if cfg!(not(any(target_os = "linux", target_os = "freebsd"))) {
if let Some(family_id) = family {
dropdown = dropdown.with_font_override(*family_id)
}
Expand Down Expand Up @@ -1962,7 +1962,7 @@ impl AppearanceSettingsPageView {
// If we're on a non-Linux platform, render the dropdown item in the
// actual font. We currently don't do this on Linux because
// pre-loading all of the fonts is too expensive.
if cfg!(not(target_os = "linux")) {
if cfg!(not(any(target_os = "linux", target_os = "freebsd"))) {
if let Some(family_id) = family {
dropdown = dropdown.with_font_override(*family_id)
}
Expand Down
Loading