[kde] Opening Konsole with Multiple Pre-loaded Tabs

2013-07-22 Thread Jerome Yuzyk

While pursuing how to rename KDE's Konsole terminal emulator tabs 
programmatically I came across many people wanting to open and preload 
multiple Konsole tabs, the most-popular example being multiple SSH 
sessions.

There is a way to do this with D-Bus, described in this Linux Journal 
article [1].

I have wanted to open Konsole with multiple tabs after logging in, as part 
of an alternative to KWin's all-or-nothing approach to resuming sessions 
after login.

But for some years Konsole has had a built-in method to open with multiple 
preloaded tabs, without using DBUS at all. Problem is, there are only 
hints at how to do this on the web and I only had a cobbled-together idea 
of how to use it and it only partly worked for me.

I finally got it to work correctly after reading the Konsole source [2] 
for the function and would like to share how I use it to help fill in a 
little empty spot in the KDE documentation space.

I have a K Menu item configured to execute this command:

konsole --tabs-from-file /home/jerome/bin/konsole_Work

where /home/jerome/bin/konsole_Work is a text file that looks like this:

title: Work;; workdir: ~/work;; command: vi _desk
title: root;; command: sudo -i sysfiles
title: bss-gate;; command: sshto gateway

When Konsole starts it will open 3 tabs doing 3 different things:

in Work I edit a file after cd-ing to a directory,

in root I run a script which edits a file, and

in bss-gate I run a script to ssh to my gateway server. 

Each line of konsole_Work specifies a tab to open using up to 4 fields 
specifying how it is to open. Fields are delimited with ';;' and a field 
name must have a ':' appended.

title:  a name for this tab, tab default if blank
workdir:working directory, ~ if blank
profile:a Konsole profile to use, the default if blank
command:a command to run

You must have one of profile or command. I only use one Konsole profile so 
I don't have experience with that option.


This article is at http://blogs.bss.ab.ca/clippings.htm and any updates I 
make will be there.


[1] http://www.linuxjournal.com/content/start-and-control-konsole-dbus
[2] 
https://projects.kde.org/projects/kde/applications/konsole/repository/revisions/master/entry/src/Application.cpp

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


[kde] term config prolem

2013-07-22 Thread Gene Heskett
Greetings;

Now, I took my sig off, is it still spam.  Even with the sig, its not spam.

Running Ubuntu 12.04.2 LTS, with enough kde pulled in to get kmail (which 
won't even start & no one has ever seen that error) the next biggest item 
stopping me from swapping drives and rebooting to it, is the fact that as 
the #1000 user, I cannot configure the Konsole.  I can, no errors are 
generated when I close the edit window, but my changes are not there when I 
re-open the edit current profile 3 seconds later.

Does anyone have a magic twanger to allow me to configure the Konsole to 
work as I need it?

For instance, I do software for a legacy machine, and need at least 100k 
lines of history I can scroll back through looking for build errors.  With 
a 1000 line default limit, 99% of a nitros9 build scrolls out of the buffer 
forever.  I have 8Gb of ram, so there's little excuse for such a style 
cramping limit.

Thanks all.

Cheers, Gene
___
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.


Re: [kde] term config prolem

2013-07-22 Thread Stephen Dowdy
Gene Heskett wrote, On 07/22/2013 12:29 PM:

> For instance, I do software for a legacy machine, and need at least 100k 
> lines of history I can scroll back through looking for build errors.  With 
> a 1000 line default limit, 99% of a nitros9 build scrolls out of the buffer 
> forever.  I have 8Gb of ram, so there's little excuse for such a style 
> cramping limit.

IIRC, konsole uses memory upto a certain point for scrollback, but
uses /tmp file-on-disk after that. (definitely if you select "unlimited scroll".
(e.g. lsof shows:
konsole 3877 dowdy   86u   REG  254,6   896364   80 
/tmp/kde-dowdy/konsolecr3877.tmp
(about 20 or so such lines, probably one per TAB)
if i switch from 1,000 fixed lines to unlimited (no tmpfiles open before)

For every character, i think (IIRC) konsole used about 3 bytes of disk space 
(to hold
display attributes and the like)

For 1,000 lines at 80char/line that'd be about 1/4MB
for 100K lines that'd be about 25MB.  that's still not tremendous,
but if you have lots of terms and especially unlimited scrollback
and a small /tmp, you could run into trouble.

I've seen some users with unlimited scrolling taking minutes to
scroll back to the beginning if they failed to regularly logout.
(these are folks that stay logged in for months at a time :-( )

So, not sure if Konsole honors ${TMPDIR} or not, but i'm guessing that these
are opened referential to kde path "tmp"
$ kde4-config --path tmp
/tmp/kde-dowdy/


so, you might need to change kde4-config to point to SharedMem by setting
  KDETMP and/or TMPDIR   via something like:

tmpfs_dir=${tmpfs_dir:-/dev/shm}
TMPDIR=$(mktemp -d ${tmpfs_dir}/${USER}.$(date +%Y-%m-%d).) \
  || { echo "failed to make temp directory, aborting" ; exit 1 ;}
readonly TMPDIR
export TMPDIR
export KDETMP="${TMPDIR}"

in a KDE Autostart directory script (or dotfile, or...)
prior to starting any konsole (multithreaded, so the first you start will
take precedent)

I'm just *this* far from replacing 'konsole' with a symlink to xfce Terminal,
(xfce4-terminal on Debian Wheezy)
which has many of the same features, but none of the misfeatures/bugs of 
konsole.
(at least that i've found yet)  (well, VTE, the engine xfce4-terminal uses does
use /tmp/vte* for scrollback buffering, even at 1,000 lines, or even 80, but
at least when you cut/paste, you get what you see, not a bunch of blanks at
the end of the line most of the time)

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


Re: [kde] term config prolem

2013-07-22 Thread Duncan
Stephen Dowdy posted on Mon, 22 Jul 2013 14:30:58 -0600 as excerpted:

> IIRC, konsole uses memory upto a certain point for scrollback, but uses
> /tmp file-on-disk after that.

Interesting.  I was unaware of that.  Good to know.  Thanks. (Not that it 
particularly matters for me, since TMP is on tmpfs here anyway, meaning 
it's all memory, but I've 16 gigs to play with and don't stay logged in /
that/ long, neither do I use the unlimited scrollback option, I had to 
look but it's 50 Kline, and I seldom have more than a half dozen terms 
open.)


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


Re: [kde] term config prolem

2013-07-22 Thread Duncan
Gene Heskett posted on Mon, 22 Jul 2013 14:29:31 -0400 as excerpted:

> Running Ubuntu 12.04.2 LTS, with enough kde pulled in to get kmail
> (which won't even start & no one has ever seen that error) the next
> biggest item stopping me from swapping drives and rebooting to it, is
> the fact that as the #1000 user, I cannot configure the Konsole.  I can,
> no errors are generated when I close the edit window, but my changes are
> not there when I re-open the edit current profile 3 seconds later.
> 
> Does anyone have a magic twanger to allow me to configure the Konsole to
> work as I need it?

I'd guess it's file perms somewhere along the line, probably on $KDEHOME/
share/config/konsolerc [1].  Ensure its UID/GID are set correctly and 
that it's writable by your user.

Of course I know some of your kmail history from earlier posts, but a bit 
after kmail akonadified, when I was jumping thru hoops to retrieve yet 
another lost mail due to akonadi, I asked myself why I had to deal with 
that, and decided I didn't, so now I don't.  I'm very happy on claws-mail 
now.  (And BTW, claws-mail has user-side script extensibility as a 
deliberate feature, so I expect you'd get along with it quite well too.  
The only downside is that switching can be a pain, but I'm /so/ glad I 
did, here.)


[1] If the var is unset, $KDEHOME defaults to ~/.kde as shipped by kde, 
but some distros change that to ~/.kde4 or something similar.

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


Re: [kde] Opening Konsole with Multiple Pre-loaded Tabs

2013-07-22 Thread Duncan
Jerome Yuzyk posted on Mon, 22 Jul 2013 11:02:27 -0600 as excerpted:

> I finally got it to work correctly after reading the Konsole source [2]
> for the function and would like to share how I use it to help fill in a
> little empty spot in the KDE documentation space.
> 
> I have a K Menu item configured to execute this command:
> 
> konsole --tabs-from-file /home/jerome/bin/konsole_Work
> 
> where /home/jerome/bin/konsole_Work is a text file that looks like this:
> 
>   title: Work;; workdir: ~/work;; command: vi _desk
>   title: root;; command: sudo -i sysfiles
>   title: bss-gate;; command: sshto gateway

> Each line of konsole_Work specifies a tab to open using up to 4 fields
> specifying how it is to open. Fields are delimited with ';;' and a field
> name must have a ':' appended.
> 
>   title:  a name for this tab, tab default if blank
>   workdir: working directory, ~ if blank
>   profile: a Konsole profile to use, the default if blank
>   command: a command to run

I see --tabs from file in konsole's --help output, but I would have had 
to guess or google the file's format.  Thanks.

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