mirror of
https://github.com/harivansh-afk/deskctl.git
synced 2026-04-15 06:04:41 +00:00
rename deps
This commit is contained in:
parent
62a1aab859
commit
46dd2f9c53
7 changed files with 20 additions and 20 deletions
|
|
@ -91,7 +91,7 @@ impl super::DesktopBackend for X11Backend {
|
|||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis();
|
||||
let screenshot_path = format!("/tmp/desktop-ctl-{timestamp}.png");
|
||||
let screenshot_path = format!("/tmp/deskctl-{timestamp}.png");
|
||||
image
|
||||
.save(&screenshot_path)
|
||||
.context("Failed to save screenshot")?;
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ use crate::cli::GlobalOpts;
|
|||
use crate::core::protocol::{Request, Response};
|
||||
|
||||
fn socket_dir() -> PathBuf {
|
||||
if let Ok(dir) = std::env::var("DESKTOP_CTL_SOCKET_DIR") {
|
||||
if let Ok(dir) = std::env::var("DESKCTL_SOCKET_DIR") {
|
||||
return PathBuf::from(dir);
|
||||
}
|
||||
if let Ok(runtime) = std::env::var("XDG_RUNTIME_DIR") {
|
||||
return PathBuf::from(runtime).join("desktop-ctl");
|
||||
return PathBuf::from(runtime).join("deskctl");
|
||||
}
|
||||
dirs::home_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("/tmp"))
|
||||
.join(".desktop-ctl")
|
||||
.join(".deskctl")
|
||||
}
|
||||
|
||||
fn socket_path(opts: &GlobalOpts) -> PathBuf {
|
||||
|
|
@ -47,10 +47,10 @@ fn spawn_daemon(opts: &GlobalOpts) -> Result<()> {
|
|||
.context("Failed to create socket directory")?;
|
||||
|
||||
let mut cmd = Command::new(exe);
|
||||
cmd.env("DESKTOP_CTL_DAEMON", "1")
|
||||
.env("DESKTOP_CTL_SESSION", &opts.session)
|
||||
.env("DESKTOP_CTL_SOCKET_PATH", socket_path(opts))
|
||||
.env("DESKTOP_CTL_PID_PATH", pid_path(opts))
|
||||
cmd.env("DESKCTL_DAEMON", "1")
|
||||
.env("DESKCTL_SESSION", &opts.session)
|
||||
.env("DESKCTL_SOCKET_PATH", socket_path(opts))
|
||||
.env("DESKCTL_PID_PATH", pid_path(opts))
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::piped());
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use anyhow::Result;
|
|||
use crate::core::protocol::{Request, Response};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "desktop-ctl", version, about = "Desktop control CLI for AI agents")]
|
||||
#[command(name = "deskctl", version, about = "Desktop control CLI for AI agents")]
|
||||
pub struct App {
|
||||
#[command(flatten)]
|
||||
pub global: GlobalOpts,
|
||||
|
|
@ -18,7 +18,7 @@ pub struct App {
|
|||
#[derive(Args)]
|
||||
pub struct GlobalOpts {
|
||||
/// Path to the daemon Unix socket
|
||||
#[arg(long, global = true, env = "DESKTOP_CTL_SOCKET")]
|
||||
#[arg(long, global = true, env = "DESKCTL_SOCKET")]
|
||||
pub socket: Option<PathBuf>,
|
||||
|
||||
/// Session name (allows multiple daemon instances)
|
||||
|
|
@ -102,7 +102,7 @@ pub enum Command {
|
|||
GetMousePosition,
|
||||
/// Take a screenshot without window tree
|
||||
Screenshot {
|
||||
/// Save path (default: /tmp/desktop-ctl-{timestamp}.png)
|
||||
/// Save path (default: /tmp/deskctl-{timestamp}.png)
|
||||
path: Option<PathBuf>,
|
||||
/// Draw bounding boxes and labels
|
||||
#[arg(long)]
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ pub fn detect_session() -> Result<SessionType> {
|
|||
bail!(
|
||||
"No X11 session detected.\n\
|
||||
XDG_SESSION_TYPE is not set and DISPLAY is not set.\n\
|
||||
desktop-ctl requires an X11 session. Wayland support coming in v0.2."
|
||||
deskctl requires an X11 session. Wayland support coming in v0.2."
|
||||
);
|
||||
}
|
||||
}
|
||||
"wayland" => {
|
||||
bail!(
|
||||
"Wayland session detected (XDG_SESSION_TYPE=wayland).\n\
|
||||
desktop-ctl currently supports X11 only. Wayland/Hyprland support coming in v0.2."
|
||||
deskctl currently supports X11 only. Wayland/Hyprland support coming in v0.2."
|
||||
);
|
||||
}
|
||||
other => {
|
||||
bail!(
|
||||
"Unsupported session type: {other}\n\
|
||||
desktop-ctl currently supports X11 only."
|
||||
deskctl currently supports X11 only."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ async fn handle_screenshot(
|
|||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis();
|
||||
format!("/tmp/desktop-ctl-{ts}.png")
|
||||
format!("/tmp/deskctl-{ts}.png")
|
||||
});
|
||||
let mut state = state.lock().await;
|
||||
match state.backend.screenshot(&path, annotate) {
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ pub fn run() -> Result<()> {
|
|||
}
|
||||
|
||||
async fn async_run() -> Result<()> {
|
||||
let socket_path = std::env::var("DESKTOP_CTL_SOCKET_PATH")
|
||||
let socket_path = std::env::var("DESKCTL_SOCKET_PATH")
|
||||
.map(PathBuf::from)
|
||||
.context("DESKTOP_CTL_SOCKET_PATH not set")?;
|
||||
.context("DESKCTL_SOCKET_PATH not set")?;
|
||||
|
||||
let pid_path = std::env::var("DESKTOP_CTL_PID_PATH")
|
||||
let pid_path = std::env::var("DESKCTL_PID_PATH")
|
||||
.map(PathBuf::from)
|
||||
.ok();
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ async fn async_run() -> Result<()> {
|
|||
let listener = UnixListener::bind(&socket_path)
|
||||
.context(format!("Failed to bind socket: {}", socket_path.display()))?;
|
||||
|
||||
let session = std::env::var("DESKTOP_CTL_SESSION").unwrap_or_else(|_| "default".to_string());
|
||||
let session = std::env::var("DESKCTL_SESSION").unwrap_or_else(|_| "default".to_string());
|
||||
let state = Arc::new(Mutex::new(
|
||||
DaemonState::new(session, socket_path.clone())
|
||||
.context("Failed to initialize daemon state")?
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ mod core;
|
|||
mod daemon;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
if std::env::var("DESKTOP_CTL_DAEMON").is_ok() {
|
||||
if std::env::var("DESKCTL_DAEMON").is_ok() {
|
||||
return daemon::run();
|
||||
}
|
||||
cli::run()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue