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!(" [{i}] {}{mark}", t.target.tsv());
|
||||||
}
|
}
|
||||||
eprintln!(
|
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 {:?}",
|
at scale {}, {} MB of capture buffers, labels in {:?}",
|
||||||
self.tiles.len(),
|
self.tiles.len(),
|
||||||
self.tiles.iter().filter(|t| t.ready).count(),
|
self.tiles.iter().filter(|t| t.ready).count(),
|
||||||
@@ -274,7 +274,7 @@ impl App {
|
|||||||
);
|
);
|
||||||
if self.layout.scrollable() {
|
if self.layout.scrollable() {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"wl-pick: {} of {} rows fit; the rest scroll",
|
"wl-tab: {} of {} rows fit; the rest scroll",
|
||||||
self.layout.visible_rows, self.layout.rows
|
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 frames: u32 = self.tiles.iter().map(|t| t.frames).sum();
|
||||||
let secs = open_for.as_secs_f64();
|
let secs = open_for.as_secs_f64();
|
||||||
eprintln!(
|
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: {}",
|
{} starved; per tile: {}",
|
||||||
self.ending.as_str(),
|
self.ending.as_str(),
|
||||||
frames as f64 / secs,
|
frames as f64 / secs,
|
||||||
@@ -314,7 +314,7 @@ impl App {
|
|||||||
.map(|t| t.target.title.as_str())
|
.map(|t| t.target.title.as_str())
|
||||||
.collect();
|
.collect();
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"wl-pick: no frame for {} of {} tiles ({}); \
|
"wl-tab: no frame for {} of {} tiles ({}); \
|
||||||
another capture client may hold these sources",
|
another capture client may hold these sources",
|
||||||
stuck.len(),
|
stuck.len(),
|
||||||
self.tiles.len(),
|
self.tiles.len(),
|
||||||
|
|||||||
+2
-2
@@ -201,7 +201,7 @@ impl App {
|
|||||||
self.stats.pool_bytes = total;
|
self.stats.pool_bytes = total;
|
||||||
// Note: no mmap. The compositor writes these pages and samples them
|
// Note: no mmap. The compositor writes these pages and samples them
|
||||||
// again for display; mapping them here would only cost us the faults.
|
// 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, ());
|
let pool = self.shm.create_pool(file.as_fd(), total as i32, qh, ());
|
||||||
for (i, slot_offsets) in offsets.iter().enumerate() {
|
for (i, slot_offsets) in offsets.iter().enumerate() {
|
||||||
let (w, h, format) = {
|
let (w, h, format) = {
|
||||||
@@ -372,7 +372,7 @@ impl Dispatch<ExtImageCopyCaptureFrameV1, usize> for App {
|
|||||||
// frame yet leaves the tile without a thumbnail.
|
// frame yet leaves the tile without a thumbnail.
|
||||||
if tile.frames == 0 {
|
if tile.frames == 0 {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"wl-pick: capture failed for {:?} ({reason:?})",
|
"wl-tab: capture failed for {:?} ({reason:?})",
|
||||||
tile.target.title
|
tile.target.title
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -10,11 +10,11 @@ use crate::target::Format;
|
|||||||
use crate::theme::Theme;
|
use crate::theme::Theme;
|
||||||
|
|
||||||
const HELP: &str = "\
|
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]
|
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]
|
--format tsv|json|portal how to report the pick [tsv]
|
||||||
--fps N cap on live updates per tile per second [12]
|
--fps N cap on live updates per tile per second [12]
|
||||||
--labels, --no-labels a label under each thumbnail [yes]
|
--labels, --no-labels a label under each thumbnail [yes]
|
||||||
@@ -78,7 +78,7 @@ formats:
|
|||||||
|
|
||||||
[screencast]
|
[screencast]
|
||||||
chooser_type=simple
|
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
|
/// 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.
|
/// 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 {
|
if let Some(d) = timeout {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
std::thread::sleep(d);
|
std::thread::sleep(d);
|
||||||
eprintln!("wl-pick: timeout");
|
eprintln!("wl-tab: timeout");
|
||||||
std::process::exit(2);
|
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
|
//! Flat `key = value` lines with `#` comments - no sections, no nesting, so a
|
||||||
//! TOML parser would be a dependency bought for nothing. Every setting is
|
//! 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"))
|
.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 {
|
fn default_path() -> PathBuf {
|
||||||
let dir = std::env::var_os("XDG_CONFIG_HOME")
|
let dir = std::env::var_os("XDG_CONFIG_HOME")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config")))
|
.or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".config")))
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
dir.join("wl-pick").join("config")
|
dir.join("wl-tab").join("config")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -288,7 +288,7 @@ order = mru
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_missing_file_is_not_an_error() {
|
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!(
|
assert!(
|
||||||
Config::load(Some(missing)).is_err(),
|
Config::load(Some(missing)).is_err(),
|
||||||
"named file must exist"
|
"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
|
//! overlay and reports which one you picked. That is all it does: acting on the
|
||||||
//! choice belongs to whatever called it.
|
//! choice belongs to whatever called it.
|
||||||
//!
|
//!
|
||||||
@@ -61,7 +61,7 @@ fn main() -> ExitCode {
|
|||||||
match run() {
|
match run() {
|
||||||
Ok(code) => code,
|
Ok(code) => code,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("wl-pick: {e}");
|
eprintln!("wl-tab: {e}");
|
||||||
ExitCode::FAILURE
|
ExitCode::FAILURE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ fn run() -> Result<ExitCode, Box<dyn Error>> {
|
|||||||
phases.mark("mapped");
|
phases.mark("mapped");
|
||||||
|
|
||||||
// The keyboard grab is what makes the overlay usable, so losing it for
|
// 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.
|
// 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
|
// 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.
|
// 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
|
// Only the portal format can fail to name something: it identifies a
|
||||||
// window by its foreign-toplevel identifier, and this one has none.
|
// window by its foreign-toplevel identifier, and this one has none.
|
||||||
None => {
|
None => {
|
||||||
eprintln!("wl-pick: {:?} has no toplevel identifier", target.title);
|
eprintln!("wl-tab: {:?} has no toplevel identifier", target.title);
|
||||||
return Ok(ExitCode::FAILURE);
|
return Ok(ExitCode::FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -103,7 +103,7 @@ impl App {
|
|||||||
&surface,
|
&surface,
|
||||||
output,
|
output,
|
||||||
Layer::Overlay,
|
Layer::Overlay,
|
||||||
"wl-pick".to_string(),
|
"wl-tab".to_string(),
|
||||||
qh,
|
qh,
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
@@ -114,7 +114,7 @@ impl App {
|
|||||||
|
|
||||||
let (pw, ph) = (lw * self.scale, lh * self.scale);
|
let (pw, ph) = (lw * self.scale, lh * self.scale);
|
||||||
let len = shm::Chrome::slot_len(pw, ph) * shm::Chrome::SLOTS;
|
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, ());
|
let pool = self.shm.create_pool(file.as_fd(), len as i32, qh, ());
|
||||||
for slot in 0..shm::Chrome::SLOTS {
|
for slot in 0..shm::Chrome::SLOTS {
|
||||||
self.chrome_buffers.push(pool.create_buffer(
|
self.chrome_buffers.push(pool.create_buffer(
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
//! Wayland side only supplies pixels. The join between the two is
|
//! Wayland side only supplies pixels. The join between the two is
|
||||||
//! `foreign_toplevel_identifier`, which sway reports per view.
|
//! `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.
|
//! and the caller decides what that means.
|
||||||
|
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
@@ -33,7 +33,7 @@ pub fn connect() -> Result<Connection, String> {
|
|||||||
let live = live_sockets();
|
let live = live_sockets();
|
||||||
let [path] = live.as_slice() else {
|
let [path] = live.as_slice() else {
|
||||||
return Err(if live.is_empty() {
|
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"
|
socket, and no running sway has one"
|
||||||
.to_string()
|
.to_string()
|
||||||
} else {
|
} else {
|
||||||
@@ -123,7 +123,7 @@ fn history_path() -> PathBuf {
|
|||||||
std::env::var_os("XDG_RUNTIME_DIR")
|
std::env::var_os("XDG_RUNTIME_DIR")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.unwrap_or_else(std::env::temp_dir)
|
.unwrap_or_else(std::env::temp_dir)
|
||||||
.join("wl-pick-history")
|
.join("wl-tab-history")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_focus(con_id: i64) {
|
pub fn record_focus(con_id: i64) {
|
||||||
|
|||||||
Reference in New Issue
Block a user