Konsole resizing and default size

Stephen Dowdy sdowdy at ucar.edu
Tue Apr 10 00:35:12 BST 2012

Qt: 4.6.3
KDE Development Platform: 4.4.5 (KDE 4.4.5)
(Debian Squeeze)

To obtain the current Konsole Window's size this appears to work:

$ dbus-send --type=method_call --print-reply --dest=${KONSOLE_DBUS_SERVICE}  /konsole/MainWindow_1 org.freedesktop.DBus.Properties.Get string:com.trolltech.Qt.QWidget string:size
method return sender=:1.34 -> dest=:1.226 reply_serial=2
   variant       struct {
         int32 1829
         int32 1026

However, what i believe (from the inadequately documented
'dbus-send' manpage) should work to set the konsole window size,
generates an error...

$ dbus-send --type=method_call --print-reply --dest=${KONSOLE_DBUS_SERVICE}  /konsole/MainWindow_1 org.freedesktop.DBus.Properties.Set string:com.trolltech.Qt.QWidget string:size variant:int32:1200,600
Error com.trolltech.QtDBus.Error.InternalError: Internal error

I've tried variant:int32:1200,600 ; variant:int32:1200 variant:int32:600 ; int32:1200,600

Anybody know if this is just a known deficiency with dbus-send in
this release of kde, or am i doing something wrong? (perhaps there's
another configuration flag that is used to disallow remote property

Ultimately, i'm putting a script together that runs inside a konsole
window, detects the user-specified size of that konsole, then
creates KWin Rules to force default konsole sizes to match, since
konsole is broken in that respect (i.e. doesn't allow you to specify
default size, it only remembers the last used size, and while it
claims to, it appears to ignore the --geometry flag on the command
line as well)

The meat of the script being:

    numrules=$(kreadconfig --file kwinrulesrc --group General --key count)
    rule=$(( numrules + 1 ))
    kwriteconfig --file kwinrulesrc --group "${rule}" --key Description "Force Konsole windows to open with specific geometry"
    kwriteconfig --file kwinrulesrc --group "${rule}" --key size ${my_size}
    kwriteconfig --file kwinrulesrc --group "${rule}" --key sizerule 3
    kwriteconfig --file kwinrulesrc --group "${rule}" --key wmclass konsole
    kwriteconfig --file kwinrulesrc --group "${rule}" --key wmclasscomplete false
    kwriteconfig --file kwinrulesrc --group "${rule}" --key wmclassmatch 1
    kwriteconfig --file kwinrulesrc --group "${rule}" --key types 4294967295
    kwriteconfig --file kwinrulesrc --group "General" --key count "${rule}"
    dbus-send --dest=org.kde.kwin /KWin org.kde.KWin.reloadConfig

But in doing this, i also started looking at resizing the konsoles
that existed already, which is where i'm stuck.

Also, it'd be nice to be able to specify CHARACTER cell sizes, not
just pixel sizes.  Unfortunately, 'resize -s cols rows' doesn't work
with konsole, and i'm not sure of another way to resize konsole
windows this way...

Any pointers appreciated,

Stephen Dowdy  -  Systems Administrator  -  NCAR/RAL
303.497.2869   -  sdowdy at ucar.edu        -  http://www.ral.ucar.edu/~sdowdy/

This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

More information about the kde mailing list