tony / oxwm

Branch: 6f26d6c
Switch branches/tags
master
tonybtw fixed font 6f26d6c 2025-10-06
164 lines · 5.9 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";
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 // pub const TAGS: [&str; TAG_COUNT] = [
78 // "DEV", "WWW", "SYS", "DOC", "VBOX", "CHAT", "MUS", "VID", "MISC",
79 // ];
80
81 // ========================================
82 // KEYBINDINGS
83 // ========================================
84 #[rustfmt::skip]
85 pub const KEYBINDINGS: &[Key] = &[
86 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
87 Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str(XCLOCK)),
88
89 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
90 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
91 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
92 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
93 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
94 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
95 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
96
97 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
98 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
99 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
100 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
101 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
102 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
103 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
104 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
105 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
106
107 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
108 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
109 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
110 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
111 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
112 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
113 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
114 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
115 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
116 ];
117
118 // ========================================
119 // STATUS BAR BLOCKS
120 // ========================================
121 pub const STATUS_BLOCKS: &[BlockConfig] = &[
122 BlockConfig {
123 format: "",
124 command: BlockCommand::Battery {
125 format_charging: "󰂄 Bat: {}%",
126 format_discharging: "󰁹 Bat:{}%",
127 format_full: "󰁹 Bat: {}%",
128 },
129 interval_secs: 30,
130 color: BLUE,
131 underline: true,
132 },
133 BlockConfig {
134 format: " | ",
135 command: BlockCommand::Static(""),
136 interval_secs: u64::MAX,
137 color: GRAY_LIGHT,
138 underline: false,
139 },
140 BlockConfig {
141 format: " {}",
142 command: BlockCommand::Shell("uname -r"),
143 interval_secs: u64::MAX,
144 color: RED,
145 underline: true,
146 },
147 BlockConfig {
148 format: " | ",
149 command: BlockCommand::Static(""),
150 interval_secs: u64::MAX,
151 color: GRAY_LIGHT,
152 underline: false,
153 },
154 BlockConfig {
155 format: "󰸘 {}",
156 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
157 interval_secs: 1,
158 color: CYAN,
159 underline: true,
160 },
161 ];
162
163 const SHIFT: KeyButMask = KeyButMask::SHIFT;
164 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");