Compare commits
2
Commits
314e474341
...
6559956c3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6559956c3c | ||
|
|
77efdf03e9 |
+4
-4
@@ -260,7 +260,7 @@ impl App {
|
||||
eprintln!(" [{i}] {}{mark}", t.target.tsv());
|
||||
}
|
||||
eprintln!(
|
||||
"wl-pick: {} tile(s), {} captured; grid {}x{}, surface {}x{} logical \
|
||||
"wl-tab: {} tile(s), {} captured; grid {}x{}, surface {}x{} logical \
|
||||
at scale {}, {} MB of capture buffers, labels in {:?}",
|
||||
self.tiles.len(),
|
||||
self.tiles.iter().filter(|t| t.ready).count(),
|
||||
@@ -274,7 +274,7 @@ impl App {
|
||||
);
|
||||
if self.layout.scrollable() {
|
||||
eprintln!(
|
||||
"wl-pick: {} of {} rows fit; the rest scroll",
|
||||
"wl-tab: {} of {} rows fit; the rest scroll",
|
||||
self.layout.visible_rows, self.layout.rows
|
||||
);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ impl App {
|
||||
let frames: u32 = self.tiles.iter().map(|t| t.frames).sum();
|
||||
let secs = open_for.as_secs_f64();
|
||||
eprintln!(
|
||||
"wl-pick: {}, {frames} frame(s) over {secs:.1}s = {:.1}/s, {} tick(s), \
|
||||
"wl-tab: {}, {frames} frame(s) over {secs:.1}s = {:.1}/s, {} tick(s), \
|
||||
{} starved; per tile: {}",
|
||||
self.ending.as_str(),
|
||||
frames as f64 / secs,
|
||||
@@ -314,7 +314,7 @@ impl App {
|
||||
.map(|t| t.target.title.as_str())
|
||||
.collect();
|
||||
eprintln!(
|
||||
"wl-pick: no frame for {} of {} tiles ({}); \
|
||||
"wl-tab: no frame for {} of {} tiles ({}); \
|
||||
another capture client may hold these sources",
|
||||
stuck.len(),
|
||||
self.tiles.len(),
|
||||
|
||||
+2
-2
@@ -201,7 +201,7 @@ impl App {
|
||||
self.stats.pool_bytes = total;
|
||||
// Note: no mmap. The compositor writes these pages and samples them
|
||||
// again for display; mapping them here would only cost us the faults.
|
||||
let file = shm::memfd("wl-pick-capture", total)?;
|
||||
let file = shm::memfd("wl-tab-capture", total)?;
|
||||
let pool = self.shm.create_pool(file.as_fd(), total as i32, qh, ());
|
||||
for (i, slot_offsets) in offsets.iter().enumerate() {
|
||||
let (w, h, format) = {
|
||||
@@ -372,7 +372,7 @@ impl Dispatch<ExtImageCopyCaptureFrameV1, usize> for App {
|
||||
// frame yet leaves the tile without a thumbnail.
|
||||
if tile.frames == 0 {
|
||||
eprintln!(
|
||||
"wl-pick: capture failed for {:?} ({reason:?})",
|
||||
"wl-tab: capture failed for {:?} ({reason:?})",
|
||||
tile.target.title
|
||||
);
|
||||
}
|
||||
|
||||
+4
-4
@@ -10,11 +10,11 @@ use crate::target::Format;
|
||||
use crate::theme::Theme;
|
||||
|
||||
const HELP: &str = "\
|
||||
wl-rab - a simple alt-tab switcher for sway
|
||||
wl-tab - a simple alt-tab switcher for sway
|
||||
|
||||
usage: wl-tab [options]
|
||||
|
||||
--config PATH config file [~/.config/wl-pick/config]
|
||||
--config PATH config file [~/.config/wl-tab/config]
|
||||
--format tsv|json|portal how to report the pick [tsv]
|
||||
--fps N cap on live updates per tile per second [12]
|
||||
--labels, --no-labels a label under each thumbnail [yes]
|
||||
@@ -78,7 +78,7 @@ formats:
|
||||
|
||||
[screencast]
|
||||
chooser_type=simple
|
||||
chooser_cmd=wl-pick --format portal";
|
||||
chooser_cmd=wl-tab --format portal";
|
||||
|
||||
/// What the command line asked for. Every setting is optional so the config file
|
||||
/// can fill the gaps: a flag beats the file, the file beats the default.
|
||||
@@ -117,7 +117,7 @@ pub fn arm_timeout(timeout: Option<Duration>) {
|
||||
if let Some(d) = timeout {
|
||||
std::thread::spawn(move || {
|
||||
std::thread::sleep(d);
|
||||
eprintln!("wl-pick: timeout");
|
||||
eprintln!("wl-tab: timeout");
|
||||
std::process::exit(2);
|
||||
});
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
//! The config file: `~/.config/wl-pick/config`.
|
||||
//! The config file: `~/.config/wl-tab/config`.
|
||||
//!
|
||||
//! Flat `key = value` lines with `#` comments - no sections, no nesting, so a
|
||||
//! TOML parser would be a dependency bought for nothing. Every setting is
|
||||
@@ -186,13 +186,13 @@ fn number<T: std::str::FromStr>(s: &str) -> Result<T, String> {
|
||||
.map_err(|_| format!("{s:?} is not a number"))
|
||||
}
|
||||
|
||||
/// `$XDG_CONFIG_HOME/wl-pick/config`, or `~/.config/wl-pick/config`.
|
||||
/// `$XDG_CONFIG_HOME/wl-tab/config`, or `~/.config/wl-tab/config`.
|
||||
fn default_path() -> PathBuf {
|
||||
let dir = std::env::var_os("XDG_CONFIG_HOME")
|
||||
.map(PathBuf::from)
|
||||
.or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config")))
|
||||
.unwrap_or_default();
|
||||
dir.join("wl-pick").join("config")
|
||||
dir.join("wl-tab").join("config")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -288,7 +288,7 @@ order = mru
|
||||
|
||||
#[test]
|
||||
fn a_missing_file_is_not_an_error() {
|
||||
let missing = Path::new("/nonexistent/wl-pick/config");
|
||||
let missing = Path::new("/nonexistent/wl-tab/config");
|
||||
assert!(
|
||||
Config::load(Some(missing)).is_err(),
|
||||
"named file must exist"
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
//! wl-pick shows a live grid of every window and display as a layer-shell
|
||||
//! wl-tab shows a live grid of every window and display as a layer-shell
|
||||
//! overlay and reports which one you picked. That is all it does: acting on the
|
||||
//! choice belongs to whatever called it.
|
||||
//!
|
||||
@@ -61,7 +61,7 @@ fn main() -> ExitCode {
|
||||
match run() {
|
||||
Ok(code) => code,
|
||||
Err(e) => {
|
||||
eprintln!("wl-pick: {e}");
|
||||
eprintln!("wl-tab: {e}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ fn run() -> Result<ExitCode, Box<dyn Error>> {
|
||||
phases.mark("mapped");
|
||||
|
||||
// The keyboard grab is what makes the overlay usable, so losing it for
|
||||
// good ends the run: that is how a second wl-pick, started from the same
|
||||
// good ends the run: that is how a second wl-tab, started from the same
|
||||
// keybinding, replaces the first instead of leaving it stranded on screen.
|
||||
// A leave only counts once it has failed to come back, because sway also
|
||||
// cycles focus off and on in a single batch as the pointer crosses us.
|
||||
@@ -259,7 +259,7 @@ fn run() -> Result<ExitCode, Box<dyn Error>> {
|
||||
// Only the portal format can fail to name something: it identifies a
|
||||
// window by its foreign-toplevel identifier, and this one has none.
|
||||
None => {
|
||||
eprintln!("wl-pick: {:?} has no toplevel identifier", target.title);
|
||||
eprintln!("wl-tab: {:?} has no toplevel identifier", target.title);
|
||||
return Ok(ExitCode::FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -103,7 +103,7 @@ impl App {
|
||||
&surface,
|
||||
output,
|
||||
Layer::Overlay,
|
||||
"wl-pick".to_string(),
|
||||
"wl-tab".to_string(),
|
||||
qh,
|
||||
(),
|
||||
);
|
||||
@@ -114,7 +114,7 @@ impl App {
|
||||
|
||||
let (pw, ph) = (lw * self.scale, lh * self.scale);
|
||||
let len = shm::Chrome::slot_len(pw, ph) * shm::Chrome::SLOTS;
|
||||
let file = shm::memfd("wl-pick-chrome", len)?;
|
||||
let file = shm::memfd("wl-tab-chrome", len)?;
|
||||
let pool = self.shm.create_pool(file.as_fd(), len as i32, qh, ());
|
||||
for slot in 0..shm::Chrome::SLOTS {
|
||||
self.chrome_buffers.push(pool.create_buffer(
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
//! Wayland side only supplies pixels. The join between the two is
|
||||
//! `foreign_toplevel_identifier`, which sway reports per view.
|
||||
//!
|
||||
//! Acting on the choice is deliberately not here: wl-pick reports what was picked
|
||||
//! Acting on the choice is deliberately not here: wl-tab reports what was picked
|
||||
//! and the caller decides what that means.
|
||||
|
||||
use std::os::unix::net::UnixStream;
|
||||
@@ -33,7 +33,7 @@ pub fn connect() -> Result<Connection, String> {
|
||||
let live = live_sockets();
|
||||
let [path] = live.as_slice() else {
|
||||
return Err(if live.is_empty() {
|
||||
"cannot reach sway; wl-pick reads the window list from its IPC \
|
||||
"cannot reach sway; wl-tab reads the window list from its IPC \
|
||||
socket, and no running sway has one"
|
||||
.to_string()
|
||||
} else {
|
||||
@@ -123,7 +123,7 @@ fn history_path() -> PathBuf {
|
||||
std::env::var_os("XDG_RUNTIME_DIR")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(std::env::temp_dir)
|
||||
.join("wl-pick-history")
|
||||
.join("wl-tab-history")
|
||||
}
|
||||
|
||||
pub fn record_focus(con_id: i64) {
|
||||
|
||||
Reference in New Issue
Block a user