Compare commits
3 commits
8e9567e6e0
...
e5a7c4108d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5a7c4108d | ||
|
|
80d4d72417 | ||
|
|
4d857b9a99 |
13 changed files with 38 additions and 44 deletions
25
build.rs
25
build.rs
|
|
@ -1,5 +1,8 @@
|
|||
use clap::{CommandFactory, command};
|
||||
use clap_complete::{aot::Elvish, generate_to, shells::{Bash, Fish, Zsh}};
|
||||
use clap_complete::{
|
||||
generate_to,
|
||||
shells::{Bash, Elvish, Fish, Zsh},
|
||||
};
|
||||
use std::env;
|
||||
use std::io::Error;
|
||||
|
||||
|
|
@ -12,17 +15,15 @@ fn main() -> Result<(), Error> {
|
|||
};
|
||||
|
||||
let mut cmd = Cli::command();
|
||||
let bash_path = generate_to(
|
||||
Bash,
|
||||
&mut cmd, // We need to specify what generator to use
|
||||
"sdu", // We need to specify the bin name manually
|
||||
&outdir, // We need to specify where to write to
|
||||
)?;
|
||||
let zsh_path = generate_to(Zsh, &mut cmd, "sdu", &outdir)?;
|
||||
let fish_path = generate_to(Fish, &mut cmd, "sdu", &outdir)?;
|
||||
let elvish_path = generate_to(Elvish, &mut cmd, "sdu", outdir)?;
|
||||
let bin_name = "sdu";
|
||||
let bash_path = generate_to(Bash, &mut cmd, bin_name, &outdir)?;
|
||||
let zsh_path = generate_to(Zsh, &mut cmd, bin_name, &outdir)?;
|
||||
let fish_path = generate_to(Fish, &mut cmd, bin_name, &outdir)?;
|
||||
let elvish_path = generate_to(Elvish, &mut cmd, bin_name, outdir)?;
|
||||
|
||||
println!("cargo:warning=completion files were generated: [ {bash_path:?}, {zsh_path:?}, {fish_path:?}, {elvish_path:?} ]");
|
||||
println!(
|
||||
"cargo:warning=completion files were generated: [ {bash_path:?}, {zsh_path:?}, {fish_path:?}, {elvish_path:?} ]"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,4 +188,3 @@ pub enum ProfileGetCommand {
|
|||
#[clap(alias = "i")]
|
||||
Icon,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,5 @@ pub async fn watch(
|
|||
let main = wx.main();
|
||||
wx.config.pathset([watch_path]);
|
||||
let _ = main.await.into_diagnostic();
|
||||
//todo: handle this return properly
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use log::debug;
|
|||
|
||||
use crate::{
|
||||
config::{Profile, Programs},
|
||||
lib::{profile::active_profile, get_sway_connection, run_sway_command, SDUError},
|
||||
lib::{SDUError, get_sway_connection, profile::active_profile, run_sway_command},
|
||||
};
|
||||
|
||||
pub fn launch(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ use shellexpand::tilde;
|
|||
use xdg::BaseDirectories;
|
||||
|
||||
use crate::{
|
||||
config::LockConf, lib::{sway_ipc::get_sway_connection, DirectoryType, SDUError},
|
||||
config::LockConf,
|
||||
lib::{DirectoryType, SDUError, sway_ipc::get_sway_connection},
|
||||
};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
|
@ -146,7 +147,6 @@ pub fn lock_screen(lock_config: LockConf, force_bg_render: bool) -> Result<(), S
|
|||
}
|
||||
|
||||
pub fn generate_image(orig_img_data: DynamicImage, gen_image_path: PathBuf, lock_conf: LockConf) {
|
||||
// Result<(), ImageError> {
|
||||
let w = orig_img_data.width() as f32 * lock_conf.scale;
|
||||
let h = orig_img_data.height() as f32 * lock_conf.scale;
|
||||
let blurred_img_data = orig_img_data
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ mod scratchpad;
|
|||
mod shortcuts;
|
||||
mod sway;
|
||||
mod sway_ipc;
|
||||
mod utils;
|
||||
mod windows;
|
||||
mod workspaces;
|
||||
mod utils;
|
||||
|
||||
pub use {
|
||||
cli::{Cli, Commands},
|
||||
|
|
@ -22,7 +22,7 @@ pub use {
|
|||
shortcuts::shortcuts_fn,
|
||||
sway::sway_fn,
|
||||
sway_ipc::{get_sway_connection, run_sway_command},
|
||||
utils::{DirectoryType, SDUError, get_xdg_dirs, setup_runtime_dir},
|
||||
windows::get_window_info,
|
||||
workspaces::get_workspace_info,
|
||||
utils::{setup_runtime_dir, get_xdg_dirs, SDUError, DirectoryType}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
use {
|
||||
crate::{
|
||||
config::LockConf, lib::cli::PowerCommand,
|
||||
lib::{lock_screen, get_sway_connection, run_sway_command, SDUError},
|
||||
config::LockConf,
|
||||
lib::cli::PowerCommand,
|
||||
lib::{SDUError, get_sway_connection, lock_screen, run_sway_command},
|
||||
},
|
||||
dialog::DialogBox,
|
||||
log::debug,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
use {
|
||||
crate::{
|
||||
config::{Config, Profile},
|
||||
//lib::get,
|
||||
get_xdg_dirs,
|
||||
lib::{
|
||||
SDUError,
|
||||
cli::{ProfileCommand, ProfileGetCommand, ProfileSwitchCommand},
|
||||
get, get_sway_connection, run_sway_command, shortcuts_fn, SDUError
|
||||
get, get_sway_connection, run_sway_command, shortcuts_fn,
|
||||
sway::focused_workspace_profile,
|
||||
},
|
||||
setup_runtime_dir,
|
||||
},
|
||||
|
|
@ -121,11 +122,10 @@ pub fn profile_fn(
|
|||
Ok(())
|
||||
}
|
||||
ProfileCommand::Shortcuts { shortcut_command } => {
|
||||
let active_profile =
|
||||
active_profile(profiles_config).expect("could not determine active profile");
|
||||
let focused_profile = focused_workspace_profile(profiles_config);
|
||||
shortcuts_fn(
|
||||
shortcut_command,
|
||||
active_profile
|
||||
focused_profile
|
||||
.scripts
|
||||
.expect("could not find scripts for profile"),
|
||||
)
|
||||
|
|
@ -139,7 +139,6 @@ fn initialize(
|
|||
uindex: usize,
|
||||
preserve_keyboard_order: bool,
|
||||
) -> Result<(), SDUError> {
|
||||
//payload: String) {
|
||||
for i in 0..10 {
|
||||
let workspace = (uindex * 10)
|
||||
+ match i.eq(&0) && !preserve_keyboard_order {
|
||||
|
|
|
|||
|
|
@ -4,21 +4,20 @@ use serde_json::json;
|
|||
use crate::{
|
||||
config::ScriptConf,
|
||||
lib::{
|
||||
SDUError,
|
||||
cli::{ShortcutCommand, ShortcutMode},
|
||||
sway_ipc::{get_sway_connection, run_sway_command},
|
||||
SDUError,
|
||||
},
|
||||
};
|
||||
|
||||
fn print_shortcuts(mode: &ShortcutMode, shortcuts: Vec<ScriptConf>) -> String {
|
||||
match mode {
|
||||
ShortcutMode::Dmenu => {
|
||||
let mut dmenu_shortcuts: String = String::new();
|
||||
let mut dmenu_entries = Vec::<String>::new();
|
||||
for shortcut in shortcuts {
|
||||
dmenu_shortcuts =
|
||||
format!("{}\n{} {}", dmenu_shortcuts, shortcut.icon, shortcut.name)
|
||||
dmenu_entries.push(format!("{} {}", shortcut.icon, shortcut.name));
|
||||
}
|
||||
dmenu_shortcuts
|
||||
dmenu_entries.join("\n")
|
||||
}
|
||||
ShortcutMode::Json => json!(shortcuts).to_string(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ use {
|
|||
crate::{
|
||||
config::{Profile, WindowIcon},
|
||||
lib::{
|
||||
SDUError,
|
||||
cli::{SwayCommand, SwayGetCommand},
|
||||
get_scratchpad_info, get_sway_connection, get_window_info, get_workspace_info,
|
||||
profile::profile_from_index,
|
||||
sway_ipc::{self, get_sway_info},
|
||||
SDUError
|
||||
},
|
||||
},
|
||||
log::debug,
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ use {
|
|||
crate::{
|
||||
config::{Profile, WindowIcon},
|
||||
lib::{
|
||||
cli::SwayGetCommand, get_scratchpad_info, sway::focused_workspace_profile,
|
||||
windows::get_window_info, workspaces::get_workspace_info, SDUError
|
||||
}
|
||||
SDUError, cli::SwayGetCommand, get_scratchpad_info, sway::focused_workspace_profile,
|
||||
windows::get_window_info, workspaces::get_workspace_info,
|
||||
},
|
||||
},
|
||||
log::debug,
|
||||
serde_json::{Value, json},
|
||||
std::time::Instant,
|
||||
swayipc::{Connection, EventType}
|
||||
swayipc::{Connection, EventType},
|
||||
};
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ pub fn get_window_info(window_icons: &[WindowIcon]) -> Value {
|
|||
debug!("{:#?}", window_count);
|
||||
let window_title = if window_count.gt(&0) {
|
||||
let window_node = nodes_tree.iter().find(|x| x.focused);
|
||||
//debug!("{:#?}",window_node);
|
||||
match window_node {
|
||||
Some(n) => {
|
||||
let mut window_name = n.name.clone().unwrap_or_default();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#![warn(unused_crate_dependencies)]
|
||||
//#![allow(clippy::style)]
|
||||
|
||||
#![allow(clippy::style)]
|
||||
|
||||
mod config;
|
||||
#[path = "lib/mod.rs"]
|
||||
|
|
@ -10,9 +9,9 @@ use {
|
|||
crate::{
|
||||
config::Config,
|
||||
lib::{
|
||||
Cli, Commands, get_xdg_dirs, launch, lock_screen, power_fn, profile_fn, setup_runtime_dir, shortcuts_fn, sway_fn
|
||||
Cli, Commands, get_xdg_dirs, launch, lock_screen, power_fn, profile_fn,
|
||||
setup_runtime_dir, shortcuts_fn, sway_fn,
|
||||
},
|
||||
|
||||
},
|
||||
clap::Parser,
|
||||
log::{debug, error},
|
||||
|
|
@ -21,9 +20,7 @@ use {
|
|||
|
||||
fn main() -> Result<(), ()> {
|
||||
let _build_script = include_str!("../Cargo.toml");
|
||||
let _build_script = include_str!("../Cargo.lock");
|
||||
env_logger::init();
|
||||
//Cli::command();
|
||||
let cli = Cli::parse();
|
||||
let config = if confy::get_configuration_file_path("sway-de-utils", "config")
|
||||
.expect("Unable to determine config file location")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue