tony / oxwm

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