Bug 486641

Summary: Add ability to pin a file such that it is available in each open session in the left (or right) most tab position
Product: [Applications] kate Reporter: Allen Winter <winter>
Component: sessionsAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Allen Winter 2024-05-05 19:29:59 UTC
This is a wish
I have a Notes text file where I jot down important notes, todos, reminders, etc. etc that I have open all the time for easy, fast access.   I also have many sessions  associated with all the different projects I work on.  

Every time I open a session (or create a new session) it would be great if my Notes file was opened automatically to the leftmost (or right-most) tab.

multiple pinned files would be added consecutively to in order left-to-right (or right-to-left) before the files contained in the session

something like that.

Every time I create a new session the first thing I do is open the Notes file and then save the session.  but it would be nice if kate would do that for me.
Comment 1 Waqar Ahmed 2025-08-20 21:40:42 UTC
Git commit 471e1e278dddd514d3a8a84fb24a12f86d1032fc by Waqar Ahmed.
Committed on 20/08/2025 at 07:21.
Pushed by waqar into branch 'master'.

Allow pinnning documents

Document pinning allows a user to pin one or more document such that the
said documents are automatically opened in every session/window. This
can be useful for example for people who do their task management using
simple txt files and just want that file to be automatically opened. See
the linked bug. Perhaps there are other usecases.

The implementation is quite simple. The pinned documents are stored as
urls inside KateDocManager. When kate exits, these urls are stored in
the global config. The urls are opened after the view restoration inside
of KateViewManager is done. A pinned document will have a "pin" icon
instead of its mimetype-icon (unless its modified).

A document can be pinned/unpinned in 2 ways:
1. Right click a tab, then click "Pin Document"
2. Open command bar (Ctrl+Alt+I), then search for "pin document"

A convenience action "Open Next Pinned Document" is available in the
command bar (can be added to the toolbar), which will take the user
to the next pinned document.

Pinned tabs don't have any special behaviour apart from the icon. You
can close them, move them etc. This makes the implementation simpler.
If we disallow closing a document or try to keep pinned documents in
certain positions things get complicated quickly because then we need
to think about cases when the tabs are limited or when we try to reuse
tabs. Note that, closing a pinned document doesn't "unpin" it. It is
still pinned.

M  +52   -0    apps/lib/katedocmanager.cpp
M  +13   -0    apps/lib/katedocmanager.h
M  +17   -0    apps/lib/katemainwindow.cpp
M  +3    -0    apps/lib/katetabbar.cpp
M  +32   -0    apps/lib/kateviewmanager.cpp
M  +1    -0    apps/lib/kateviewmanager.h
M  +16   -0    apps/lib/kateviewspace.cpp

https://invent.kde.org/utilities/kate/-/commit/471e1e278dddd514d3a8a84fb24a12f86d1032fc