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

Support for Gtk.Window.set_position() and/or Gtk.Window.move() #910

Closed
nwg-piotr opened this issue Nov 29, 2020 · 22 comments
Closed

Support for Gtk.Window.set_position() and/or Gtk.Window.move() #910

nwg-piotr opened this issue Nov 29, 2020 · 22 comments

Comments

@nwg-piotr
Copy link

nwg-piotr commented Nov 29, 2020

I know we have the Place plugin, but when it's turned off, it would be great to be able to affect the window position programmatically, e.g. window.set_position(Gtk.WindowPosition.MOUSE). Or at least to move it to desired coordinates with window.move(x, y). Could it be considered?

@soreau
Copy link
Member

soreau commented Nov 30, 2020

This could be added to the place plugin, a match with position, or it could be added to window-rules plugin.

@nwg-piotr
Copy link
Author

The place plugin affects all the windows. The ideal solution would be if it worked as it does, unless the window placement is forced with the set_position or move method.

@soreau
Copy link
Member

soreau commented Nov 30, 2020

I didn't realize you meant from client-side gtk.. These work without place plugin enabled already? Can you provide some example client/gtk code that does what you expect?

@soreau
Copy link
Member

soreau commented Nov 30, 2020

Also, do these functions work in gnome wayland shell?

@nwg-piotr
Copy link
Author

Haha! I haven't seen GNOME for over 2 years :))) No idea. On X11 it works, AFAIK.

Out of boredom I started working on a gadget like this: https://youtu.be/mMdkhjKs9ug It looks not bad centered, but e.g. on Openbox I can attach it to a tint2 button, and it opens in the mouse pointer position, which gives a GNOME-like look and feel. It would be not bad to have the same behevior on Wayfire + Waybar.

Code: https://github.com/nwg-piotr/nwgcc

@soreau
Copy link
Member

soreau commented Nov 30, 2020

Haha! I haven't seen GNOME for over 2 years :))) No idea. On X11 it works, AFAIK.

Out of boredom I started working on a gadget like this: https://youtu.be/mMdkhjKs9ug It looks not bad centered, but e.g. on Openbox I can attach it to a tint2 button, and it opens in the mouse pointer position, which gives a GNOME-like look and feel. It would be not bad to have the same behevior on Wayfire + Waybar.

Code: https://github.com/nwg-piotr/nwgcc

Wow, this is awesome! I will try building it now.

@nwg-piotr
Copy link
Author

Thanks! I'm not sure if setup.py is all right. Haven't yet tried packaging it.

@nwg-piotr
Copy link
Author

nwg-piotr commented Nov 30, 2020

For sure you'd need commands: upower or acpi, iwgeitd, light and also systemctl and python-pyalsa in your system. This is still a work in progress, only tested on Arch Linux.

@soreau
Copy link
Member

soreau commented Nov 30, 2020

Thanks! I will file an issue there if I have trouble.

@ammen99
Copy link
Member

ammen99 commented Nov 30, 2020

This is really impossible on Wayland. Clients do not know their position and should not be able to change it. The only exception so far are layer-shell surfaces.

You could use window-rules to create per-window placement rules.

@ammen99 ammen99 closed this as completed Nov 30, 2020
@nwg-piotr
Copy link
Author

Out of curiosity I installed GNOME on my testing laptop. Both methods only work on the Xorg session.

@soreau
Copy link
Member

soreau commented Nov 30, 2020

@nwg-piotr With #912 and this WIP plugin (applies to latest wayfire-plugins-extra), right-click on gtk apps' titlebars runs nwgcc and positions it. If you add self.set_decorated(False) in the MyWindow class of nwgcc, it will be undecorated by the plugin. The addition of --name=nwgcc sets the app_id.

@nwg-piotr
Copy link
Author

nwg-piotr commented Nov 30, 2020

Will it be enough to build everything from master? [edit] and apply the patch?

@soreau
Copy link
Member

soreau commented Nov 30, 2020

No, you'd have to use the 912 PR branch of show-window-menu for wayfire and apply the patch to wayfire-plugins-extra master with curl http://ix.io/2G0w | git am

@nwg-piotr
Copy link
Author

OMG, I'll better wait for it to be merged :D

@nwg-piotr
Copy link
Author

@soreau I added a switch in preferences to switch self.set_decorated() False/True. Probably I'll grab a large cup of coffee and try to build what you described above.

@ammen99
Copy link
Member

ammen99 commented Nov 30, 2020

@nwg-piotr The Wayfire PR has been merged, so you just need to update to master Wayfire. For extra plugins, you need WayfireWM/wayfire-plugins-extra#65

@soreau
Copy link
Member

soreau commented Nov 30, 2020

@nwg-piotr #912 has already been merged and there is wayfire-plugins-extra/#65 for the plugin, so you only need wayfire/master and the wayfire-plugins-extra/window-menu branch.

@nwg-piotr
Copy link
Author

nwg-piotr commented Nov 30, 2020

and the wayfire-plugins-extra/window-menu branch

For some reason I can't build it.

[piotr@msi wayfire-plugins-extra]$ meson build --prefix=/usr --buildtype=release
The Meson build system
Version: 0.56.0
Source dir: /home/piotr/Clones/wf-install/wayfire-plugins-extra
Build dir: /home/piotr/Clones/wf-install/wayfire-plugins-extra/build
Build type: native build
Project name: wayfire-plugins-extra
Project version: 0.6.0
C compiler for the host machine: cc (gcc 10.2.0 "cc (GCC) 10.2.0")
C linker for the host machine: cc ld.bfd 2.35.1
C++ compiler for the host machine: c++ (gcc 10.2.0 "c++ (GCC) 10.2.0")
C++ linker for the host machine: c++ ld.bfd 2.35.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.7.3)
Found CMake: /usr/bin/cmake (3.19.1)
Run-time dependency wayfire found: NO (tried pkgconfig and cmake)

meson.build:16:0: ERROR: Dependency "wayfire" not found, tried pkgconfig and cmake

@soreau
Copy link
Member

soreau commented Nov 30, 2020

@nwg-piotr You should use the same --prefix as wf-install did to install wayfire initially. The default is /opt/wayfire. You'd want to do set PKG_CONFIG_PATH env var to the directory containing wayfire.pc, probably in /opt/wayfire/lib/pkgconfig/ or so, before running meson.

@soreau
Copy link
Member

soreau commented Nov 30, 2020

An easy way to do this with wf-install:

$ ./wf-install/install.sh -c
$ cd ./wf-install/wayfire-plugins-extra
$ git checkout window-menu
$ ninja -C build && sudo ninja -C build install

Then run /opt/wayfire/bin/startwayfire as usual and enable the Window Menu plugin.

@nwg-piotr
Copy link
Author

nwg-piotr commented Nov 30, 2020

Thank you! It looks cool, even though I had to turn window decorations on for the first time. :D

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

No branches or pull requests

3 participants