256 lines
6.4 KiB
Rust
256 lines
6.4 KiB
Rust
use {
|
|
crate::{
|
|
Animations, ClientMatch, ColorManagement, ConfigConnector, ConfigDrmDevice, ConfigKeymap,
|
|
DrmDeviceMatch, Exec, Float, FocusHistory, InputMatch, Libei, Output, OutputMatch,
|
|
RepeatRate, SimpleCommand, SimpleIm, Status, Tearing, Theme, UiDrag, Vrr, WindowMatch,
|
|
Xwayland,
|
|
},
|
|
ahash::AHashMap,
|
|
jay_config::{
|
|
Direction, Workspace,
|
|
input::{
|
|
FallbackOutputMode, SwitchEvent, acceleration::AccelProfile, clickmethod::ClickMethod,
|
|
},
|
|
keyboard::{ModifiedKeySym, mods::Modifiers, syms::KeySym},
|
|
logging::LogLevel,
|
|
video::GfxApi,
|
|
window::TileState,
|
|
workspace::WorkspaceDisplayOrder,
|
|
},
|
|
std::{rc::Rc, time::Duration},
|
|
};
|
|
|
|
#[derive(Debug, Clone)]
|
|
#[expect(clippy::enum_variant_names)]
|
|
pub enum Action {
|
|
ConfigureConnector {
|
|
con: ConfigConnector,
|
|
},
|
|
ConfigureDirectScanout {
|
|
enabled: bool,
|
|
},
|
|
ConfigureDrmDevice {
|
|
dev: ConfigDrmDevice,
|
|
},
|
|
ConfigureIdle {
|
|
idle: Option<Duration>,
|
|
grace_period: Option<Duration>,
|
|
},
|
|
ConfigureInput {
|
|
input: Box<Input>,
|
|
},
|
|
ConfigureOutput {
|
|
out: Output,
|
|
},
|
|
Exec {
|
|
exec: Exec,
|
|
},
|
|
MoveToWorkspace {
|
|
name: String,
|
|
},
|
|
SendToScratchpad {
|
|
name: String,
|
|
},
|
|
ToggleScratchpad {
|
|
name: String,
|
|
},
|
|
CycleScratchpad {
|
|
name: String,
|
|
},
|
|
Multi {
|
|
actions: Vec<Action>,
|
|
},
|
|
SetEnv {
|
|
env: Vec<(String, String)>,
|
|
},
|
|
SetGfxApi {
|
|
api: GfxApi,
|
|
},
|
|
SetKeymap {
|
|
map: ConfigKeymap,
|
|
},
|
|
SetLogLevel {
|
|
level: LogLevel,
|
|
},
|
|
SetRenderDevice {
|
|
dev: Box<DrmDeviceMatch>,
|
|
},
|
|
SetStatus {
|
|
status: Option<Status>,
|
|
},
|
|
SetTheme {
|
|
theme: Box<Theme>,
|
|
},
|
|
ShowWorkspace {
|
|
name: String,
|
|
output: Option<OutputMatch>,
|
|
},
|
|
SimpleCommand {
|
|
cmd: SimpleCommand,
|
|
},
|
|
SwitchToVt {
|
|
num: u32,
|
|
},
|
|
UnsetEnv {
|
|
env: Vec<String>,
|
|
},
|
|
MoveToOutput {
|
|
workspace: Option<Workspace>,
|
|
output: Option<OutputMatch>,
|
|
direction: Option<Direction>,
|
|
},
|
|
SetRepeatRate {
|
|
rate: RepeatRate,
|
|
},
|
|
DefineAction {
|
|
name: String,
|
|
action: Box<Action>,
|
|
},
|
|
UndefineAction {
|
|
name: String,
|
|
},
|
|
NamedAction {
|
|
name: String,
|
|
},
|
|
CreateMark(u32),
|
|
JumpToMark(u32),
|
|
CopyMark(u32, u32),
|
|
SetMode {
|
|
name: String,
|
|
latch: bool,
|
|
},
|
|
CreateVirtualOutput {
|
|
name: String,
|
|
},
|
|
RemoveVirtualOutput {
|
|
name: String,
|
|
},
|
|
Resize {
|
|
dx1: i32,
|
|
dy1: i32,
|
|
dx2: i32,
|
|
dy2: i32,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct ClientRule {
|
|
pub name: Option<String>,
|
|
pub match_: ClientMatch,
|
|
pub action: Option<Action>,
|
|
pub latch: Option<Action>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct WindowRule {
|
|
pub name: Option<String>,
|
|
pub match_: WindowMatch,
|
|
pub action: Option<Action>,
|
|
pub latch: Option<Action>,
|
|
pub auto_focus: Option<bool>,
|
|
pub initial_tile_state: Option<TileState>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Input {
|
|
pub tag: Option<String>,
|
|
pub match_: InputMatch,
|
|
pub accel_profile: Option<AccelProfile>,
|
|
pub accel_speed: Option<f64>,
|
|
pub tap_enabled: Option<bool>,
|
|
pub tap_drag_enabled: Option<bool>,
|
|
pub tap_drag_lock_enabled: Option<bool>,
|
|
pub left_handed: Option<bool>,
|
|
pub natural_scrolling: Option<bool>,
|
|
pub click_method: Option<ClickMethod>,
|
|
pub middle_button_emulation: Option<bool>,
|
|
pub px_per_wheel_scroll: Option<f64>,
|
|
pub transform_matrix: Option<[[f64; 2]; 2]>,
|
|
pub keymap: Option<ConfigKeymap>,
|
|
pub switch_actions: AHashMap<SwitchEvent, Action>,
|
|
pub output: Option<Option<OutputMatch>>,
|
|
pub calibration_matrix: Option<[[f32; 3]; 2]>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Shortcut {
|
|
pub mask: Modifiers,
|
|
pub keysym: ModifiedKeySym,
|
|
pub action: Action,
|
|
pub latch: Option<Action>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct NamedAction {
|
|
pub name: Rc<String>,
|
|
pub action: Action,
|
|
}
|
|
|
|
#[derive(Clone, Debug)]
|
|
pub struct InputMode {
|
|
pub parent: Option<String>,
|
|
pub shortcuts: Vec<Shortcut>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Config {
|
|
pub keymap: Option<ConfigKeymap>,
|
|
pub repeat_rate: Option<RepeatRate>,
|
|
pub shortcuts: Vec<Shortcut>,
|
|
pub on_graphics_initialized: Option<Action>,
|
|
pub on_idle: Option<Action>,
|
|
pub status: Option<Status>,
|
|
pub connectors: Vec<ConfigConnector>,
|
|
pub outputs: Vec<Output>,
|
|
pub workspace_capture: bool,
|
|
pub env: Vec<(String, String)>,
|
|
pub on_startup: Option<Action>,
|
|
pub keymaps: Vec<ConfigKeymap>,
|
|
pub auto_reload: Option<bool>,
|
|
pub log_level: Option<LogLevel>,
|
|
pub clean_logs_older_than: Option<Duration>,
|
|
pub theme: Theme,
|
|
pub gfx_api: Option<GfxApi>,
|
|
pub direct_scanout_enabled: Option<bool>,
|
|
pub drm_devices: Vec<ConfigDrmDevice>,
|
|
pub render_device: Option<DrmDeviceMatch>,
|
|
pub inputs: Vec<Input>,
|
|
pub idle: Option<Duration>,
|
|
pub grace_period: Option<Duration>,
|
|
pub key_press_enables_dpms: Option<bool>,
|
|
pub mouse_move_enables_dpms: Option<bool>,
|
|
pub explicit_sync_enabled: Option<bool>,
|
|
pub focus_follows_mouse: bool,
|
|
pub window_management_key: Option<ModifiedKeySym>,
|
|
pub vrr: Option<Vrr>,
|
|
pub tearing: Option<Tearing>,
|
|
pub libei: Libei,
|
|
pub ui_drag: UiDrag,
|
|
pub animations: Animations,
|
|
pub xwayland: Option<Xwayland>,
|
|
pub color_management: Option<ColorManagement>,
|
|
pub float: Option<Float>,
|
|
pub named_actions: Vec<NamedAction>,
|
|
pub max_action_depth: u64,
|
|
pub client_rules: Vec<ClientRule>,
|
|
pub window_rules: Vec<WindowRule>,
|
|
pub pointer_revert_key: Option<KeySym>,
|
|
pub use_hardware_cursor: Option<bool>,
|
|
pub show_bar: Option<bool>,
|
|
pub show_titles: Option<bool>,
|
|
pub focus_history: Option<FocusHistory>,
|
|
pub middle_click_paste: Option<bool>,
|
|
pub input_modes: AHashMap<String, InputMode>,
|
|
pub workspace_display_order: Option<WorkspaceDisplayOrder>,
|
|
pub simple_im: Option<SimpleIm>,
|
|
pub fallback_output_mode: Option<FallbackOutputMode>,
|
|
pub mouse_follows_focus: Option<bool>,
|
|
pub scratchpads: Vec<Scratchpad>,
|
|
pub autotile: Option<bool>,
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Scratchpad {
|
|
pub name: String,
|
|
pub exec: Option<Exec>,
|
|
}
|