Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): allow configuring with lowercase values for enums #628

Merged
Merged
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
1 change: 1 addition & 0 deletions docs/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ language: 'en'
- Add `tabs-active-foreground` config key [#619](https://github.com/raphamorim/rio/pull/619).
- `use-kitty-keyboard-protocol` is now `true` as default.
- Remove tokio runtime.
- Allow configuring with lowercase values for enums

## 0.1.10

Expand Down
10 changes: 5 additions & 5 deletions rio-backend/src/config/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ blinking-cursor = false
# [window]
# width = 600
# height = 400
# mode = "Windowed"
# mode = "windowed"
# opacity = 1.0
# blur = false
# decorations = "Enabled"
# decorations = "enabled"

# Renderer
#
Expand All @@ -266,8 +266,8 @@ blinking-cursor = false
#
# Example:
# [renderer]
# performance = "High"
# backend = "Automatic"
# performance = "high"
# backend = "automatic"
# disable-unfocused-render = false
# level = 1

Expand Down Expand Up @@ -361,7 +361,7 @@ blinking-cursor = false
#
# Example:
# [navigation]
# mode = "CollapsedTab"
# mode = "collapsedtab"
# clickable = false
# hide-if-single = true
# use-current-path = false
Expand Down
5 changes: 5 additions & 0 deletions rio-backend/src/config/navigation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Clone, Copy)]
pub enum NavigationMode {
#[serde(alias = "plain")]
Plain,
#[serde(alias = "toptab")]
TopTab,
#[cfg(target_os = "macos")]
#[serde(alias = "nativetab")]
NativeTab,
#[serde(alias = "bottomtab")]
BottomTab,
#[default]
#[serde(alias = "collapsedtab")]
CollapsedTab,
}

Expand Down
7 changes: 7 additions & 0 deletions rio-backend/src/config/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ pub struct Renderer {
#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone, Copy)]
pub enum Performance {
#[default]
#[serde(alias = "high")]
High,
#[serde(alias = "low")]
Low,
}

Expand All @@ -35,14 +37,19 @@ impl Display for Performance {
pub enum Backend {
// Leave Sugarloaf/WGPU to decide
#[default]
#[serde(alias = "automatic")]
Automatic,
// Supported on Linux/Android, the web through webassembly via WebGL, and Windows and macOS/iOS via ANGLE
#[serde(alias = "gl")]
GL,
// Supported on Windows, Linux/Android, and macOS/iOS via Vulkan Portability (with the Vulkan feature enabled)
#[serde(alias = "vulkan")]
Vulkan,
// Supported on Windows 10
#[serde(alias = "dx12")]
DX12,
// Supported on macOS/iOS
#[serde(alias = "metal")]
Metal,
}

Expand Down
7 changes: 7 additions & 0 deletions rio-backend/src/config/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@ use sugarloaf::ImageProperties;

#[derive(Default, Clone, Serialize, Deserialize, Copy, Debug, PartialEq)]
pub enum WindowMode {
#[serde(alias = "maximized")]
Maximized,
#[serde(alias = "fullscreen")]
Fullscreen,
// Windowed will use width and height definition
#[default]
#[serde(alias = "windowed")]
Windowed,
}

#[derive(Default, Clone, Serialize, Deserialize, Copy, Debug, PartialEq)]
pub enum Decorations {
#[serde(alias = "enabled")]
#[default]
Enabled,
#[serde(alias = "disabled")]
Disabled,
#[serde(alias = "transparent")]
Transparent,
#[serde(alias = "buttonless")]
Buttonless,
}

Expand Down
Loading