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

Focus current tab #638

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

igordsm
Copy link
Sponsor Contributor

@igordsm igordsm commented Nov 7, 2021

Fix #73

Tested this with multiple terminal windows and tabs. should work without issues.

@jeremypw
Copy link
Collaborator

jeremypw commented Nov 10, 2021

Is it necessary to add another dependency (especially X11 specific)? Is using "get_server_time" essential?

@igordsm
Copy link
Sponsor Contributor Author

igordsm commented Nov 13, 2021

@jeremypw Unfortunately it seems get_server_time is essential. Apparently present_with_time needs a timestamp to solve focus stealing and the only timestamp I passed to it that worked was this one. Using regular datetime functions did not work and I found an answer in SO that linked to this function.

Comment on lines +70 to +71
var ts = Gdk.X11.get_server_time ((Gdk.X11.Window) window.get_window ());
window.present_with_time (ts);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be using Gtk.get_current_event_time ()

Suggested change
var ts = Gdk.X11.get_server_time ((Gdk.X11.Window) window.get_window ());
window.present_with_time (ts);
window.present_with_time (Gtk.get_current_event_time ());

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marukesu Does this work on your end? It doesn't for me. From what I've read, the timestamp that present_with_time receives must be a X11 server timestamp and the only way I was able to get it was using this Gdk.X11 call. I've tried Gdk.CURRENT_TIME and many types of datetime functions returning the current time as well.

I'm not a fan of adding this dependency too, but it was literally the only timestamp that worked for me.

}
}
}
get_last_window ().present_with_time ((uint32) now.to_unix ());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
get_last_window ().present_with_time ((uint32) now.to_unix ());
get_last_window ().present_with_time (Gtk.get_current_event_time ());

@jeremypw
Copy link
Collaborator

Might be worth delaying trying to fix this until elementary/notifications#153 is fixed. It should not be necessary to add that extra dependency.

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

Successfully merging this pull request may close these issues.

Open relevant tab when clicking on a task finished notification
3 participants