[Solved] Linux Workspace 2-4

Post your Gambas programming questions here.
AndyGable
Posts: 359
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Linux Workspace 2-4

Post by AndyGable »

Cool

thank you for the information

would there be a reason why when I have FMain.hide or FMain.visible = false the form is still shown

is the first form hide status ignored in Gambas?
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Linux Workspace 2-4

Post by BruceSteers »

Okay for screens use something like this...

Public Sub GoToScreen(iOpenOn As Integer)

  Me.Left = ((Screens[iOpenOn].W - Me.W) / 2) + Screens[iOpenOn].X
  Me.Top = ((Screens[iOpenOn].H - Me.H) / 2) + Screens[iOpenOn].Y

End

that will jump to the selected display center screen.

and you can use Me.Window.Screen to detect the display you are currently on but it does not work until the application has loaded (not in Form_Open or Form_Show)

Screens[0] is primary Screens[1] secondary
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Linux Workspace 2-4

Post by BruceSteers »

AndyGable wrote: Monday 31st October 2022 3:35pm Cool

thank you for the information

would there be a reason why when I have FMain.hide or FMain.visible = false the form is still shown

is the first form hide status ignored in Gambas?

Without seeing the code it's impossible to guess, but to answer the question, no, the main form is not restricted from hiding.

Public Sub btnHideMe_Click()

  Me.Hide
  Wait 3
  Me.show

End

If i do that my window hides then pops back 3 seconds later even without Persistent set true.
So it's your code somewhere either preventing the window closing or opening it again.

Is there a check to stop the form closing in Form_Close? (setting Persistent should fix that)
a LostFocus() event could be triggered, do you have one regaining focus?.
a .SetFocus() or .Activate() or .EnsureVisible call could cause form to re-show.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Linux Workspace 2-4

Post by BruceSteers »

okay so now i have this app....

like before the workspace switching functions but they have been fixed to work with multiple displays.
if more than one monitor my size calculations were incorrect.

Added a class called it BigScreen
BigScreen.Width
BigScreen.Height


Will show the total screen size including both monitors if there are 2, this fixes my previous code.

also now the test app has a screen switching option as well as workspace switching.

It may require some debugging on systems i've not tested it on.

Best wishes
Attachments
LargeDesktopWorkspace-0.0.14.tar.gz
(18.03 KiB) Downloaded 78 times
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Linux Workspace 2-4

Post by BruceSteers »

Here's a little Workspace switcher i just made...

It has some updates/fixes to the classes in the above mentioned project.

It's set to work on a System tray icon but the code could probably be easily made to pop open the window via a button in your own project to visually switch workspaces.

I've tried to make it show windows on other workspaces in the selection window while the preview for the current desktop is a screenshot.

Enjoy :)
Attachments
Workspacer-1.0.tar.gz
(17.43 KiB) Downloaded 76 times
If at first you don't succeed , try doing something differently.
BruceS
ralphmeyer
Posts: 2
Joined: Thursday 23rd March 2023 2:18pm

Re: Linux Workspace 2-4

Post by ralphmeyer »

I am aware this answer comes a bit late, but for others who might have the same question. To answer your question, yes, it is possible to have an application start on one workspace and then move it to another. In fact, most Linux desktop environments have a built-in feature to do just that.If you want to automate this process for multiple applications, you can use a tool like Devilspie, which allows you to define rules for how windows should behave, including which workspace they should appear on.As far as I know, the same option works for CentOS7 too. So, you may try it. But I've heard that it has reached its end of life. Anyway, if you're interested, you can verify it at https://tuxcare.com/extended-lifecycle-support/centos-7-extended-support/
Last edited by ralphmeyer on Monday 27th March 2023 11:06am, edited 1 time in total.
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Linux Workspace 2-4

Post by BruceSteers »

ralphmeyer wrote: Thursday 23rd March 2023 2:27pm I am aware this answer comes a bit late, but for others who might have the same question. To answer your question, yes, it is possible to have an application start on one workspace and then move it to another. In fact, most Linux desktop environments have a built-in feature to do just that.If you want to automate this process
Well yes but his question was "can i do this with gambas?"

I'm guessing with the little coding adventure we went on he figured out a way to do it :)

I figured it out ,,, and then some... ;)
If at first you don't succeed , try doing something differently.
BruceS
Post Reply