Bug 66737 - Add shortcuts for all sessions
Summary: Add shortcuts for all sessions
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 57794 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-28 08:42 UTC by Mikolaj Machowski
Modified: 2004-12-17 07:57 UTC (History)
1 user (show)

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


Attachments
Allows user to create shortcuts for Session entries. (3.26 KB, patch)
2004-11-29 07:19 UTC, Kurt Hindenburg
Details
Allows user to create shortcuts for Session entries. (5.24 KB, patch)
2004-11-30 19:17 UTC, Kurt Hindenburg
Details
Allows user to create shortcuts for Session entries. (6.01 KB, patch)
2004-12-14 19:28 UTC, Kurt Hindenburg
Details
Allows user to create shortcuts for Session entries. (8.30 KB, patch)
2004-12-16 08:07 UTC, Kurt Hindenburg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikolaj Machowski 2003-10-28 08:42:49 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

These are often used actions and deserve theirs own shortcuts.
Comment 1 Stephan Kulow 2004-08-03 16:40:55 UTC
*** Bug 57794 has been marked as a duplicate of this bug. ***
Comment 2 Michal Pasternak 2004-11-29 01:22:06 UTC
I'd also like user-defined shortcuts for a given sessions - even if those shortcuts hide the ones, that terminal application requires. This is a pretty useful option! Think about it, developers :^)
Comment 3 Kurt Hindenburg 2004-11-29 07:19:59 UTC
Created attachment 8475 [details]
Allows user to create shortcuts for Session entries.

Hard part was getting the shortcuts to work when makeGUI hadn't been called
yet.  I'll need to look at this again...

All the shortcuts are off by default.
Comment 4 Kurt Hindenburg 2004-11-30 19:17:04 UTC
Created attachment 8496 [details]
Allows user to create shortcuts for Session entries.

This seperates the loading of Sessions and the creation of the menus.  This
patch will load all the .desktop files upon startup; which will obviously slow
things down.  I don't see a way around this unless the shortcuts are read and
checked to see if any of them are for Sessions.
Comment 5 Kurt Hindenburg 2004-12-01 16:16:04 UTC
With 7 .desktops loaded, I get a time.elapsed of 7 msecs for the code in Comment #4.  This 'seems' to be decent.
Comment 6 Waldo Bastian 2004-12-01 16:39:02 UTC
Well, yes, but it will be a lot more if they are not 'hot' in the diskcache and the disk actually has to seek for each one of them.
Comment 7 Mikolaj Machowski 2004-12-01 18:55:52 UTC
It would be great to have it implemented.
Thanks Kurt :)

Comment 8 Kurt Hindenburg 2004-12-01 19:15:47 UTC
Comment #6:  Yes, I didn't think about that... how do you remove the files from the 'cache' to test the full time?
Comment 9 Kurt Hindenburg 2004-12-01 19:33:33 UTC
Well, anyway, there are only 2 ways to do this:
1. Read all the .desktops at startup (comment #4)
2. Read the shortcuts; search through them looking for 'session shortcuts' (simple enough, preprend 'SessionSC' to the shortcut names and search for that); if any are found; read all the .desktops; reread the shortcuts.  I have code for this as well.

Perhaps #2 is better?
Comment 10 Kurt Hindenburg 2004-12-02 06:30:52 UTC
Comment #9 point 2 doesn't work.  readShortcuts() ignores any shortcuts it doesn't know about.  So unless someone explains another way, the patch in #4 is the only way I know to do this...
Comment 11 Kurt Hindenburg 2004-12-14 19:28:08 UTC
Created attachment 8662 [details]
Allows user to create shortcuts for Session entries.

Yikes, this patch is getting big/complex.  Anyway, this should be it.  The
.desktop files are only loaded if the user has a shortcut to a session entry.
I would like to commit this before the 3.4 freeze... please look/test it.
Comment 12 Mikolaj Machowski 2004-12-15 00:35:10 UTC
> Yikes, this patch is getting big/complex.  Anyway, this should be it. 
> The .desktop files are only loaded if the user has a shortcut to a
> session entry. I would like to commit this before the 3.4 freeze...
> please look/test it.

That's it :) Many, many thanks.

But there are major problems with adding and removing of sessions:
- when adding section list of available shortcuts isn't updated. New
  sessions are visible only in new instance of Konsole. Acceptable, but
  :/

- complete mess when removing sessions. They are still visible in
  session shortcuts, in pop-up window with possible endings of
  shortcuts, and after completion results are unexpected: looks like
  unexpected shift in array. After restart everything works.

Asking for file with schema has any sense?
If user for example remove .deskop extension has it some bad
consequences, same question for main name?

At the end layman question: wouldn't be easier just assigning shortcuts
in session configuration dialog?

Comment 13 Kurt Hindenburg 2004-12-15 06:30:40 UTC
The adding/removing of sessions is something I've overlooked.

1. The overall problem is the loading of the .desktop files; previously it is done when the user opens the menu or clicks on any button that generates a menu.  This is too late for the session shortcuts.
2.  The sessions are defined in .desktop files... that's the way they always will be.
3. Even if the assigning of the shortcuts are in the session config, the .desktop files have to be loaded at konsole startup to be useable (see #1).

I'll look at this again later today...
Comment 14 Mikolaj Machowski 2004-12-15 23:40:11 UTC
> 1. The overall problem is the loading of the .desktop files; previously
> it is done when the user opens the menu or clicks on any button that
> generates a menu.  This is too late for the session shortcuts. 
Sorry, forgot about that.
> 2.  The sessions are defined in .desktop files... that's the way they
> always will be. 
I am not questioning this. Just don't see any sense with allowing user
to mess with this. Forget about that - this is thing for another bug/wish.

Comment 15 Kurt Hindenburg 2004-12-16 08:07:37 UTC
Created attachment 8688 [details]
Allows user to create shortcuts for Session entries.

The creating/deleting sessions problem should be fixed.
Please test this fully...
Comment 16 Mikolaj Machowski 2004-12-17 00:18:52 UTC
> The creating/deleting sessions problem should be fixed.
> Please test this fully...

Works really pretty now. But still one thing :)
- new session, Vim (calling vim)
- assign shortcut 'Ctrl-L,V'
- remove session with name Vim
- create session with the same name 'Vim' old shortcut is automatically
  reassigned; even after restart of Konsole.

Looks like patch doesn't remove shortcut assignments and they are
automatically recalled when session with that name is visible again.

Things go astray when:
- new session, Vim (calling vim)
- assign shortcut 'Ctrl-L,V'
- remove session with name Vim
- create new session 'top' (with top command)
- assign shortcut 'Ctrl-L,V'
- create new-old session 'Vim'

No crashes but after pressing 'Ctrl-L,V' Konsole doesn't know what to
do.

Comment 17 Kurt Hindenburg 2004-12-17 06:44:57 UTC
Thanks for testing it; I'll apply this patch Friday unless there is objection.  I'll fix the problem you noticed.
Comment 18 Kurt Hindenburg 2004-12-17 07:57:35 UTC
CVS commit by hindenburg: 

BUG: 66737
Allows user to assign shortcuts to Sessions entries (.desktop files).


  M +111 -17   konsole.cpp   1.490
  M +6 -0      konsole.h   1.188