Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needed: absolute file path in data model #36

Open
adam-lynch opened this issue Sep 7, 2019 · 6 comments
Open

Needed: absolute file path in data model #36

adam-lynch opened this issue Sep 7, 2019 · 6 comments

Comments

@adam-lynch
Copy link

I'm pulling out custom reports and I need the absolute path, not just the filename. From that you can get the real formatted/friendly app name, icon, and more. Hopefully it's not too awkward to get

@johan-bjareholt
Copy link
Member

Absolute path of what? Filename of what?

This watcher only gets the app name and title of the currently focused app from the window manager of each platform, I'm not sure how that relates to any path or filename?

@ErikBjare
Copy link
Member

ErikBjare commented Sep 9, 2019 via email

@johan-bjareholt
Copy link
Member

If so, that would require manual implementations for all platforms.
Xlib doesn't expose the executables path natively as far as I know, maybe there's a way to circumvent that though. For windows and macOS I have no idea.

From that you can get the real formatted/friendly app name, icon, and more.

There's an API at least in Xlib to get the icon of the currently focused window, but to save icons in the aw-servers database is probably not a good idea.

@adam-lynch
Copy link
Author

If it helps, https://github.com/sindresorhus/active-win gets the path.

From that you can get the real formatted/friendly app name, icon, and more.

There's an API at least in Xlib to get the icon of the currently focused window, but to save icons in the aw-servers database is probably not a good idea.

I'm not suggesting that to be clear. The "you" in that sentence is me/anyone who wants to create custom reports

@ErikBjare
Copy link
Member

ErikBjare commented Sep 9, 2019

Looks like active-win gets it on Linux by getting the PID of the active window and then looking up the path of the executable using /proc.

Example for how to get it in the terminal on Linux:

PID=$(xprop | grep PID | grep -P -o '[0-9]+')
ls -l /proc/$PID/exe

@johan-bjareholt
Copy link
Member

From that you can get the real formatted/friendly app name, icon, and more.

There's an API at least in Xlib to get the icon of the currently focused window, but to save icons in the aw-servers database is probably not a good idea.

I'm not suggesting that to be clear. The "you" in that sentence is me/anyone who wants to create custom reports

Yeah I know, I was just thinking loudly. Such icons could be useful for the web-ui as well which was I brought it up.

Example for how to get it in the terminal on Linux:

PID=$(xprop | grep PID | grep -P -o '[0-9]+')
ls -l /proc/$PID/exe

That only works for some processes. Works fine for example empathy and firefox but not for urxvt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants