Change background color for active / inactive panes

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
FitzWM
Junior Member
Junior Member
Posts: 6
Joined: 2018-01-30, 16:03 UTC

Change background color for active / inactive panes

Post by *FitzWM »

Hi,

I'm considering switching to Total Commander from xplorer2, due to the latter's update pricing and poor HiDPI support, and I love the free edition so far, except for one thing. Despite scouring the options - particularly the "Color" section - I can't find any way to color the active and inactive panels independently. I figured out how to change the panel background globally, but that just changes every pane to the same background.

I use Windows Magnifier 95% of the time (very poor vision) so it's nice to be able to tell which pane I'm in, even without being able to see the box around the selected file. xplorer2 allows me to do this, and I didn't realize how much I relied on the feature until I no longer had it.

Anyone willing to help the noob sort this out? I'm also open to other ways to make the active panel obvious, if the color thing just isn't possible.
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

Re: Change background color for active / inactive panes

Post by *tuska »

FitzWM wrote:... I can't find any way to color the active and inactive panels independently. ...
Hi,
that's possible.

Start with:
Configuration - Options - View Mode - Add...

Continue with:
viewtopic.php?p=337070#337070

So you would have to make
- 2 View Modes (Color1 for left panel, Color2 for right panel)
- 3 Buttons recommended
FitzWM
Junior Member
Junior Member
Posts: 6
Joined: 2018-01-30, 16:03 UTC

Post by *FitzWM »

Hey, thanks for the tip! That definitely got me looking in the right direction, but it appears that Total Commander doesn't support multiple commands in one hotkey, e.g., Change to inactive color -> Change focus to other panel -> Change to active color. Fortunately, a couple custom commands and an AutoHotKey script solved it completely. For reference:

I used these custom commands:

Code: Select all

em_viewPaneI    # cm_SrcViewModeList PaneI (inactive panel color) bound to Alt+J
cm_FocusTrg     # cm_FocusTrg (switch to other panel) bound to Alt+K
em_viewPaneA    # cm_SrcViewModeList PaneA (active panel color) bound to Alt+L
And this AutoHotKey script:

Code: Select all

; totalcmd.ahk
; This script sets up a contextual pane background for Total Commander.

#MaxHotkeysPerInterval 1000
#NoEnv
#SingleInstance, Force

SendMode Input
SetTitleMatchMode, 3                ; Forces complete matches for window titles.
SetWorkingDir %A_ScriptDir%         ; Sets consistent working directory.

#IfWinActive ahk_exe TOTALCMD64.EXE

; Macro. Press Tab to activate inactive panel color, swap panels, and activate
; active panel color.
Tab::SwapTCPane()

SwapTCPane()
{
	Send, !j
	Send, !k
	Send, !l
	Return
}
The script simply calls the three hotkeys for "Change current panel to inactive color", "Move focus to other panel", and "Change current panel to active color", in order. As it's a script, the change happens instantaneously, just like in xplorer2. So, a little work, but perfectly usable.

Thanks again for the help![/code]
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

Post by *tuska »

FitzWM wrote:... it appears that Total Commander doesn't support multiple commands in one hotkey, e.g.,
Change to inactive color -> Change focus to other panel -> Change to active color.
Internal commands can be combined up from Total Commander 9.0 as follows:

Code: Select all

em_viewPaneI,cm_FocusTrg,em_viewPaneA
F1 - Help: 1.b. What's new in this version?
Ctrl + F -> search: combine (see example): Internal commands
FitzWM
Junior Member
Junior Member
Posts: 6
Joined: 2018-01-30, 16:03 UTC

Post by *FitzWM »

Oh, nice! I tried pipes and semicolons, but didn't think to try commas, duh. Thanks again.
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

Keep background color for active/inactive panel

Post by *tuska »

For me, it does not quite open up, as you have managed with the AHK script, always to deposit the active panel
and the inactive panel with different colors, after you have pressed the Tab key.
Whereby I assume that the active window should always have the same color.

EDIT:
I think I have found a solution to this point: viewtopic.php?p=337453#337453
FitzWM
Junior Member
Junior Member
Posts: 6
Joined: 2018-01-30, 16:03 UTC

Post by *FitzWM »

Hey, I managed to get it working as intended with something similar to the thread you posted, and the color change works flawlessly using Tab. I'm very happy, but there is one more thing I'd like to do, if it's possible. Can I tell TC to run a command upon the first click in the inactive panel? What I want is for the color change to go through both when I tab to the other panel and when I click into it. If this is beyond the TC command engine, that's fine; it's just icing on the cake. Still, I thought I'd ask your opinion.
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

Post by *tuska »

FitzWM wrote:Can I tell TC to run a command upon the first click in the inactive panel?
Not to my knowledge.
FitzWM wrote:What I want is for the color change to go through both when I tab to the other panel and when I click into it.
Not with the Tab key, but you can use a shortcut for an em_command or a button for this.
That means, that whenever the active or inactive panel is called, the button must be clicked or the shortcut used.

In my opinion, there are only 3 restrictions on this topic that need to be considered:
1. With a mouse-click in the other panel can not be achieved that background colors will be changed (how should that work?)
2. The same applies to the Tab key
3. A consistency of the background color can be achieved, but only with the exception of the color for the column headings

See here: viewtopic.php?p=337453#337453 (detailed description!)
FitzWM
Junior Member
Junior Member
Posts: 6
Joined: 2018-01-30, 16:03 UTC

Post by *FitzWM »

Well, I've already gotten it to work with Tab by creating this custom command:

Code: Select all

cm_SrcViewModeList PaneI,cm_FocusTrg,cm_SrcViewModeList PaneA
where PaneI is the inactive pane view mode and PaneA is the active pane v iew mode. I then bound the command it to Tab, replacing the default behavior of, "Switch to other pane," with, "Change pane to inactive color, switch to other pane, change pane to active color." This works perfectly, and the color changes are so fast that they appear instantaneous to my eyes.

As to the mouse click, I'm not sure how it might be implemented. I suppose the program could detect the first click in a pane and allow commands to be bound to that event. I know that xplorer2 has an option to "eat the first click" in a pane, for example. But that could require rewriting the whole pane system, for all I know.
User avatar
tuska
Power Member
Power Member
Posts: 4118
Joined: 2007-05-21, 12:17 UTC

Post by *tuska »

FitzWM wrote:Well, I've already gotten it to work with Tab by creating this custom command:

Code: Select all

cm_SrcViewModeList PaneI,cm_FocusTrg,cm_SrcViewModeList PaneA
I think we talk at cross purposes. Did you mean a button?

For the above command, e.g. "cm_FocusTrg 4006 Focus on target file list" you need a button or an em_command with shortcut.
You cannot use the Tab key (left of the letter "Q" on the keyboard). Or do I understand anything wrong?

Anyway - if you have adapted the above example to your purposes, then everything is OK.
Post Reply