konsole - unable to set size from script

Hello.
I could not set size of konsole window from script.

konsole -noclose -p "TerminalColumns=80;TerminalRows=20" -e ls /etc &

Does not work from script, or command line

Any help is welcome

You can change the size of your Konsole window in the special window settings. Click in the top left corner of your window border/frame (don’t know how that part of a window is called) and then:

More Actions > Special Window Settings

Did you try that?

That does not help much when he wants to start it through a command and immediatly in the size he wants.

Well, assuming you are using KDE, you can force Konsole or any other Software to permanently (or initially) be displayed at a specific position and size. But yes, doesn’t help when you want to have it started with “ls /etc”.

I did not try this and I guess you studied the konsole documentation better then I did and that you tried several things.
Nevertheless I will give some suggestions (which you may ignore because you tested that already last tweek :wink: ).

-p property=value
Change the value of a profile property.

You have two properties there separated by a ;. Did you try two -p clauses instead?

It says: “Change the value of a profile property.”, but you have not specified the --profile option. Is that correct? Is there then some defaut profile active?

Just my two cents.

You have to disable “Use current window size on next startup” in Konsole’s settings (Settings->Configure Konsole…) to make setting the window size work.

Otherwise Konsole remembers the window size and uses this when opening a new window, in this case the size you specify is ignored.

That is a very usefull remark, because I hate it when it starts with tthe size i sometimes use in exceptional cases and that then stick.

But I can not find it. I have two items there (General and TabBar) and none of them contains that setting.

Standard openSUSE 13.1 (that means with KDE 4.11.5 and Konsole 2.11.3).

It is there in KDE 4.13.1 (Konsole 2.13.1):
http://wstaw.org/m/2014/06/12/konsole.png
But apparently this got added after 4.11, sorry.
Maybe it is hidden somewhere else? In the profile settings perhaps?
I cannot tell at the moment because I only have 4.13 here.

At least that’s stored in the file ~/.kde4/share/config/konsolerc like this:

[KonsoleWindow]
SaveGeometryOnExit=false

So you could try to edit that file manually. I’m not sure whether Konsole 2.11 would respect that setting then though.

PS: Google would suggest that this option does exist since 4.4 at least, but it was indeed in the profile’s settings.
So choose “Edit Current Profile” and look for it there.

Or (especially @OP, who didn’t mention which version he uses) you should be able to change this with the -p command line option as well, use “konsole --list-profile-properties” for a list of all supported profile properties (as you may know already :wink: ).

Found it in the profile. And it seems to work. Thanks for the hint.

On 2014-06-11 23:26, wolfi323 wrote:
>
> You have to disable “Use current window size on next startup” in
> Konsole’s settings (Settings->Configure Konsole…) to make setting the
> window size work.
>
> Otherwise Konsole remembers the window size and uses this when opening a
> new window, in this case the size you specify is ignored.

Then do not use konsole for this application. I use xterm from scripts,
and place them where I want, with the size I want.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

For completeness: (as I had a look at 4.11 myself now)
In KDE 4.11 (Konsole 2.11.x) the exact location of this option is Settings->“Edit Current Profile…”->General->“Use current window size on next startup”.
Or call Settings->“Manage Profiles…” and edit the corresponding profile.

You could of course create a new profile (even system-wide by creating a .profile file in /usr/share/kde4/applications/konsole/) with this option disabled for use in your script(s) and set it via the “–profile” option.

hello.

From normal user logon :

Nothing similar.
Just “save window size and position” In :
Settings -> Edit current profile -> General

Same for me.

Does not work.

Yes I confirm

here is the profile file /home/tux_user/.kde4/share/apps/konsole/ Shell.profile
:

[Appearance]
ColorScheme=BlackOnLightYellow

[General]
Environment=TERM=xterm
Name=Shell
Parent=FALLBACK/
SaveGeometryOnExit=false

[Scrolling]
HistorySize=10000

but

konsole -noclose -p "TerminalRows=20" -p "TerminalColumns=20" -e ls /var/mail

the resize does not work

Right, that’s where the setting is located in version 2.11 (KDE 4.11) as has already been written.
This has been changed in later versions to be a global setting.

It does work with later versions as I wrote.
And as should be clear in the mean-time, it does not with 2.11 as it is a profile-specific setting there (you noted that yourself).
So set it in the profile, not in the global settings.

I already told you how to set a specific profile via the command line options, too.

You’re right.
But it does work in later versions.

Well, create a new profile with your desired Size and use the --profile option to specify that profile, I’d say.
Or use xterm, as others have suggested, would be more portable anyway.

PS: It does work in 2.11 as well, but you have to remove ~/.kde4/share/config/konsolerc, because the size is stored there.
Or at least remove the “Height” and “Width” lines in that file.

If the config contains no specific size, you can set it via the TerminalRows/TerminalColumns properties on the command line.