Coder Social home page Coder Social logo

Comments (5)

Zamiell avatar Zamiell commented on August 15, 2024

There's no real need to add this to the tracker, as this can be accomplished in literally one line using AutoHotkey:

; A hotkey of Windows Key + x
#x::
    ; Set the currently active window to "AlwaysOnTop" mode, or disable it if it was already set that way
    Winset, AlwaysOnTop, Toggle, A

    ; Play a sound so that I know the hotkey was pressed
    SoundPlay, C:\Windows\Media\Windows Logoff Sound.wav
return

from rebirthitemtracker.

Zamiell avatar Zamiell commented on August 15, 2024

This lists how to add this option:

http://stackoverflow.com/questions/1482565/how-to-make-python-window-run-as-always-on-top

It seems it would only take adding 2 additional lines? Something like:

if option.alwaysontop:
    SetWindowPos(pygame.display.get_wm_info()['window'], -1, x, y, 0, 0, 0x0001)

from rebirthitemtracker.

Hyphen-ated avatar Hyphen-ated commented on August 15, 2024

when i call that function, it can successfully set the size and position, but it doesn't do the always-on-top

from rebirthitemtracker.

viroulep avatar viroulep commented on August 15, 2024

I forgot to post it there, when looking for a platform independent solution I found this :
http://pygame.org/project-Window+Manager+Extensions-515-.html

If using a pygame extension is fine I could take a look at this in like 2 weeks.

from rebirthitemtracker.

viroulep avatar viroulep commented on August 15, 2024

I forgot to say that I looked into it.
tl;dr: Zam's lines "should" have worked, and please make this a Windows-specific option.

Long version :

Windows

The extension is pretty straightforward, basically it does what Zam said :
SetWindowPos(getSDLWindow(), zorder, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE)
Which translates to :

from ctypes import windll
windll.user32.SetWindowPos(pygame.display.get_wm_info()['window'], -1, 0, 0, 0, 0, 0x0003)

(the SWP_NOMOVE flag tells no to modify the window position, so x/y would be ignored)
So if Hyphen tested it and it didn't work then idk...
Both the extension and the SO question are quite old, pygame and/or windows may have changed stuff in between. I can't be very helpful with this.

Linux

It's... complicated.
First of all there is not only one window manager.
The program can set a bunch of predefined "hints" that may, or may not, be handled by the window manager (in this case the _NET_WM_STATE_ABOVE, from the Extended Window Manager Hints).
I use a tiling window manager, floating windows support is here only for edge cases like "print" or "save as" popups, or specific app like inkscape/gimp (and in my case Isaac windowed+tracker+timer, which do not overlap). In the context of such a WM, there is not much use-case for a z-order on floating windows, and i3 just doesn't support it.
Still, I could extract a minimal set of changes from the extension and run it. It obviously doesn't work for me, but the most popular desktop environments (gnome/kde) have support for this, so I believe it would work.
However I actually don't have a use for this feature, and I'm not setting up a VM to test this :p
If someone else want to bring the linux support for this feature, I can push a rough draft of the changes needed somewhere. Maybe @Nandicre would be interested to do this, he mentioned he was using arch and I think he uses xfce, which claims having support for EWMH.
Not sure it's worth it though.

from rebirthitemtracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.