tony / oxwm

Branch: b9062ae
Switch branches/tags
master
tonybtw added fallback font b9062ae 2025-10-06
161 lines · 5.8 KB Raw Blame History
1 use crate::bar::{BlockCommand, BlockConfig};
2 use crate::keyboard::handlers::Key;
3 use crate::keyboard::{Arg, KeyAction, keycodes};
4 use x11rb::protocol::xproto::KeyButMask;
5
6 // ========================================
7 // APPEARANCE
8 // ========================================
9 pub const BORDER_WIDTH: u32 = 1;
10 pub const BORDER_FOCUSED: u32 = 0x6dade3;
11 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
12 pub const FONT: &str = "JetBrainsMono Nerd Font:style=Bold:size=14,monospace:size=14";
13
14 // ========================================
15 // DEFAULTS
16 // ========================================
17 pub const TERMINAL: &str = "alacritty";
18 pub const XCLOCK: &str = "xclock";
19 pub const MODKEY: KeyButMask = KeyButMask::MOD4;
20
21 // ========================================
22 // BAR COLORS
23 // ========================================
24
25 // Base colors
26 const GRAY_DARK: u32 = 0x222222;
27 const GRAY_MID: u32 = 0x444444;
28 const GRAY_LIGHT: u32 = 0xbbbbbb;
29 const CYAN: u32 = 0x0db9d7;
30 const MAGENTA: u32 = 0xad8ee6;
31 const RED: u32 = 0xf7768e;
32 const GREEN: u32 = 0x9ece6a;
33 const BLUE: u32 = 0x7aa2f7;
34 const YELLOW: u32 = 0xe0af68;
35
36 pub struct ColorScheme {
37 pub foreground: u32,
38 pub background: u32,
39 pub underline: u32,
40 }
41
42 pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
43 foreground: GRAY_LIGHT,
44 background: GRAY_DARK,
45 underline: GRAY_MID,
46 };
47
48 pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
49 foreground: CYAN,
50 background: GRAY_DARK,
51 underline: CYAN,
52 };
53
54 pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
55 foreground: CYAN,
56 background: GRAY_DARK,
57 underline: MAGENTA,
58 };
59
60 // ========================================
61 // Commands
62 // ========================================
63 const SCREENSHOT_CMD: &[&str] = &[
64 "sh",
65 "-c",
66 "maim -s | xclip -selection clipboard -t image/png",
67 ];
68
69 const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run -l 10"];
70
71 // ========================================
72 // TAGS
73 // ========================================
74 pub const TAG_COUNT: usize = 9;
75 pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
76 // pub const TAGS: [&str; TAG_COUNT] = ["", "󰊯", "", "", "󰙯", "󱇤", "", "󱘶", "󰧮"];
77
78 // ========================================
79 // KEYBINDINGS
80 // ========================================
81 #[rustfmt::skip]
82 pub const KEYBINDINGS: &[Key] = &[
83 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
84 Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str(XCLOCK)),
85
86 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
87 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
88 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
89 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
90 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
91 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
92 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
93
94 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
95 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
96 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
97 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
98 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
99 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
100 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
101 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
102 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
103
104 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
105 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
106 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
107 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
108 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
109 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
110 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
111 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
112 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
113 ];
114
115 // ========================================
116 // STATUS BAR BLOCKS
117 // ========================================
118 pub const STATUS_BLOCKS: &[BlockConfig] = &[
119 BlockConfig {
120 format: "",
121 command: BlockCommand::Battery {
122 format_charging: "󰂄 Bat: {}%",
123 format_discharging: "󰁹 Bat:{}%",
124 format_full: "󰁹 Bat: {}%",
125 },
126 interval_secs: 30,
127 color: BLUE,
128 underline: true,
129 },
130 BlockConfig {
131 format: " | ",
132 command: BlockCommand::Static(""),
133 interval_secs: u64::MAX,
134 color: GRAY_LIGHT,
135 underline: false,
136 },
137 BlockConfig {
138 format: " {}",
139 command: BlockCommand::Shell("uname -r"),
140 interval_secs: u64::MAX,
141 color: RED,
142 underline: true,
143 },
144 BlockConfig {
145 format: " | ",
146 command: BlockCommand::Static(""),
147 interval_secs: u64::MAX,
148 color: GRAY_LIGHT,
149 underline: false,
150 },
151 BlockConfig {
152 format: "󰸘 {}",
153 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
154 interval_secs: 1,
155 color: CYAN,
156 underline: true,
157 },
158 ];
159
160 const SHIFT: KeyButMask = KeyButMask::SHIFT;
161 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");