shoes4 icon indicating copy to clipboard operation
shoes4 copied to clipboard

Shoes - window always on top

Open PragTob opened this issue 10 years ago • 8 comments

Came in through the mailing list:

what about setting the 'always on top' state of a shoes window?

what is meant here is probably that the window is always on top and can not be sent to the background. This seems to be rather simple in SWT (just a style for the shell): swt thread

PragTob avatar Feb 11 '15 21:02 PragTob

This might be not so easy to implement for Linux. There is this bug which makes styles other than SWT.ON_TOP to disappear. I tested it on Ubuntu 14.04 and the app window looks like a square, i.e no close, minimize, maximize buttons, etc.

Not sure about other platforms.

tryzniak avatar Feb 21 '15 12:02 tryzniak

That seems totally weird, that bug is so old (also the duplicated one) that it seems so weird that it isn't fixed in an up to date SWT we use... :/

Since it's an upstream bug I believe all we can do is use it and reference that bug that needs fixing.

PragTob avatar Mar 01 '15 21:03 PragTob

I would love support for this for a project I'm working on! edit: I'm also happy to try adding it myself if you could give me a little direction edit: Actually, I got it working! Just need to fix up the tests

DenialAdams avatar Nov 21 '15 21:11 DenialAdams

:D

@AStrangeEnigma that sounds great! My general guidance would be this (and I should probably also write that up some time...): The data if something should be "always on top" should be held in the DSL class Shoes::App, the actual implementation of being always on top that is backend specific goes into Shoes::Swt::App. And I'd like the option to be passed on startup so that I can do

Shoes.app always_on_top: true do
  # ...
end

Feel free to open a pull request even with broken tests. We can help you fix them up :)

PragTob avatar Nov 22 '15 13:11 PragTob

Great!

What I ended up doing was just adding the one line

style |= ::Swt::SWT::ON_TOP if @dsl.opts[:always_on_top]

in main_window_style

To get exactly the behavior you mentioned. Is there somewhere else I should change?

DenialAdams avatar Nov 23 '15 01:11 DenialAdams

that seems perfectly valid :) Would you care make a PR? Otherwise we'll have to wait until Jason or I get to it :) And you'd miss out on all the glory! :)

PragTob avatar Nov 23 '15 21:11 PragTob

I'll make the PR tonight!

DenialAdams avatar Nov 24 '15 00:11 DenialAdams

#1172

DenialAdams avatar Nov 24 '15 02:11 DenialAdams