rename deps

This commit is contained in:
Harivansh Rathi 2026-03-24 23:02:44 -04:00
parent 62a1aab859
commit 46dd2f9c53
7 changed files with 20 additions and 20 deletions

View file

@ -91,7 +91,7 @@ impl super::DesktopBackend for X11Backend {
.duration_since(std::time::UNIX_EPOCH) .duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default() .unwrap_or_default()
.as_millis(); .as_millis();
let screenshot_path = format!("/tmp/desktop-ctl-{timestamp}.png"); let screenshot_path = format!("/tmp/deskctl-{timestamp}.png");
image image
.save(&screenshot_path) .save(&screenshot_path)
.context("Failed to save screenshot")?; .context("Failed to save screenshot")?;

View file

@ -12,15 +12,15 @@ use crate::cli::GlobalOpts;
use crate::core::protocol::{Request, Response}; use crate::core::protocol::{Request, Response};
fn socket_dir() -> PathBuf { 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); return PathBuf::from(dir);
} }
if let Ok(runtime) = std::env::var("XDG_RUNTIME_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() dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("/tmp")) .unwrap_or_else(|| PathBuf::from("/tmp"))
.join(".desktop-ctl") .join(".deskctl")
} }
fn socket_path(opts: &GlobalOpts) -> PathBuf { fn socket_path(opts: &GlobalOpts) -> PathBuf {
@ -47,10 +47,10 @@ fn spawn_daemon(opts: &GlobalOpts) -> Result<()> {
.context("Failed to create socket directory")?; .context("Failed to create socket directory")?;
let mut cmd = Command::new(exe); let mut cmd = Command::new(exe);
cmd.env("DESKTOP_CTL_DAEMON", "1") cmd.env("DESKCTL_DAEMON", "1")
.env("DESKTOP_CTL_SESSION", &opts.session) .env("DESKCTL_SESSION", &opts.session)
.env("DESKTOP_CTL_SOCKET_PATH", socket_path(opts)) .env("DESKCTL_SOCKET_PATH", socket_path(opts))
.env("DESKTOP_CTL_PID_PATH", pid_path(opts)) .env("DESKCTL_PID_PATH", pid_path(opts))
.stdin(Stdio::null()) .stdin(Stdio::null())
.stdout(Stdio::null()) .stdout(Stdio::null())
.stderr(Stdio::piped()); .stderr(Stdio::piped());

View file

@ -7,7 +7,7 @@ use anyhow::Result;
use crate::core::protocol::{Request, Response}; use crate::core::protocol::{Request, Response};
#[derive(Parser)] #[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 { pub struct App {
#[command(flatten)] #[command(flatten)]
pub global: GlobalOpts, pub global: GlobalOpts,
@ -18,7 +18,7 @@ pub struct App {
#[derive(Args)] #[derive(Args)]
pub struct GlobalOpts { pub struct GlobalOpts {
/// Path to the daemon Unix socket /// 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>, pub socket: Option<PathBuf>,
/// Session name (allows multiple daemon instances) /// Session name (allows multiple daemon instances)
@ -102,7 +102,7 @@ pub enum Command {
GetMousePosition, GetMousePosition,
/// Take a screenshot without window tree /// Take a screenshot without window tree
Screenshot { Screenshot {
/// Save path (default: /tmp/desktop-ctl-{timestamp}.png) /// Save path (default: /tmp/deskctl-{timestamp}.png)
path: Option<PathBuf>, path: Option<PathBuf>,
/// Draw bounding boxes and labels /// Draw bounding boxes and labels
#[arg(long)] #[arg(long)]

View file

@ -15,20 +15,20 @@ pub fn detect_session() -> Result<SessionType> {
bail!( bail!(
"No X11 session detected.\n\ "No X11 session detected.\n\
XDG_SESSION_TYPE is not set and DISPLAY is not set.\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" => { "wayland" => {
bail!( bail!(
"Wayland session detected (XDG_SESSION_TYPE=wayland).\n\ "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 => { other => {
bail!( bail!(
"Unsupported session type: {other}\n\ "Unsupported session type: {other}\n\
desktop-ctl currently supports X11 only." deskctl currently supports X11 only."
); );
} }
} }

View file

@ -411,7 +411,7 @@ async fn handle_screenshot(
.duration_since(std::time::UNIX_EPOCH) .duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default() .unwrap_or_default()
.as_millis(); .as_millis();
format!("/tmp/desktop-ctl-{ts}.png") format!("/tmp/deskctl-{ts}.png")
}); });
let mut state = state.lock().await; let mut state = state.lock().await;
match state.backend.screenshot(&path, annotate) { match state.backend.screenshot(&path, annotate) {

View file

@ -24,11 +24,11 @@ pub fn run() -> Result<()> {
} }
async fn async_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) .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) .map(PathBuf::from)
.ok(); .ok();
@ -45,7 +45,7 @@ async fn async_run() -> Result<()> {
let listener = UnixListener::bind(&socket_path) let listener = UnixListener::bind(&socket_path)
.context(format!("Failed to bind socket: {}", socket_path.display()))?; .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( let state = Arc::new(Mutex::new(
DaemonState::new(session, socket_path.clone()) DaemonState::new(session, socket_path.clone())
.context("Failed to initialize daemon state")? .context("Failed to initialize daemon state")?

View file

@ -4,7 +4,7 @@ mod core;
mod daemon; mod daemon;
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
if std::env::var("DESKTOP_CTL_DAEMON").is_ok() { if std::env::var("DESKCTL_DAEMON").is_ok() {
return daemon::run(); return daemon::run();
} }
cli::run() cli::run()