-
Notifications
You must be signed in to change notification settings - Fork 259
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
Enhancement: Stjerm Layout Like Functionality #298
Comments
There's a lot to unpack here but the first big problem I see is that the Xlib stuff most likely won't work on Wayland, or MacOS (It's not officially supported, but I run terminator on my mac a lot). There are Gtk and Gdk calls that will work across all three, though, I'm pretty sure. That way we also wouldn't need to import another lib. |
I'm fine with trying to use Gtk and Gdk calls to try and get the pointer. The only thing is is that I've always found it hard to try and translate the C implementation back to Python. So, I have been lazy and mostly used the above option because it was the simplest for me. =P Doing further googling, I'm thinking Gdk.DeviceManager.get_client_pointer would be a possible route to take. https://stackoverflow.com/questions/24844489/how-to-use-gdk-device-get-position |
Api Reference: https://lazka.github.io/pgi-docs/#Gdk-3.0/classes/Device.html#Gdk.Device OK, I figured out how to use Gdk to get the pointer info. Now, this is currently setup to work with GTK 3. The methods used would be different if you're supporting older GTKs. I had to bounce about to get what the "modern" way of doing this is as the SO link I mentioned is doing an older way that uses deprecated calls. import gi
gi.require_version('Gdk', '3.0')
from gi.repository import Gdk as gdk
def getPointerPos(self)
display = gdk.Display.get_default()
gdk_device_manager = gdk.Display.get_default_seat(display)
pointer = gdk_device_manager.get_pointer()
data = pointer.get_position()
print("x: {}, y: {}".format(data.x, data.y))
return data.x, data.y |
Have you tried to do this with layouts? I've been reading over the functionality that you requested and it looks to me like Layouts are exactly what you want. I'm also gonna be painfully honest here. I'm not going to code this feature as you described it. I may merge it, if you or somebody else writes the code in a way that won't interfere too much with maintenance, but this is an all-volunteer project, and we have limited time to work on new functionality. |
@mattrose In so far as I can tell, layouts doesn't manage the position beyond explicit x, y definitions. It doesn't position it based on which monitor the mouse is on. In addition, window hints would need to be added in order to make it function like STjerm so as to not clutter the app list when acting like a dynamically shown terminal. Sad to hear it wont be added per say but I understand why. Regardless, thank you for hearing me out. |
Sorry to disappoint |
Stjerm Repo: https://github.com/stjerm/stjerm
Would ya'll consider adding layout binding like that of Stjerm? With Stjerm one can pass a position argument of left, right, top, and bottom as well as width and height arguments. From there, you can bind to a toggle key that shows/hides the terminal. What this allows me to do is something like the follow:
It binds a terminal to the respective key and sets the width and height. From there, it's toggleable and shows on the monitor the mouse is currently on.
For terminator, I know there is the --geometry argument and I know there is a toggle key setting one can set. I don't see a cli argument to set the keybinding. I know that -p is already used to load a profile. So, a different argument is needed there. But, it would be nice to bind unique key's or combo of keys that show or hide their respective terminals. Additionally, positioning the window automatically based on the monitor the mouse is on would be a great addition.
I've been looking through Terminator's code but am a little unclear on where to focus/start.
Monitor data can be gotten with something like this but modified accordingly:
To get mouse position, something like the following might work. from there, that data is compared to the monitor data and the window is positioned appropriately on the toggle action. The package python-xlib would be needed.
The text was updated successfully, but these errors were encountered: