Konsole resizing and default size

Duncan 1i5t5.duncan at cox.net
Tue Apr 10 03:23:39 BST 2012

Stephen Dowdy posted on Mon, 09 Apr 2012 17:35:12 -0600 as excerpted:

> [VersionInfo]
> Qt: 4.6.3 KDE Development Platform: 4.4.5 (KDE 4.4.5)
> (Debian Squeeze)

Thanks.  You've probably already seen this so I'll only briefly state 
that IMO only with 4.5 did kde4 finally reach release quality (4.5.4 or 
4.5.5 should have been the big 4.0, before that it should have remained 
pre-releases), so it pains me to see someone still running a 4.4 kde as I 
just don't consider it a real release quality release.  (An exception is 
kdepim; I recommend sticking with 4.4 there, and migrating away from 
kdepim/kmail/etc after that, as the new akonadified version is just more 
trouble than it's worth, IMO.)

> 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, [setting via dbus-send] generates an error...

> 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 changes?)
> 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)

> i also started looking at resizing the konsoles that
> existed already, which is where i'm stuck.

I don't know much about dbus messaging for this, but I *DO* know how to 
manipulate window size/location via script! =:^)

Take a look at the "Hotkey to move windows to predetermined location and 
geometry" thread, OP of Dotan Cohen, on March 12.

In particular, look for two apps, an older non-kde app (which I use here 
for scripting window sizing/location/etc) called wmctrl (it was in gentoo 
so I'd be rather surprised if it's not available in debian as well), and 
a newer app called wmiface, available on kde-apps.org if it's not in 
debian, but again, it's in gentoo, so...

FWIW, wmiface claims wmctrl seems to be unmaintained now.  But by the 
time I found out about it I already had wmctrl installed and being 
invoked by various scripts, so I really haven't had a reason to even try 
wmiface.  Take your pick, I guess, since the one I can personally verify 
as working for me is claimed to be outdated...

Meanwhile, approach-wise, I guess what those apps do is tell the window-
manager, not the target app in question.  Thus, perhaps you're looking in 
the wrong place looking for konsole functions of that nature.  Maybe it's 
kwin's dbus interface you should be checking for that, not konsole's.

> 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...

I don't know a direct way to do it, but konsole should be using monospace 
fonts, and if you know the pixel size of the font, you should be able to 
calculate accordingly, converting to px-counts as necessary.  (bc is the 
usual CLI math engine, for things too complex for easy shell math.)

Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

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