fix something
This commit is contained in:
parent
155cb18ffb
commit
16fb08ae03
1 changed files with 52 additions and 53 deletions
65
src/main.rs
65
src/main.rs
|
@ -1,5 +1,6 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate penrose;
|
extern crate penrose;
|
||||||
|
|
||||||
use penrose::{
|
use penrose::{
|
||||||
core::{
|
core::{
|
||||||
bindings::KeyEventHandler,
|
bindings::KeyEventHandler,
|
||||||
|
@ -9,10 +10,9 @@ manager::WindowManager,
|
||||||
},
|
},
|
||||||
logging_error_handler,
|
logging_error_handler,
|
||||||
xcb::new_xcb_backed_window_manager,
|
xcb::new_xcb_backed_window_manager,
|
||||||
Backward, Forward, Less, More,
|
Backward, Forward, Less, More, Selector
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
use simplelog::{LevelFilter, SimpleLogger};
|
use simplelog::{LevelFilter, SimpleLogger};
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,43 +27,42 @@ if let Err(e) = SimpleLogger::init(LevelFilter::Info, simplelog::Config::default
|
||||||
panic!("unable to set log level: {}", e);
|
panic!("unable to set log level: {}", e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let config = Config::default();
|
||||||
|
let key_bindings = gen_keybindings! {
|
||||||
|
// Program launchers
|
||||||
|
"M-semicolon" => run_external!(LAUNCHER);
|
||||||
|
"M-Return" => run_external!(TERMINAL);
|
||||||
|
|
||||||
</span><span style="color:#fa5c4b;">let</span><span style="color:#fdf4c1aa;"> config </span><span style="color:#fe8019;">= </span><span style="color:#fdf4c1aa;">Config::default();
|
// Exit Penrose (important to remember this one!)
|
||||||
</span><span style="color:#fa5c4b;">let</span><span style="color:#fdf4c1aa;"> key_bindings </span><span style="color:#fe8019;">= </span><span style="color:#fabd2f;">gen_keybindings! </span><span style="color:#fdf4c1aa;">{
|
"M-A-C-Escape" => run_internal!(exit);
|
||||||
</span><span style="font-style:italic;color:#928374;">// Program launchers
|
|
||||||
</span><span style="color:#b8bb26;">"M-semicolon" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_external!</span><span style="color:#fdf4c1aa;">(</span><span style="color:#fdf4c1;">LAUNCHER</span><span style="color:#fdf4c1aa;">);
|
|
||||||
</span><span style="color:#b8bb26;">"M-Return" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_external!</span><span style="color:#fdf4c1aa;">(</span><span style="color:#fdf4c1;">TERMINAL</span><span style="color:#fdf4c1aa;">);
|
|
||||||
|
|
||||||
</span><span style="font-style:italic;color:#928374;">// Exit Penrose (important to remember this one!)
|
// client management
|
||||||
</span><span style="color:#b8bb26;">"M-A-C-Escape" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(exit);
|
"M-j" => run_internal!(cycle_client, Forward);
|
||||||
|
"M-k" => run_internal!(cycle_client, Backward);
|
||||||
|
"M-S-j" => run_internal!(drag_client, Forward);
|
||||||
|
"M-S-k" => run_internal!(drag_client, Backward);
|
||||||
|
"M-S-f" => run_internal!(toggle_client_fullscreen, &Selector::Focused);
|
||||||
|
"M-S-q" => run_internal!(kill_client);
|
||||||
|
|
||||||
</span><span style="font-style:italic;color:#928374;">// client management
|
// workspace management
|
||||||
</span><span style="color:#b8bb26;">"M-j" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(cycle_client, Forward);
|
"M-Tab" => run_internal!(toggle_workspace);
|
||||||
</span><span style="color:#b8bb26;">"M-k" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(cycle_client, Backward);
|
"M-A-period" => run_internal!(cycle_workspace, Forward);
|
||||||
</span><span style="color:#b8bb26;">"M-S-j" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(drag_client, Forward);
|
"M-A-comma" => run_internal!(cycle_workspace, Backward);
|
||||||
</span><span style="color:#b8bb26;">"M-S-k" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(drag_client, Backward);
|
|
||||||
</span><span style="color:#b8bb26;">"M-S-f" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(toggle_client_fullscreen, </span><span style="color:#fe8019;">&</span><span style="color:#fdf4c1aa;">Selector::Focused);
|
|
||||||
</span><span style="color:#b8bb26;">"M-S-q" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(kill_client);
|
|
||||||
|
|
||||||
</span><span style="font-style:italic;color:#928374;">// workspace management
|
// Layout management
|
||||||
</span><span style="color:#b8bb26;">"M-Tab" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(toggle_workspace);
|
"M-grave" => run_internal!(cycle_layout, Forward);
|
||||||
</span><span style="color:#b8bb26;">"M-A-period" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(cycle_workspace, Forward);
|
"M-S-grave" => run_internal!(cycle_layout, Backward);
|
||||||
</span><span style="color:#b8bb26;">"M-A-comma" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(cycle_workspace, Backward);
|
"M-A-Up" => run_internal!(update_max_main, More);
|
||||||
|
"M-A-Down" => run_internal!(update_max_main, Less);
|
||||||
|
"M-A-Right" => run_internal!(update_main_ratio, More);
|
||||||
|
"M-A-Left" => run_internal!(update_main_ratio, Less);
|
||||||
|
|
||||||
</span><span style="font-style:italic;color:#928374;">// Layout management
|
refmap [ config.ws_range() ] in {
|
||||||
</span><span style="color:#b8bb26;">"M-grave" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(cycle_layout, Forward);
|
"M-{}" => focus_workspace [ index_selectors(config.workspaces().len()) ];
|
||||||
</span><span style="color:#b8bb26;">"M-S-grave" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(cycle_layout, Backward);
|
"M-S-{}" => client_to_workspace [ index_selectors(config.workspaces().len()) ];
|
||||||
</span><span style="color:#b8bb26;">"M-A-Up" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(update_max_main, More);
|
|
||||||
</span><span style="color:#b8bb26;">"M-A-Down" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(update_max_main, Less);
|
|
||||||
</span><span style="color:#b8bb26;">"M-A-Right" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(update_main_ratio, More);
|
|
||||||
</span><span style="color:#b8bb26;">"M-A-Left" </span><span style="color:#fe8019;">=> </span><span style="color:#fabd2f;">run_internal!</span><span style="color:#fdf4c1aa;">(update_main_ratio, Less);
|
|
||||||
|
|
||||||
refmap [ config.</span><span style="color:#fabd2f;">ws_range</span><span style="color:#fdf4c1aa;">() ] </span><span style="color:#fe8019;">in </span><span style="color:#fdf4c1aa;">{
|
|
||||||
</span><span style="color:#b8bb26;">"M-{}" </span><span style="color:#fe8019;">=></span><span style="color:#fdf4c1aa;"> focus_workspace [ </span><span style="color:#fabd2f;">index_selectors</span><span style="color:#fdf4c1aa;">(config.</span><span style="color:#fabd2f;">workspaces</span><span style="color:#fdf4c1aa;">().</span><span style="color:#fabd2f;">len</span><span style="color:#fdf4c1aa;">()) ];
|
|
||||||
</span><span style="color:#b8bb26;">"M-S-{}" </span><span style="color:#fe8019;">=></span><span style="color:#fdf4c1aa;"> client_to_workspace [ </span><span style="color:#fabd2f;">index_selectors</span><span style="color:#fdf4c1aa;">(config.</span><span style="color:#fabd2f;">workspaces</span><span style="color:#fdf4c1aa;">().</span><span style="color:#fabd2f;">len</span><span style="color:#fdf4c1aa;">()) ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
</span><span style="color:#fa5c4b;">let mut</span><span style="color:#fdf4c1aa;"> wm </span><span style="color:#fe8019;">= </span><span style="color:#fabd2f;">new_xcb_backed_window_manager</span><span style="color:#fdf4c1aa;">(config, </span><span style="color:#fabd2f;">vec!</span><span style="color:#fdf4c1aa;">[], </span><span style="color:#fabd2f;">logging_error_handler</span><span style="color:#fdf4c1aa;">())</span><span style="color:#fe8019;">?</span><span style="color:#fdf4c1aa;">;
|
let mut wm = new_xcb_backed_window_manager(config, vec![], logging_error_handler())?;
|
||||||
wm.</span><span style="color:#fabd2f;">grab_keys_and_run</span><span style="color:#fdf4c1aa;">(key_bindings, </span><span style="color:#fabd2f;">map!</span><span style="color:#fdf4c1aa;">{})
|
wm.grab_keys_and_run(key_bindings, map!{})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue