Comments (5)
pids.with.ps.txt
Here is a script with your suggested modification. (around 0.095s
, almost twice as slow). If we left the pstree
as it is. (The exception you had was a result of parsing the parser). (The sed
was a pipe and a child to pstree). This will not be there while using this script. (I have tried with pipes it works fine, Eg: feh
, mpv
, zathura
). With only the modification to the /proc/$cpid/comm -> ps -p $cpid -o comm:1=
it's around 0.050s
(execution).
- I am going to change
/proc
tops
. - I am still not sure what to do with pstree. see if you can make any improvement. (1.5x base is the threshold). [execution time].
- from what i can tell
pstree
is available onbsd
too. - yes parsing
pstree
is not ideal. But it is the fastest way (till now).
Any improvement PR will be merged. (feel free to create one, you can always modify your PR and once it's good enough i will merged it.)
from pidswallow.
Speaking of... It looks like the proc filesystem is pretty linux-specific.
Now, I'm not completely sure if bspwm is linux-specific or not, but I guess since the script is already pretty POSIX, that ps
is the only true way to deal with all of this. The commands are
ps -p <pid> -o comm=
for process name
and
ps -p <pid> -o ppid=
for parent pid.
Let me know what you think about this!
from pidswallow.
I think we can now add ps
instead of pstree
as the script now support a --loop
feature.
(So it doesn't have to execute every line on node_add / node_remove). It will be slower but it will be must less impactful. Give it a try and let me know.
from pidswallow.
Hey, nice! The script looks a lot neater! I'll change some stuff I think is important and then maybe look into using ps
.
The
sed
was a pipe and a child to pstree
Actually, it was a child of zsh
. The issue isn't about pipes, it's about subprocesses. For example, if mpv
creates a subprocess, then the tree will diverge like my example. Still, I'm gonna look into that. Maybe we can keep using pstree
and just cut out the first line and try to ignore the subprocesses. Edit: I actually did this here.
from pidswallow.
Closed through 4a69df2
from pidswallow.
Related Issues (20)
- terminal getting swallowed using dmenu HOT 3
- Does not work with urxvt daemon HOT 19
- No such file or directory HOT 11
- Unable to swallow Konsole on Plasma HOT 10
- Plasma menu may be handled incorrectly in specific instances HOT 2
- XFCE terminal won't work because every instance shares the same PID HOT 9
- Sub-windows re-swallowing an alraedy swallowed parent HOT 5
- Change "sallower" -> "swallower" in repository description HOT 1
- Allow flags in any order HOT 6
- Issue with dmenu HOT 2
- Jumping desktop focus. HOT 8
- Configuration for re-focusing parent window when vomiting child HOT 11
- xprop -spy doesn't detect window changes HOT 23
- Daemon Based Terminal Will not work HOT 4
- Instructions for Xfce Terminal don't work globally. HOT 4
- not working with sxiv HOT 1
- Shell-based swallowing doesn't always work correctly in Alacritty
- Swallow stops after closing a window HOT 6
- Doesn't work if sxhkd is run as a systemd service. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pidswallow.