tony / oxwm

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