Bug 431683 - Kate should detach when launched from a terminal
Summary: Kate should detach when launched from a terminal
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: 20.12.1
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-16 11:31 UTC by Luna D Dragon
Modified: 2023-07-17 21:36 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 23.04
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luna D Dragon 2021-01-16 11:31:52 UTC
When kate is launched from the terminal kate outputs a lot of debug info and doesn't detach from the terminal session.kate should have a flag to detach from the session when launched 

An example of this behavior is how visual studio code(and the numerous foss forks) launch from the terminal(code filename) 0 output unless requested or something causes code to crash
Comment 1 Justin Zobel 2021-01-17 06:24:57 UTC
If you're working in a terminal often I'd suggest picking up a few tips like "&"

If you want to open kate and have it detach run "kate &" or if you want to open a file straight away "kate myfile.c &`

You might get output still in your terminal but you can close that terminal at any time and kate will continue to run. 

This works for any application you launch from a terminal.
Comment 2 Luna D Dragon 2021-01-17 06:29:05 UTC
I do use that but it would be nice to be able to use the same terminal session to open multiple projects/files in kate
Comment 3 Justin Zobel 2021-01-17 08:31:25 UTC
(In reply to advaith from comment #2)
> I do use that but it would be nice to be able to use the same terminal
> session to open multiple projects/files in kate

The process is the same for opening the next file.

kate myfile1 &
kate myfile2 &
Comment 4 Luna D Dragon 2021-01-17 14:33:37 UTC
quite frankly using & every time you open a file isn't a solution. its a workaround. there needs to be a at least a flag that can be used to allow kate to detach from a terminal and not output debug info
Comment 5 Reiddragon 2021-01-17 15:35:08 UTC
There's nothing really "wrong" with the current behaviour, however I do agree with this changing simply to make things more consistent
Currently Kate will detach if there's a running instance but won't if there's no running instance, and that can just throw some users off since the behaviour is just not consistent, or at least not as consistent as it could be, so I can see why some would want the default behaviour changed and move the current behaviour to a flag.
Comment 6 Christoph Cullmann 2021-01-17 15:36:59 UTC
I have no issue if we have this as option, one can then still think about what should be the default.

For the debugging output: with the latest frameworks release of this month and some recent Kate, normally there shall be no output for release builds.

But in previous versions there was always some crap output ;)

(and there might still be some if you run outside of a KDE Plasma session)
Comment 7 Nate Graham 2021-01-19 17:10:34 UTC
Also when you want to launch a KDE app from the terminal, the best way is to do `kstart5 <app>` This goes through the standard startup sequence, which means yu get launch feedback and the app gets put into its own cgroup slice so that it appears correctly in System Monitor.

Perhaps kate could do this automatically and re-launch itself when run directly?
Comment 8 Justin Zobel 2021-01-19 22:15:57 UTC
Starting kate with kstart5 gives some warning output:

`Omitting both --window and --windowclass arguments is not recommended`

As this automatically forks kate into it's own process instead of 
running inside the terminal an alias would then do it fine.

alias kate='kstart5 kate`

Have tested with kstart5 kate myfile and that opens the file correctly.
Comment 10 Erik Quaeghebeur 2023-07-17 19:12:25 UTC
(In reply to Waqar Ahmed from comment #9)
> https://invent.kde.org/utilities/kate/-/merge_requests/1151
Apparently this feature was merged and made the default silently. It apparently is in the version that my distro has recently started shipping. This new ‘feature’ breaks my setup, where I launch kate from a Python script using subprocess as part of a kmail filter. Because subprocess now thinks kate has finished (it gets the pid of the intermediate process, not of the kate instance itself), it doesn't block anymore and the script does not work anymore. :-(

(In reply to Christoph Cullmann from comment #6)
> I have no issue if we have this as option, one can then still think about
> what should be the default.
I do hope there is an option to get the previous behavior back, as otherwise a regression was introduced breaking functionality just for the sake of getting rid of some visual annoyance. From the help, I see no option that would be the one I need. Please advise to at least get a workaround until the regression reverted or an option is added (which'll still take months to propagate to my distro).
Comment 11 Waqar Ahmed 2023-07-17 19:33:22 UTC
You can just check the help command, it would have saved you from writing such a long comment.

kate -b # run in blocking mode
Comment 12 Erik Quaeghebeur 2023-07-17 21:36:04 UTC
(In reply to Waqar Ahmed from comment #11)
> You can just check the help command, it would have saved you from writing
> such a long comment.
> 
> kate -b # run in blocking mode

Thanks for pointing out that is the option I need.

For the record:

(In reply to Erik Quaeghebeur from comment #10)
> […] From the help, I see no option that would be the one I need. […]

I did read the help. It did not help me, as I explicitly mentioned.

The help text for that option (translated from Dutch) is “If using an already running kate process, block until ready, if URLs to open have been given.” and not “Run in blocking mode.”. In the context of my comment, there is no ‘already running kate process’. So I guess the help text could be improved.