Diff
diff --git a/src/config.rs b/src/config.rs
index a8edd0b..f644e27 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -6,15 +6,15 @@ use x11rb::protocol::xproto::KeyButMask;
// ========================================
// APPEARANCE
// ========================================
-pub const BORDER_WIDTH: u32 = 0;
+pub const BORDER_WIDTH: u32 = 2;
pub const BORDER_FOCUSED: u32 = 0x6dade3;
pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
-pub const FONT: &str = "IosevkaNerdFont:style=Bold:size=14";
+pub const FONT: &str = "IosevkaNerdFont:style=Bold:size=10";
// ========================================
// GAPS (Vanity Gaps)
// ========================================
-pub const GAPS_ENABLED: bool = true;
+pub const GAPS_ENABLED: bool = false;
pub const GAP_INNER_HORIZONTAL: u32 = 3;
pub const GAP_INNER_VERTICAL: u32 = 3;
pub const GAP_OUTER_HORIZONTAL: u32 = 3;
@@ -70,19 +70,19 @@ pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
// Commands
// ========================================
const SCREENSHOT_CMD: &[&str] = &[
- "sh",
- "-c",
- "maim -s | xclip -selection clipboard -t image/png",
+ "sh", "-c","/home/xsoder/scripts/screeshot",
];
const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run"];
+const ZOOM_CMD: &[&str] = &["sh", "-c", "boomer"];
+const SCRIPT_CMD: &[&str] = &["sh", "-c", "/home/xsoder/scripts/master"];
// ========================================
// TAGS
// ========================================
pub const TAG_COUNT: usize = 9;
pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
-// pub const TAGS: [&str; TAG_COUNT] = ["", "", "", "", "", "", "", "", ""];
+//pub const TAGS: [&str; TAG_COUNT] = ["", "", "", "", "", "", "", "", ""];
// pub const TAGS: [&str; TAG_COUNT] = [
// "DEV", "WWW", "SYS", "DOC", "VBOX", "CHAT", "MUS", "VID", "MISC",
// ];
@@ -93,11 +93,13 @@ pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"
#[rustfmt::skip]
pub const KEYBINDINGS: &[Key] = &[
Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
- Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str(XCLOCK)),
- Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
+ Key::new(&[MODKEY], keycodes::Z, KeyAction::Spawn, Arg::Array(ZOOM_CMD)),
+ Key::new(&[MODKEY, SHIFT], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
+ Key::new(&[MODKEY], keycodes::O, KeyAction::Spawn, Arg::Array(SCRIPT_CMD)),
Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
+ Key::new(&[MODKEY], keycodes::F, KeyAction::ToggleFullScreen, Arg::None),
Key::new(&[MODKEY], keycodes::A, KeyAction::ToggleGaps, Arg::None),
Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
diff --git a/src/keyboard/handlers.rs b/src/keyboard/handlers.rs
index b72b57d..8313e86 100644
--- a/src/keyboard/handlers.rs
+++ b/src/keyboard/handlers.rs
@@ -12,6 +12,7 @@ pub enum KeyAction {
Restart,
ViewTag,
ToggleGaps,
+ ToggleFullScreen,
MoveToTag,
None,
}
diff --git a/src/window_manager.rs b/src/window_manager.rs
index d736a5a..0e8633a 100644
--- a/src/window_manager.rs
+++ b/src/window_manager.rs
@@ -30,6 +30,7 @@ pub struct WindowManager {
window_tags: std::collections::HashMap<Window, TagMask>,
selected_tags: TagMask,
gaps_enabled: bool,
+ fullscreen_window: Option<Window>,
bar: Bar,
}
@@ -67,6 +68,7 @@ impl WindowManager {
window_tags: std::collections::HashMap::new(),
selected_tags,
gaps_enabled,
+ fullscreen_window: None,
bar,
};
@@ -278,6 +280,46 @@ impl WindowManager {
}
}
+ fn toggle_fullscreen(&mut self) -> Result<()> {
+ if let Some(focused) = self.focused_window {
+ if self.fullscreen_window == Some(focused) {
+ // Exit fullscreen
+ self.fullscreen_window = None;
+
+ // Show bar
+ self.connection.map_window(self.bar.window())?;
+
+ // Restore normal layout
+ self.apply_layout()?;
+ self.update_focus_visuals()?;
+ } else {
+ // Enter fullscreen
+ self.fullscreen_window = Some(focused);
+
+ // Hide bar
+ self.connection.unmap_window(self.bar.window())?;
+
+ // Make window fill entire screen
+ let screen_width = self.screen.width_in_pixels as u32;
+ let screen_height = self.screen.height_in_pixels as u32;
+
+ self.connection.configure_window(
+ focused,
+ &ConfigureWindowAux::new()
+ .x(0)
+ .y(0)
+ .width(screen_width)
+ .height(screen_height)
+ .border_width(0)
+ .stack_mode(StackMode::ABOVE), // This raises the window
+ )?;
+
+ self.connection.flush()?;
+ }
+ }
+ Ok(())
+ }
+
fn update_bar(&mut self) -> Result<()> {
let mut occupied_tags: TagMask = 0;
for &tags in self.window_tags.values() {
@@ -315,6 +357,9 @@ impl WindowManager {
}
}
}
+ KeyAction::ToggleFullScreen => {
+ self.toggle_fullscreen()?;
+ }
KeyAction::FocusStack => {
if let Arg::Int(direction) = arg {
self.cycle_focus(*direction)?;
@@ -377,6 +422,11 @@ impl WindowManager {
return Ok(());
}
+ if self.fullscreen_window.is_some() {
+ self.fullscreen_window = None;
+ self.connection.map_window(self.bar.window())?;
+ }
+
self.selected_tags = tag_mask(tag_index);
self.save_selected_tags()?;
@@ -571,6 +621,9 @@ impl WindowManager {
}
fn apply_layout(&self) -> Result<()> {
+ if self.fullscreen_window.is_some() {
+ return Ok(());
+ }
let screen_width = self.screen.width_in_pixels as u32;
let screen_height = self.screen.height_in_pixels as u32;
let border_width = BORDER_WIDTH;
@@ -623,6 +676,11 @@ impl WindowManager {
self.windows.retain(|&w| w != window);
self.window_tags.remove(&window);
+ if self.fullscreen_window == Some(window) {
+ self.fullscreen_window = None;
+ self.connection.map_window(self.bar.window())?;
+ }
+
if self.windows.len() < initial_count {
if self.focused_window == Some(window) {
let new_focus = if self.windows.is_empty() {