pedroscaff / swaywsr Goto Github PK
View Code? Open in Web Editor NEWswaywsr is a small program that uses Sway's IPC Interface to change the name of a workspace based on its contents.
License: MIT License
swaywsr is a small program that uses Sway's IPC Interface to change the name of a workspace based on its contents.
License: MIT License
Launched in foreground, I have noticed get class error: MissingInformation("Node{...}")
repeatedly returned to stdout.
Here, {...}
is:
{
id: 69,
name: None,
node_type: Con,
border: None,
current_border_width: 0,
layout: SplitH,
percent: Some(1.0),
rect: Rect { x: 0, y: 26, width: 1920, height: 1054 },
window_rect: Rect { x: 0, y: 0, width: 0, height: 0 },
deco_rect: Rect { x: 0, y: 0, width: 0, height: 0 },
geometry: Rect { x: 0, y: 0, width: 0, height: 0 },
urgent: false,
focused: false,
focus: [9],
nodes: [Node {
id: 9,
name: Some(\"SP — Mozilla Firefox\"),
node_type: Con,
border: Pixel,
current_border_width: 4,
layout: None,
percent: Some(1.0),
rect: Rect { x: 0, y: 26, width: 1920, height: 1054 },
window_rect: Rect { x: 0, y: 4, width: 1920, height: 1054 },
deco_rect: Rect { x: 0, y: 0, width: 0, height: 0 },
geometry: Rect { x: 0, y: 0, width: 960, height: 790 },
urgent: false,
focused: false,
focus: [],
nodes: [],
floating_nodes: [],
sticky: false,
representation: None,
fullscreen_mode: Some(0),
app_id: Some(\"Firefox-esr\"),
pid: Some(93387),
window: None,
num: None,
window_properties: None,
marks: [],
inhibit_idle: Some(false),
idle_inhibitors: Some(IdleInhibitors { application: None, user: None }),
shell: Some(XdgShell),
visible: Some(false),
output: None
}],
floating_nodes: [],
sticky: false,
representation: None,
fullscreen_mode: Some(0),
app_id: None,
pid: None,
window: None,
num: None,
window_properties: None,
marks: [],
inhibit_idle: None,
idle_inhibitors: None,
shell: None,
visible: None,
output: None
}
Formatted for readability. After some monkey-patching and println!()
debugging, this seems to happen when workspace name is unchanged:
Old workspace name: 5 Pass
New workspace name: 5 Pass
get class error: MissingInformation [...]
The above is from
Line 166 in c07ddf3
Stacktrace from debug build off master at 6c4671c.
blissful@neptune > RUST_BACKTRACE=1 ./target/debug/swaywsr
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/lib.rs:65:68
stack backtrace:
0: rust_begin_unwind
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
2: core::panicking::panic
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:50:5
3: core::option::Option<T>::unwrap
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/option.rs:388:21
4: swaywsr::get_class
at ./src/lib.rs:65:42
5: swaywsr::get_classes
at ./src/lib.rs:148:27
6: swaywsr::update_tree
at ./src/lib.rs:170:23
7: swaywsr::main
at ./src/main.rs:88:5
8: core::ops::function::FnOnce::call_once
at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Node causing the crash:
{
"id": 237,
"type": "con",
"orientation": "none",
"percent": 0.49601487778958553,
"urgent": false,
"marks": [
],
"focused": false,
"layout": "none",
"border": "pixel",
"current_border_width": 3,
"rect": {
"x": 38,
"y": 38,
"width": 1867,
"height": 2261
},
"deco_rect": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
},
"window_rect": {
"x": 3,
"y": 3,
"width": 1861,
"height": 2255
},
"geometry": {
"x": 0,
"y": 0,
"width": 800,
"height": 600
},
"name": null,
"window": 50331650,
"nodes": [
],
"floating_nodes": [
],
"focus": [
],
"fullscreen_mode": 0,
"sticky": false,
"pid": 6,
"app_id": null,
"visible": false,
"max_render_time": 0,
"shell": "xwayland",
"inhibit_idle": false,
"idle_inhibitors": {
"user": "none",
"application": "none"
},
"window_properties": {
"transient_for": null
}
},
Let me preface this by saying that application works exactly as advertised. No issues there.
However there is one nagging quirk that bothers me. Say I have number of workspaces:
As you can see from on the image above, there are 5 "terms". Now, I rename the first one to something more meaningful:
Looks good... But only until I launch another terminal, then swaywsr
renames it back.
Would it be possible to detect those terminals were renamed by a user (regexp will do) and avoid renaming those?
Idea: when a config file is not given via --config
, but a file exists at $XDG_CONFIG_HOME/swaywsr/config.toml
, then load that config instead of resorting to the default config.
What do you think?
Hi,
Just started using your wonderful little utility. There is one problem, though, which is that it tends to just quit for no apparent reason. I haven't been able to link this to any specific process, at first I suspected it might have to do with suspend/resume, but this seems not to be the case. I am running it from sway-config like this:
exec_always swaywsr --icons awesome --config ~/.config/swaywsr/config.toml --no-names
and my config looks like this:
[icons]
TelegramDesktop = ""
firefox = ""
Spotify = ""
termite = "❯"
[aliases]
qutebrowser = "qb"
Not quite sure where to start, as there is no trace of swaywrs in journalctl
nor coredumpctl
. Is there a way to turn on debugging/logging?
System: Arch linux 5.6.10-rt5-rt, swaywsr 1.0.0, sway 1.4
So i tried to change the icon for alacritty, and nothing happened after editing the config file.
After investigating, i realised that the icon is hardcoded in icons.rs, along with some others.
This should be handled by the config file, no need to put icons directly into the application.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.