Skip to content

Commit

Permalink
update macos defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Sep 19, 2024
1 parent d40ab7f commit a011aca
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
3 changes: 3 additions & 0 deletions docs/docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ language: 'en'
- Introduce `cursor.blinking-interval`, default value is 800ms.
- Fix blinking cursor lag issue.
- Fix adaptive theme background color on macos.
- Decorations as `Transparent` is default on MacOS.
- Navigation mode as `NativeTab` is default on MacOS.
- `keyboard.use-kitty-keyboard-protocol` is now `false` by default.
- Add support for msys2/mingw builds release [#635](https://github.com/raphamorim/rio/issues/635) by [@Kreijstal](https://github.com/Kreijstal).

## 0.1.14
Expand Down
8 changes: 4 additions & 4 deletions frontends/rioterm/src/screen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1901,8 +1901,8 @@ impl Screen<'_> {

#[inline]
pub fn render(&mut self) {
// let start_total = std::time::Instant::now();
// println!("_____________________________\nrender time elapsed");
let start_total = std::time::Instant::now();
println!("_____________________________\nrender time elapsed");
let is_search_active = self.search_active();
if is_search_active {
if let Some(history_index) = self.search_state.history_index {
Expand Down Expand Up @@ -1956,7 +1956,7 @@ impl Screen<'_> {
.blink_cursor(self.renderer.config_blinking_interval);
}

// let duration = start_total.elapsed();
// println!("Total whole render function is: {:?}\n", duration);
let duration = start_total.elapsed();
println!("Total whole render function is: {:?}\n", duration);
}
}
6 changes: 3 additions & 3 deletions rio-backend/src/config/keyboard.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize};

use super::defaults::{default_bool_true, default_disable_ctlseqs_alt};
use super::defaults::default_disable_ctlseqs_alt;

#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy)]
pub struct Keyboard {
// Enable kitty keyboard protocol
#[serde(default = "default_bool_true", rename = "use-kitty-keyboard-protocol")]
#[serde(default = "bool::default", rename = "use-kitty-keyboard-protocol")]
pub use_kitty_keyboard_protocol: bool,
// Disable ctlseqs with ALT keys
// For example: Terminal.app does not deal with ctlseqs with ALT keys
Expand All @@ -20,7 +20,7 @@ pub struct Keyboard {
impl Default for Keyboard {
fn default() -> Keyboard {
Keyboard {
use_kitty_keyboard_protocol: true,
use_kitty_keyboard_protocol: false,
#[cfg(target_os = "macos")]
disable_ctlseqs_alt: true,
#[cfg(not(target_os = "macos"))]
Expand Down
16 changes: 14 additions & 2 deletions rio-backend/src/config/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::config::colors::{deserialize_to_arr, ColorArray};
use crate::config::default_bool_true;
use serde::{Deserialize, Serialize};

#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Clone, Copy)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Copy)]
pub enum NavigationMode {
#[serde(alias = "plain")]
Plain,
Expand All @@ -14,10 +14,22 @@ pub enum NavigationMode {
#[serde(alias = "bottomtab")]
BottomTab,
#[serde(alias = "bookmark")]
#[default]
Bookmark,
}

#[allow(clippy::derivable_impls)]
impl Default for NavigationMode {
fn default() -> NavigationMode {
#[cfg(target_os = "macos")]
{
NavigationMode::NativeTab
}

#[cfg(not(target_os = "macos"))]
NavigationMode::Bookmark
}
}

impl NavigationMode {
const PLAIN_STR: &'static str = "Plain";
const COLLAPSED_TAB_STR: &'static str = "Bookmark";
Expand Down
16 changes: 14 additions & 2 deletions rio-backend/src/config/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ pub enum WindowMode {
Windowed,
}

#[derive(Clone, Default, Serialize, Deserialize, Copy, Debug, PartialEq)]
#[derive(Clone, Serialize, Deserialize, Copy, Debug, PartialEq)]
pub enum Decorations {
#[serde(alias = "enabled")]
#[default]
Enabled,
#[serde(alias = "disabled")]
Disabled,
Expand All @@ -27,6 +26,19 @@ pub enum Decorations {
Buttonless,
}

#[allow(clippy::derivable_impls)]
impl Default for Decorations {
fn default() -> Decorations {
#[cfg(target_os = "macos")]
{
Decorations::Transparent
}

#[cfg(not(target_os = "macos"))]
Decorations::Enabled
}
}

#[derive(PartialEq, Serialize, Deserialize, Clone, Debug)]
pub struct Window {
#[serde(default = "default_window_width")]
Expand Down

0 comments on commit a011aca

Please sign in to comment.