This commit is contained in:
Ohio2 2021-07-28 19:13:38 +02:00
parent 16fb08ae03
commit ae9d2aec9b
4 changed files with 33 additions and 15 deletions

View file

@ -15,3 +15,4 @@ thiserror = "1.0.26"
paste = "1.0.5" paste = "1.0.5"
serde_json = "1.0.64" serde_json = "1.0.64"
simplelog = "0.8.0" simplelog = "0.8.0"

View file

@ -1,9 +1,13 @@
ohio2-penrose: violet:
cargo build --release cargo build --release
install-root:
cp -f target/release/violet /usr/local/bin/violet
cp -f scripts/init.sh /usr/local/bin/violet-init.sh
install: install:
scp target/debug/ohio2-penrose /usr/bin/ohio2-penrose cp -f target/release/violet ~/.local/bin/violet
cp -f scripts/init.sh ~/.local/bin/init.sh
remove: remove:
rm /usr/bin/ohio2-penrose rm /usr/local/bin/violet
clean: clean:
rm Cargo.lock rm Cargo.lock
rm -rf target rm -rf target

3
scripts/init.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env zsh
picom &
nitrogen &

View file

@ -1,39 +1,50 @@
#[macro_use] #[macro_use]
extern crate penrose; extern crate penrose;
use penrose::{ use penrose::{
contrib::{
actions::focus_or_spawn,
extensions::{dmenu::*, Scratchpad},
},
core::{ core::{
bindings::KeyEventHandler, bindings::KeyEventHandler,
config::Config, config::Config,
helpers::index_selectors, helpers::index_selectors,
manager::WindowManager, manager::WindowManager,
layout::{
LayoutConf,
Layout,
side_stack,
monocle,
}
}, },
logging_error_handler, logging_error_handler,
xcb::new_xcb_backed_window_manager, xcb::new_xcb_backed_window_manager,
Backward, Forward, Less, More, Selector Backward, Forward, Less, More, Selector
}; };
use simplelog::{LevelFilter, SimpleLogger}; use simplelog::{LevelFilter, SimpleLogger};
// Replace these with your preferred terminal and program launcher // Replace these with your preferred terminal and program launcher
const TERMINAL: &str = "alacritty"; const TERMINAL: &str = "alacritty";
const LAUNCHER: &str = "dmenu_run"; const LAUNCHER: &str = "dmenu_run";
const BROWSER: &str = "brave";
fn main() -> penrose::Result<()> { fn main() -> penrose::Result<()> {
//let hooks: Hooks<Conn> = vec![
// ManageExistingClients::new(),
// sp.get_hook(),
// Box::new(StartupScript::new("/usr/local/scripts/penrose-startup.sh")),
//];
// Initialise the logger (use LevelFilter::Debug to enable debug logging) // Initialise the logger (use LevelFilter::Debug to enable debug logging)
if let Err(e) = SimpleLogger::init(LevelFilter::Info, simplelog::Config::default()) { 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 config = Config::default();
let key_bindings = gen_keybindings! { let key_bindings = gen_keybindings! {
// Program launchers // Program launchers
"M-semicolon" => run_external!(LAUNCHER); "M-A-Return" => run_external!(LAUNCHER);
"M-Return" => run_external!(TERMINAL); "M-Return" => run_external!(TERMINAL);
"A-b" => run_external!(BROWSER);
// Exit Penrose (important to remember this one!) // Exit Violet (important to remember this one!)
"M-A-C-Escape" => run_internal!(exit); "M-A-C-Escape" => run_internal!(exit);
// client management // client management
@ -56,7 +67,6 @@ fn main() -> penrose::Result<()> {
"M-A-Down" => run_internal!(update_max_main, Less); "M-A-Down" => run_internal!(update_max_main, Less);
"M-A-Right" => run_internal!(update_main_ratio, More); "M-A-Right" => run_internal!(update_main_ratio, More);
"M-A-Left" => run_internal!(update_main_ratio, Less); "M-A-Left" => run_internal!(update_main_ratio, Less);
refmap [ config.ws_range() ] in { refmap [ config.ws_range() ] in {
"M-{}" => focus_workspace [ index_selectors(config.workspaces().len()) ]; "M-{}" => focus_workspace [ index_selectors(config.workspaces().len()) ];
"M-S-{}" => client_to_workspace [ index_selectors(config.workspaces().len()) ]; "M-S-{}" => client_to_workspace [ index_selectors(config.workspaces().len()) ];