Polish popup activation and rename application
This commit is contained in:
@@ -612,7 +612,7 @@ Use SQLite.
|
||||
Suggested location:
|
||||
|
||||
```text
|
||||
~/.local/share/clipbhoard/clipbhoard.db
|
||||
~/.local/share/cliphoard/cliphoard.db
|
||||
```
|
||||
|
||||
Follow XDG directories where appropriate.
|
||||
@@ -668,7 +668,7 @@ Use TOML.
|
||||
Suggested path:
|
||||
|
||||
```text
|
||||
~/.config/clipbhoard/config.toml
|
||||
~/.config/cliphoard/config.toml
|
||||
```
|
||||
|
||||
Follow XDG configuration directories.
|
||||
@@ -761,7 +761,7 @@ Provide useful application logs.
|
||||
Suggested path:
|
||||
|
||||
```text
|
||||
~/.local/state/clipbhoard/clipbhoard.log
|
||||
~/.local/state/cliphoard/cliphoard.log
|
||||
```
|
||||
|
||||
Respect XDG state directories.
|
||||
@@ -1057,7 +1057,7 @@ Use one consistent application ID.
|
||||
For example:
|
||||
|
||||
```text
|
||||
io.clipbhoard.Clipbhoard
|
||||
io.cliphoard.Cliphoard
|
||||
```
|
||||
|
||||
or another sensible reverse-domain identifier.
|
||||
@@ -1075,7 +1075,7 @@ consistent.
|
||||
Executable suggestion:
|
||||
|
||||
```text
|
||||
clipbhoard
|
||||
cliphoard
|
||||
```
|
||||
|
||||
Display name:
|
||||
@@ -1363,13 +1363,13 @@ Begin with something like:
|
||||
Expose:
|
||||
|
||||
```bash
|
||||
clipbhoard --version
|
||||
cliphoard --version
|
||||
```
|
||||
|
||||
Also provide:
|
||||
|
||||
```bash
|
||||
clipbhoard --help
|
||||
cliphoard --help
|
||||
```
|
||||
|
||||
Useful CLI options may eventually include:
|
||||
@@ -1393,7 +1393,7 @@ Provide enough diagnostics to debug installations.
|
||||
Useful command eventually:
|
||||
|
||||
```bash
|
||||
clipbhoard --diagnostics
|
||||
cliphoard --diagnostics
|
||||
```
|
||||
|
||||
Possible output:
|
||||
|
||||
@@ -78,7 +78,7 @@ Each bounded iteration must:
|
||||
- [ ] Ensure copy, paste, pin, delete, clear, pause, and resume have consistent UI feedback.
|
||||
- [x] Add icon-only copy, paste, and delete controls to every history row, with matching icon prefixes on toolbar actions (27 X11-feature tests, Docker GTK/X11/package build, 2026-09-12); live GUI acceptance remains pending.
|
||||
- [x] Highlight authoritative case-insensitive substring and fuzzy search matches in result previews, with core-level range tests (28 X11-feature tests and Docker GTK/X11/package build, 2026-09-12); live GUI acceptance remains pending.
|
||||
- [x] Add double-click full-content inspection for multiline entries and confirmation before individual deletion from toolbar, row, or keyboard paths (28 X11-feature tests and Docker GTK/X11/package build, 2026-09-12); live GUI acceptance remains pending.
|
||||
- [x] Add double-click-only full-content inspection for multiline entries (single selection does not open details) and confirmation before individual deletion from toolbar, row, or keyboard paths (28 X11-feature tests and Docker GTK/X11/package build, 2026-09-12); live GUI acceptance remains pending.
|
||||
- [x] Add in-app Help documentation covering features, shortcuts, search ranking, installation, and uninstall/data removal (28 X11-feature tests and Docker GTK/X11/package build, 2026-09-12); content accuracy/live GUI acceptance remains pending.
|
||||
- [x] Add state-specific icon-only pin/unpin controls on the left of every history row, routed through the existing pin-limit logic (27 X11-feature tests and Docker GTK/X11/package build, 2026-09-12); live GUI acceptance remains pending.
|
||||
- [x] Surface actionable status text for keyboard and toolbar action failures, including successful clipboard writes with failed history updates (Docker GTK/X11 build, 2026-09-10).
|
||||
@@ -87,7 +87,7 @@ Each bounded iteration must:
|
||||
existing config overrides remain supported (27 X11-feature tests and Docker
|
||||
GTK/X11/package build, 2026-09-12).
|
||||
- [ ] Verify tray activation/menu behavior and graceful tray unavailability.
|
||||
- [ ] Verify second invocation/show behavior including diagnostics (show requests now present immediately while target-focus capture completes asynchronously).
|
||||
- [x] Make the global shortcut and second-instance show request toggle the popup reliably without a delayed focus result reopening it (28 X11-feature tests and Docker GTK/X11/package build, 2026-09-12); live GUI acceptance remains pending.
|
||||
- [x] Make `--diagnostics` inspect the running installation without triggering a
|
||||
show request, and report the log directory plus instance state (20 tests and
|
||||
Docker GTK/X11/package build, 2026-09-12).
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -147,7 +147,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipbhoard"
|
||||
name = "cliphoard"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
name = "clipbhoard"
|
||||
name = "cliphoard"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "A tiny, keyboard-first clipboard history utility"
|
||||
license = "MIT"
|
||||
default-run = "clipbhoard"
|
||||
default-run = "cliphoard"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@@ -19,4 +19,4 @@ RUN cargo test --locked \
|
||||
|
||||
RUN packaging/build-deb.sh
|
||||
|
||||
CMD ["sh", "-c", "mkdir -p /out && cp target/clipbhoard_*.deb /out/"]
|
||||
CMD ["sh", "-c", "mkdir -p /out && cp target/cliphoard_*.deb /out/"]
|
||||
|
||||
14
README.md
14
README.md
@@ -23,23 +23,23 @@ headers, runs tests, compiles the GTK/X11 backend, and creates an installable
|
||||
`.deb`:
|
||||
|
||||
```bash
|
||||
docker build -t clipbhoard-builder .
|
||||
docker run --rm -v "$PWD/target:/out" clipbhoard-builder
|
||||
docker build -t cliphoard-builder .
|
||||
docker run --rm -v "$PWD/target:/out" cliphoard-builder
|
||||
```
|
||||
|
||||
The resulting package declares its runtime libraries, so Debian/Ubuntu users
|
||||
can install it with `sudo apt install ./target/clipbhoard_0.1.0_amd64.deb` and
|
||||
can install it with `sudo apt install ./target/cliphoard_0.1.0_amd64.deb` and
|
||||
the package manager will resolve GTK/X11 runtime dependencies automatically.
|
||||
|
||||
Once installed, Cliphoard runs as a background process. `Ctrl+Alt+V` opens the
|
||||
popup, and `clipbhoard --show` requests it without keeping the invoking shell
|
||||
popup, and `cliphoard --show` requests it without keeping the invoking shell
|
||||
blocked. On Cinnamon, a StatusNotifier tray icon provides another way to open
|
||||
the popup when the desktop panel exposes tray icons.
|
||||
|
||||
Runtime files follow XDG conventions:
|
||||
|
||||
- database: `~/.local/share/clipbhoard/clipbhoard.db`
|
||||
- configuration: `~/.config/clipbhoard/config.toml`
|
||||
- log state: `~/.local/state/clipbhoard/`
|
||||
- database: `~/.local/share/cliphoard/cliphoard.db`
|
||||
- configuration: `~/.config/cliphoard/config.toml`
|
||||
- log state: `~/.local/state/cliphoard/`
|
||||
|
||||
The full product contract is in [.agents/BIBLE.md](.agents/BIBLE.md).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Cliphoard
|
||||
Exec=clipbhoard --autostart
|
||||
Exec=cliphoard --autostart
|
||||
OnlyShowIn=Cinnamon;GNOME;KDE;XFCE;
|
||||
X-GNOME-Autostart-enabled=true
|
||||
NoDisplay=true
|
||||
@@ -2,8 +2,8 @@
|
||||
Type=Application
|
||||
Name=Cliphoard
|
||||
Comment=Fast, keyboard-first clipboard history
|
||||
Exec=clipbhoard
|
||||
Icon=io.clipbhoard.Clipbhoard
|
||||
Exec=cliphoard
|
||||
Icon=io.cliphoard.Cliphoard
|
||||
Terminal=false
|
||||
Categories=Utility;
|
||||
Keywords=clipboard;history;copy;paste;
|
||||
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
version="${CLIPBHOARD_VERSION:-0.1.0}"
|
||||
package_root="${PWD}/target/clipbhoard-deb"
|
||||
version="${CLIPHOARD_VERSION:-0.1.0}"
|
||||
package_root="${PWD}/target/cliphoard-deb"
|
||||
rm -rf "$package_root"
|
||||
mkdir -p "$package_root/DEBIAN" \
|
||||
"$package_root/usr/bin" \
|
||||
@@ -10,10 +10,10 @@ mkdir -p "$package_root/DEBIAN" \
|
||||
"$package_root/usr/share/icons/hicolor/scalable/apps" \
|
||||
"$package_root/etc/xdg/autostart"
|
||||
|
||||
install -m 0755 target/release/clipbhoard "$package_root/usr/bin/clipbhoard"
|
||||
install -m 0644 data/io.clipbhoard.Clipbhoard.desktop "$package_root/usr/share/applications/io.clipbhoard.Clipbhoard.desktop"
|
||||
install -m 0644 data/io.clipbhoard.Clipbhoard.svg "$package_root/usr/share/icons/hicolor/scalable/apps/io.clipbhoard.Clipbhoard.svg"
|
||||
install -m 0644 data/io.clipbhoard.Clipbhoard-autostart.desktop "$package_root/etc/xdg/autostart/io.clipbhoard.Clipbhoard.desktop"
|
||||
install -m 0755 target/release/cliphoard "$package_root/usr/bin/cliphoard"
|
||||
install -m 0644 data/io.cliphoard.Cliphoard.desktop "$package_root/usr/share/applications/io.cliphoard.Cliphoard.desktop"
|
||||
install -m 0644 data/io.cliphoard.Cliphoard.svg "$package_root/usr/share/icons/hicolor/scalable/apps/io.cliphoard.Cliphoard.svg"
|
||||
install -m 0644 data/io.cliphoard.Cliphoard-autostart.desktop "$package_root/etc/xdg/autostart/io.cliphoard.Cliphoard.desktop"
|
||||
|
||||
sed "s/^Version:.*/Version: ${version}/" packaging/debian/control > "$package_root/DEBIAN/control"
|
||||
dpkg-deb --build --root-owner-group "$package_root" "target/clipbhoard_${version}_amd64.deb"
|
||||
dpkg-deb --build --root-owner-group "$package_root" "target/cliphoard_${version}_amd64.deb"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
target/release/clipbhoard usr/bin
|
||||
data/io.clipbhoard.Clipbhoard.desktop usr/share/applications
|
||||
data/io.clipbhoard.Clipbhoard.svg usr/share/icons/hicolor/scalable/apps
|
||||
data/io.clipbhoard.Clipbhoard-autostart.desktop etc/xdg/autostart
|
||||
4
packaging/cliphoard.install
Normal file
4
packaging/cliphoard.install
Normal file
@@ -0,0 +1,4 @@
|
||||
target/release/cliphoard usr/bin
|
||||
data/io.cliphoard.Cliphoard.desktop usr/share/applications
|
||||
data/io.cliphoard.Cliphoard.svg usr/share/icons/hicolor/scalable/apps
|
||||
data/io.cliphoard.Cliphoard-autostart.desktop etc/xdg/autostart
|
||||
@@ -1,4 +1,4 @@
|
||||
Package: clipbhoard
|
||||
Package: cliphoard
|
||||
Version: 0.1.0
|
||||
Section: utils
|
||||
Priority: optional
|
||||
|
||||
@@ -32,7 +32,7 @@ impl Config {
|
||||
pub fn path() -> PathBuf {
|
||||
dirs::config_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
.join("clipbhoard/config.toml")
|
||||
.join("cliphoard/config.toml")
|
||||
}
|
||||
pub fn load_or_default() -> Result<Self> {
|
||||
let path = Self::path();
|
||||
|
||||
12
src/gui.rs
12
src/gui.rs
@@ -75,7 +75,7 @@ pub fn run(
|
||||
show_on_start: bool,
|
||||
) -> Result<()> {
|
||||
database.trim_unpinned(config.history_limit)?;
|
||||
let application = Application::new(Some("io.clipbhoard.Clipbhoard"), Default::default());
|
||||
let application = Application::new(Some("io.cliphoard.Cliphoard"), Default::default());
|
||||
let clipboard_watcher = match X11ClipboardWatcher::start() {
|
||||
Ok(watcher) => Some(watcher),
|
||||
Err(error) => {
|
||||
@@ -134,7 +134,7 @@ pub fn run(
|
||||
});
|
||||
// GTK parses its own command-line options. The application-level flags
|
||||
// are consumed by main, so do not pass them to GTK as unknown options.
|
||||
application.run_with_args(&["clipbhoard"]);
|
||||
application.run_with_args(&["cliphoard"]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -248,6 +248,7 @@ fn build_window(
|
||||
glib::Propagation::Stop
|
||||
});
|
||||
window.set_visible(show_on_start);
|
||||
list.set_activate_on_single_click(false);
|
||||
refresh_list(&list, &state.borrow().entries, "", Some(&row_actions));
|
||||
let window_for_details = window.clone();
|
||||
let state_for_details = Rc::clone(&state);
|
||||
@@ -642,7 +643,6 @@ fn build_window(
|
||||
}
|
||||
};
|
||||
if state.previous_focus.is_some() {
|
||||
window_for_events.present();
|
||||
search_for_events.grab_focus();
|
||||
} else {
|
||||
set_status(
|
||||
@@ -938,10 +938,10 @@ Install\n\
|
||||
Build dependencies: GTK4, D-Bus, X11, XFixes, XTest, pkg-config, Rust, and Cargo.\n\
|
||||
From the repository, run: cargo run --features gui\n\
|
||||
For a package build, run the Docker build, then install it with:\n\
|
||||
sudo apt install ./target/clipbhoard_0.1.0_amd64.deb\n\n\
|
||||
sudo apt install ./target/cliphoard_0.1.0_amd64.deb\n\n\
|
||||
Uninstall\n\
|
||||
Run: sudo apt remove clipbhoard\n\
|
||||
Optionally remove the local data directory shown by clipbhoard --diagnostics\n\
|
||||
Run: sudo apt remove cliphoard\n\
|
||||
Optionally remove the local data directory shown by cliphoard --diagnostics\n\
|
||||
to delete history and logs.\n",
|
||||
shortcut
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@ pub struct InstanceGuard {
|
||||
|
||||
impl InstanceGuard {
|
||||
pub fn acquire() -> Result<Self> {
|
||||
let path = runtime_dir().join("clipbhoard.lock");
|
||||
let path = runtime_dir().join("cliphoard.lock");
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent).with_context(|| {
|
||||
format!("failed to create runtime directory {}", parent.display())
|
||||
@@ -59,7 +59,7 @@ impl InstanceGuard {
|
||||
let signal = Arc::clone(&show_requested);
|
||||
let should_stop = Arc::clone(&stop);
|
||||
let listener_thread = std::thread::Builder::new()
|
||||
.name("clipbhoard-instance".into())
|
||||
.name("cliphoard-instance".into())
|
||||
.spawn(move || {
|
||||
while !should_stop.load(Ordering::Acquire) {
|
||||
match listener.accept() {
|
||||
@@ -109,7 +109,7 @@ impl InstanceGuard {
|
||||
}
|
||||
|
||||
pub fn is_running() -> bool {
|
||||
let path = runtime_dir().join("clipbhoard.lock");
|
||||
let path = runtime_dir().join("cliphoard.lock");
|
||||
let Ok(file) = File::open(path) else {
|
||||
return false;
|
||||
};
|
||||
@@ -130,11 +130,11 @@ impl Drop for InstanceGuard {
|
||||
pub fn runtime_dir() -> PathBuf {
|
||||
dirs::runtime_dir()
|
||||
.unwrap_or_else(|| std::env::temp_dir())
|
||||
.join("clipbhoard")
|
||||
.join("cliphoard")
|
||||
}
|
||||
|
||||
fn socket_path() -> PathBuf {
|
||||
runtime_dir().join("clipbhoard.sock")
|
||||
runtime_dir().join("cliphoard.sock")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -149,7 +149,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn runtime_path_is_scoped() {
|
||||
assert!(runtime_dir().ends_with("clipbhoard"));
|
||||
assert!(runtime_dir().ends_with("cliphoard"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -10,14 +10,14 @@ pub enum LoggingGuard {
|
||||
|
||||
pub fn init(configured_level: &str) -> LoggingGuard {
|
||||
let filter = std::env::var("RUST_LOG").unwrap_or_else(|_| configured_level.to_owned());
|
||||
let state_dir = dirs::state_dir().map(|path| path.join("clipbhoard"));
|
||||
let state_dir = dirs::state_dir().map(|path| path.join("cliphoard"));
|
||||
if let Some(state_dir) = state_dir {
|
||||
if std::fs::create_dir_all(&state_dir).is_ok()
|
||||
&& restrict_directory_permissions(&state_dir).is_ok()
|
||||
&& restrict_log_permissions(&state_dir).is_ok()
|
||||
{
|
||||
prune_old_logs(&state_dir, RETAINED_LOG_FILES);
|
||||
let appender = tracing_appender::rolling::daily(&state_dir, "clipbhoard.log");
|
||||
let appender = tracing_appender::rolling::daily(&state_dir, "cliphoard.log");
|
||||
let (writer, guard) = tracing_appender::non_blocking(appender);
|
||||
if tracing_subscriber::fmt()
|
||||
.with_writer(writer)
|
||||
@@ -43,7 +43,7 @@ fn restrict_log_permissions(directory: &std::path::Path) -> std::io::Result<()>
|
||||
if entry
|
||||
.file_name()
|
||||
.to_string_lossy()
|
||||
.starts_with("clipbhoard.log")
|
||||
.starts_with("cliphoard.log")
|
||||
{
|
||||
std::fs::set_permissions(entry.path(), std::fs::Permissions::from_mode(0o600))?;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ fn prune_old_logs(directory: &std::path::Path, keep: usize) {
|
||||
entry
|
||||
.file_name()
|
||||
.to_string_lossy()
|
||||
.starts_with("clipbhoard.log.")
|
||||
.starts_with("cliphoard.log.")
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
rotated.sort_by_key(|entry| entry.file_name());
|
||||
@@ -81,12 +81,12 @@ mod tests {
|
||||
#[test]
|
||||
fn prunes_old_rotated_logs_and_restricts_retained_files() {
|
||||
let directory =
|
||||
std::env::temp_dir().join(format!("clipbhoard-log-test-{}", std::process::id()));
|
||||
std::env::temp_dir().join(format!("cliphoard-log-test-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&directory);
|
||||
std::fs::create_dir_all(&directory).unwrap();
|
||||
for day in 0..9 {
|
||||
std::fs::write(
|
||||
directory.join(format!("clipbhoard.log.2026-09-{day:02}")),
|
||||
directory.join(format!("cliphoard.log.2026-09-{day:02}")),
|
||||
"diagnostic",
|
||||
)
|
||||
.unwrap();
|
||||
@@ -106,10 +106,10 @@ mod tests {
|
||||
#[test]
|
||||
fn restricts_existing_active_log_permissions() {
|
||||
let directory =
|
||||
std::env::temp_dir().join(format!("clipbhoard-active-log-test-{}", std::process::id()));
|
||||
std::env::temp_dir().join(format!("cliphoard-active-log-test-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&directory);
|
||||
std::fs::create_dir_all(&directory).unwrap();
|
||||
let active = directory.join("clipbhoard.log.2026-09-10");
|
||||
let active = directory.join("cliphoard.log.2026-09-10");
|
||||
std::fs::write(&active, "diagnostic").unwrap();
|
||||
std::fs::set_permissions(&active, std::fs::Permissions::from_mode(0o644)).unwrap();
|
||||
|
||||
|
||||
16
src/main.rs
16
src/main.rs
@@ -18,29 +18,29 @@ fn main() -> Result<()> {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
|
||||
if args.iter().any(|arg| arg == "--version") {
|
||||
println!("clipbhoard {}", env!("CARGO_PKG_VERSION"));
|
||||
println!("cliphoard {}", env!("CARGO_PKG_VERSION"));
|
||||
return Ok(());
|
||||
}
|
||||
if args.iter().any(|arg| arg == "--help") {
|
||||
println!("Cliphoard — tiny, keyboard-first clipboard history");
|
||||
println!("Usage: clipbhoard [--version] [--help] [--diagnostics] [--show] [--autostart]");
|
||||
println!("Usage: cliphoard [--version] [--help] [--diagnostics] [--show] [--autostart]");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let show_on_start = args.iter().any(|arg| arg == "--show")
|
||||
|| std::env::var_os("CLIPBHOARD_SHOW_REQUESTED").is_some();
|
||||
|| std::env::var_os("CLIPHOARD_SHOW_REQUESTED").is_some();
|
||||
let config = Config::load_or_default()?;
|
||||
let _logging = logging::init(&config.log_level);
|
||||
if args.iter().any(|arg| arg == "--autostart") && !config.autostart {
|
||||
tracing::info!("autostart is disabled in configuration");
|
||||
return Ok(());
|
||||
}
|
||||
if show_on_start && std::env::var_os("CLIPBHOARD_SHOW_CHILD").is_none() {
|
||||
if show_on_start && std::env::var_os("CLIPHOARD_SHOW_CHILD").is_none() {
|
||||
let executable =
|
||||
std::env::current_exe().context("failed to locate clipbhoard executable")?;
|
||||
std::env::current_exe().context("failed to locate cliphoard executable")?;
|
||||
std::process::Command::new(executable)
|
||||
.env("CLIPBHOARD_SHOW_CHILD", "1")
|
||||
.env("CLIPBHOARD_SHOW_REQUESTED", "1")
|
||||
.env("CLIPHOARD_SHOW_CHILD", "1")
|
||||
.env("CLIPHOARD_SHOW_REQUESTED", "1")
|
||||
.stdin(std::process::Stdio::null())
|
||||
.stdout(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::null())
|
||||
@@ -71,7 +71,7 @@ fn main() -> Result<()> {
|
||||
"Log directory: {}",
|
||||
dirs::state_dir()
|
||||
.unwrap_or_else(|| std::env::temp_dir())
|
||||
.join("clipbhoard")
|
||||
.join("cliphoard")
|
||||
.display()
|
||||
);
|
||||
println!(
|
||||
|
||||
@@ -54,7 +54,7 @@ impl X11ClipboardWorker {
|
||||
let (requests, request_receiver) = mpsc::sync_channel::<ClipboardAction>(1);
|
||||
let (result_sender, results) = mpsc::sync_channel::<ClipboardWorkerResult>(1);
|
||||
thread::Builder::new()
|
||||
.name("clipbhoard-x11-clipboard-worker".into())
|
||||
.name("cliphoard-x11-clipboard-worker".into())
|
||||
.spawn(move || {
|
||||
let mut clipboard = match X11Clipboard::connect() {
|
||||
Ok(clipboard) => clipboard,
|
||||
@@ -158,7 +158,7 @@ impl X11ClipboardReader {
|
||||
let (requests, request_receiver) = mpsc::sync_channel::<()>(1);
|
||||
let (result_sender, results) = mpsc::sync_channel::<Result<Option<String>>>(1);
|
||||
thread::Builder::new()
|
||||
.name("clipbhoard-x11-clipboard-reader".into())
|
||||
.name("cliphoard-x11-clipboard-reader".into())
|
||||
.spawn(move || {
|
||||
while request_receiver.recv().is_ok() {
|
||||
let result = read_clipboard_text(&clipboard, max_entry_bytes);
|
||||
|
||||
@@ -39,7 +39,7 @@ impl X11ClipboardWatcher {
|
||||
let changed = Arc::new(AtomicBool::new(true));
|
||||
let signal = Arc::clone(&changed);
|
||||
std::thread::Builder::new()
|
||||
.name("clipbhoard-x11-clipboard".into())
|
||||
.name("cliphoard-x11-clipboard".into())
|
||||
.spawn(move || watch_events(connection, signal))
|
||||
.context("failed to start X11 clipboard event thread")?;
|
||||
Ok(Self { changed })
|
||||
@@ -106,7 +106,7 @@ impl X11Hotkey {
|
||||
let thread_connection = Arc::clone(&connection);
|
||||
let thread_grab_modifiers = grab_modifiers.clone();
|
||||
std::thread::Builder::new()
|
||||
.name("clipbhoard-x11-hotkey".into())
|
||||
.name("cliphoard-x11-hotkey".into())
|
||||
.spawn(move || {
|
||||
watch_hotkey(
|
||||
thread_connection,
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Database {
|
||||
pub fn open_default() -> Result<Self> {
|
||||
let path = dirs::data_local_dir()
|
||||
.unwrap_or_else(|| PathBuf::from("."))
|
||||
.join("clipbhoard/clipbhoard.db");
|
||||
.join("cliphoard/cliphoard.db");
|
||||
Self::open(path)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ impl Database {
|
||||
std::fs::create_dir_all(parent).with_context(|| {
|
||||
format!("failed to create database directory {}", parent.display())
|
||||
})?;
|
||||
if parent.file_name().is_some_and(|name| name == "clipbhoard") {
|
||||
if parent.file_name().is_some_and(|name| name == "cliphoard") {
|
||||
std::fs::set_permissions(parent, std::fs::Permissions::from_mode(0o700))
|
||||
.with_context(|| {
|
||||
format!("failed to restrict database directory {}", parent.display())
|
||||
@@ -181,7 +181,7 @@ mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn persists_and_deduplicates() {
|
||||
let db = Database::open("file:clipbhoard-test?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-test?mode=memory&cache=shared").unwrap();
|
||||
let a = db.upsert_content("hello", 1).unwrap();
|
||||
let b = db.upsert_content("hello", 2).unwrap();
|
||||
assert_eq!(a.id, b.id);
|
||||
@@ -190,7 +190,7 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn clear_keeps_pinned() {
|
||||
let db = Database::open("file:clipbhoard-clear?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-clear?mode=memory&cache=shared").unwrap();
|
||||
let a = db.upsert_content("a", 1).unwrap();
|
||||
db.upsert_content("b", 2).unwrap();
|
||||
assert!(db.toggle_pinned(a.id, 25).unwrap());
|
||||
@@ -202,7 +202,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn toggle_pinned_enforces_limit_atomically() {
|
||||
let db = Database::open("file:clipbhoard-pin?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-pin?mode=memory&cache=shared").unwrap();
|
||||
let first = db.upsert_content("a", 1).unwrap();
|
||||
let second = db.upsert_content("b", 2).unwrap();
|
||||
assert!(db.toggle_pinned(first.id, 1).unwrap());
|
||||
@@ -212,7 +212,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn migration_enforces_content_deduplication_index() {
|
||||
let db = Database::open("file:clipbhoard-index?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-index?mode=memory&cache=shared").unwrap();
|
||||
let unique: i64 = db
|
||||
.connection
|
||||
.query_row(
|
||||
@@ -227,7 +227,7 @@ mod tests {
|
||||
#[test]
|
||||
fn reopening_database_restricts_existing_file_permissions() {
|
||||
let path =
|
||||
std::env::temp_dir().join(format!("clipbhoard-permissions-{}", std::process::id()));
|
||||
std::env::temp_dir().join(format!("cliphoard-permissions-{}", std::process::id()));
|
||||
let _ = std::fs::remove_file(&path);
|
||||
let db = Database::open(&path).unwrap();
|
||||
drop(db);
|
||||
@@ -244,7 +244,7 @@ mod tests {
|
||||
#[test]
|
||||
fn refuses_symlinked_database_path() {
|
||||
let directory =
|
||||
std::env::temp_dir().join(format!("clipbhoard-symlink-{}", std::process::id()));
|
||||
std::env::temp_dir().join(format!("cliphoard-symlink-{}", std::process::id()));
|
||||
let _ = std::fs::remove_file(&directory);
|
||||
let target = directory.with_extension("target");
|
||||
let _ = std::fs::remove_file(&target);
|
||||
@@ -261,7 +261,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn trimming_keeps_pinned_entries_and_newest_unpinned_entries() {
|
||||
let db = Database::open("file:clipbhoard-trim?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-trim?mode=memory&cache=shared").unwrap();
|
||||
let pinned = db.upsert_content("pinned", 1).unwrap();
|
||||
assert!(db.toggle_pinned(pinned.id, 25).unwrap());
|
||||
db.upsert_content("old", 2).unwrap();
|
||||
@@ -276,7 +276,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn expiration_removes_old_unpinned_entries_but_keeps_pinned_entries() {
|
||||
let db = Database::open("file:clipbhoard-expiration?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-expiration?mode=memory&cache=shared").unwrap();
|
||||
let old = db.upsert_content("old", 1).unwrap();
|
||||
let pinned = db.upsert_content("pinned", 1).unwrap();
|
||||
db.toggle_pinned(pinned.id, 25).unwrap();
|
||||
@@ -290,7 +290,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn missing_mutations_return_errors() {
|
||||
let db = Database::open("file:clipbhoard-missing?mode=memory&cache=shared").unwrap();
|
||||
let db = Database::open("file:cliphoard-missing?mode=memory&cache=shared").unwrap();
|
||||
assert!(db.delete(404).is_err());
|
||||
assert!(db.toggle_pinned(404, 1).is_err());
|
||||
}
|
||||
|
||||
16
src/tray.rs
16
src/tray.rs
@@ -7,13 +7,13 @@ use anyhow::{bail, Result};
|
||||
|
||||
use crate::lifecycle::InstanceGuard;
|
||||
|
||||
struct ClipbhoardTray {
|
||||
struct CliphoardTray {
|
||||
recording: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TrayHandle {
|
||||
handle: ksni::Handle<ClipbhoardTray>,
|
||||
handle: ksni::Handle<CliphoardTray>,
|
||||
}
|
||||
|
||||
impl Drop for TrayHandle {
|
||||
@@ -22,9 +22,9 @@ impl Drop for TrayHandle {
|
||||
}
|
||||
}
|
||||
|
||||
impl ksni::Tray for ClipbhoardTray {
|
||||
impl ksni::Tray for CliphoardTray {
|
||||
fn id(&self) -> String {
|
||||
"clipbhoard".into()
|
||||
"cliphoard".into()
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
@@ -36,7 +36,7 @@ impl ksni::Tray for ClipbhoardTray {
|
||||
}
|
||||
|
||||
fn icon_name(&self) -> String {
|
||||
"io.clipbhoard.Clipbhoard".into()
|
||||
"io.cliphoard.Cliphoard".into()
|
||||
}
|
||||
|
||||
fn activate(&mut self, _x: i32, _y: i32) {
|
||||
@@ -49,7 +49,7 @@ impl ksni::Tray for ClipbhoardTray {
|
||||
use ksni::menu::StandardItem;
|
||||
vec![StandardItem {
|
||||
label: "Show Cliphoard".into(),
|
||||
icon_name: "io.clipbhoard.Clipbhoard".into(),
|
||||
icon_name: "io.cliphoard.Cliphoard".into(),
|
||||
activate: Box::new(|_| {
|
||||
if let Err(error) = InstanceGuard::signal_show() {
|
||||
tracing::error!(%error, "failed to show popup from tray menu");
|
||||
@@ -73,10 +73,10 @@ pub fn start(recording: Arc<AtomicBool>) -> Result<TrayHandle> {
|
||||
if std::env::var_os("DBUS_SESSION_BUS_ADDRESS").is_none() {
|
||||
bail!("no D-Bus session bus is available")
|
||||
}
|
||||
let service = ksni::TrayService::new(ClipbhoardTray { recording });
|
||||
let service = ksni::TrayService::new(CliphoardTray { recording });
|
||||
let handle = service.handle();
|
||||
std::thread::Builder::new()
|
||||
.name("clipbhoard-tray".into())
|
||||
.name("cliphoard-tray".into())
|
||||
.spawn(move || {
|
||||
if let Err(error) = service.run() {
|
||||
tracing::warn!(%error, "system tray service stopped");
|
||||
|
||||
Reference in New Issue
Block a user