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

'session id' format string #109

Closed
0ion9 opened this Issue Nov 13, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@0ion9
Contributor

0ion9 commented Nov 13, 2012

When specifying --actions, it is sometimes important to be able to specify which instance of feh they are attached to.

For example, I want to write an action which allows me to do simple multiple selection within the current filelist. (essentially building a sub-filelist, which I can later perform an action on.). So it's important to identify which feh instance the selection belongs to, that makes it possible to associate the selection with feh instance correctly, and also for the later action to use the correct selection.

I think process id is suitable for identifying sessions, and '%V' is fairly logical in association with the existing %v; failing that, %I (as in 'session ID') works.

I don't know how your multiwindow setup works -- if that's all in the one process, I guess the window XID would be more appropriate. For now, I've implemented a very simple patch mapping %V to process id, and attached it to this issue.

@0ion9

This comment has been minimized.

Contributor

0ion9 commented Nov 13, 2012

I was going to attach a patch file, but I don't find anywhere to do that. Since the patch is short, I'll just paste it in here instead.

diff --git a/src/slideshow.c b/src/slideshow.c
index 60bd99c..7dcf791 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -508,6 +508,10 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid)
                        case 'v':
                                strcat(ret, VERSION);
                                break;
+                       case 'V':
+                               snprintf(buf, sizeof(buf), "%d", getpid());
+                               strcat(ret, buf);
+                               break;
                        case 'w':
                                if (file && (file->info || !feh_file_info_load(file, NULL))) {
                                        snprintf(buf, sizeof(buf), "%d", file->info->width);
@derf

This comment has been minimized.

Owner

derf commented Nov 13, 2012

feh --multiwindow all runs in one process, yes. But since there is no user-visible filelist in that mode, I think the PID should suffice there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment