tony / oxwm

Branch: 6b9ab97
Switch branches/tags
master
xsoder feat: Implemntation of full screen mode 2342897 2025-10-09
176 lines · 6.5 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 = "IosevkaNerdFont:style=Bold:size=10";
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 = 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", "-c","/home/xsoder/scripts/screeshot",
74 ];
75
76 const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run"];
77 const ZOOM_CMD: &[&str] = &["sh", "-c", "boomer"];
78 const SCRIPT_CMD: &[&str] = &["sh", "-c", "/home/xsoder/scripts/master"];
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
97 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
98 Key::new(&[MODKEY], keycodes::Z, KeyAction::Spawn, Arg::Array(ZOOM_CMD)),
99 Key::new(&[MODKEY, SHIFT], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
100 Key::new(&[MODKEY], keycodes::O, KeyAction::Spawn, Arg::Array(SCRIPT_CMD)),
101 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
102 Key::new(&[MODKEY], keycodes::F, KeyAction::ToggleFullScreen, Arg::None),
103 Key::new(&[MODKEY], keycodes::A, KeyAction::ToggleGaps, Arg::None),
104 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
105 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
106 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
107 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
108
109 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
110 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
111 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
112 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
113 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
114 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
115 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
116 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
117 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
118
119 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
120 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
121 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
122 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
123 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
124 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
125 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
126 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
127 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
128 ];
129
130 // ========================================
131 // STATUS BAR BLOCKS
132 // ========================================
133 pub const STATUS_BLOCKS: &[BlockConfig] = &[
134 BlockConfig {
135 format: "",
136 command: BlockCommand::Battery {
137 format_charging: "󰂄 Bat: {}%",
138 format_discharging: "󰁹 Bat:{}%",
139 format_full: "󰁹 Bat: {}%",
140 },
141 interval_secs: 30,
142 color: BLUE,
143 underline: true,
144 },
145 BlockConfig {
146 format: " | ",
147 command: BlockCommand::Static(""),
148 interval_secs: u64::MAX,
149 color: GRAY_LIGHT,
150 underline: false,
151 },
152 BlockConfig {
153 format: " {}",
154 command: BlockCommand::Shell("uname -r"),
155 interval_secs: u64::MAX,
156 color: RED,
157 underline: true,
158 },
159 BlockConfig {
160 format: " | ",
161 command: BlockCommand::Static(""),
162 interval_secs: u64::MAX,
163 color: GRAY_LIGHT,
164 underline: false,
165 },
166 BlockConfig {
167 format: "󰸘 {}",
168 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
169 interval_secs: 1,
170 color: CYAN,
171 underline: true,
172 },
173 ];
174
175 const SHIFT: KeyButMask = KeyButMask::SHIFT;
176 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");