Hello all fellow gambasers. I will start with an introduction. I have dualbooted windows and solus linux for 5 years. I never managed to install gambas on solus. But things have changed now. I just bougth a new pc and I am now trying to survive with linux mint only. Being familiar with vb2008express I feel mostly at home with gambas 3. I am recoding some of my most needed tools from windows to linux mint. Some questions do arise. I will start with a simple one:
How do I launch the filemanager nemo with a specific folder opened and a specific file in that folder preselected? And most importanly I want nemo to stay open when I close my gambas app.
Open file location [SOLVED]
Open file location [SOLVED]
Last edited by JumpyVB on Wednesday 22nd March 2023 2:32pm, edited 1 time in total.
- BruceSteers
- Posts: 1565
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Open file location
Opening the file,,, easy..JumpyVB wrote: ↑Tuesday 21st March 2023 7:14pm Hello all fellow gambasers. I will start with an introduction. I have dualbooted windows and solus linux for 5 years. I never managed to install gambas on solus. But things have changed now. I just bougth a new pc and I am now trying to survive with linux mint only. Being familiar with vb2008express I feel mostly at home with gambas 3. I am recoding some of my most needed tools from windows to linux mint. Some questions do arise. I will start with a simple one:
How do I launch the filemanager nemo with a specific folder opened and a specific file in that folder preselected? And most importanly I want nemo to stay open when I close my gambas app.
Exec ["nemo", sFilePath]
Keeping it open when killing the program that launched it... not so easy.
The above code should also keep nemo open when you close your program as long as you do not use Quit to hard kill.
the program will be closed but remain alive, hidden until the child processes are closed (nemo) then it exits
If your program uses Quit on exit then it will kill all child tasks so don't do that.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Open file location
Thank you. "Exec ["nemo", sFilePath]" will get me started. I will investigate further on how to set the child process free. Maybe its not a gambas thing but something I could do directly from a terminal aswel...Well what do you know. I found something promising, the $nohup command:
https://www.geeksforgeeks.org/nohup-com ... -examples/
But I cant test it rigth now. I will have get back to this. But thank you Bruce for getting me started.
https://www.geeksforgeeks.org/nohup-com ... -examples/
But I cant test it rigth now. I will have get back to this. But thank you Bruce for getting me started.
- BruceSteers
- Posts: 1565
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Open file location
i do not think nohup is what you want.
I just tried this and it worked...
Placing a & at the end of the command seemed to free the child from the parent.
It was not possible to use & when using Exec so i used Shell instead.
Then the program opened Nemo and exited correctly while leaving nemo open.
I just tried this and it worked...
Public Sub OpenNemo(sSelectFile As String)
Shell "nemo " & Shell(sSelectFile) & "&"
End
Placing a & at the end of the command seemed to free the child from the parent.
It was not possible to use & when using Exec so i used Shell instead.
Then the program opened Nemo and exited correctly while leaving nemo open.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1565
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Open file location
Haha so i take that back.Bruce wrote:Keeping it open when killing the program that launched it... not so easy.
It was pretty easy to just put an & sign at the end of the command
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Open file location
Thank you. I marked the thread as solved.
- BruceSteers
- Posts: 1565
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Open file location
You're welcome.
There's other ways too.
DBus for example.
you can use dbus interface org.freedesktop.FileManager1
(you have to add gb.dbus component to the project for dbus functions)
Public Sub OpenLocation(sFile As String)
DBus["session://org.freedesktop.FileManager1"]["/org/freedesktop/FileManager1", "org.freedesktop.FileManager1"].ShowItems([sFile], "MyProg")
End
using DBus will work with other file managers not just nemo.
seems iffy on cinnamon though.
for example both my MATE desktop and Cinnamon use Caja file manager , using the above command works okay on MATE opening caja but on cinnamon it says (error path is not a directory)
it works okay on kde plasma with thunar
Have fun
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Open file location
I've been meaning to learn DBus.
Just found your example here viewtopic.php?p=5727&hilit=singleinstance#p5727
I will try to implement it to a project of mine.
Thank you yeat again.