Custom Folder Icon Sticky From Parent on Tab?

is there a way to make a custom folder icon sticky on the folder tab?

eg... im working with a obisidan markdown library in... user/Documents/Notes MD

using the folder properties i set a custom icon for 'Notes MD' using the windows properties panel.

and the tab shows....
image

when i do one folder deep from here the tab icon go to the default icon

is there a way to make that icon sticky from is parent location?

ive already done something similar for folder backgrounds using...

which is nice, would love it if theres a way to make a folder icon sticky to tab the way these images stick to a lister background.

x

You can use labels to change the icons using a wildcard, but those don't affect the icon shown in the folder tab, which is always the one Windows shows.

Windows doesn't have a way to recursively change icons on its side; it'd need to be done on each folder individually. That can be automated somewhat, by copying the hidden desktop.ini file the icon assignment is stored in, and setting the R attribute on the folder itself (but not the files in the folder), but is a bit of a pain and would also have to be re-done when new folders are created in the same place.

May I ask, is there a reason for that? I was also wondering why the icon from Labels is ignored by Tabs (same as by Preferences, but it's less of a trouble).

No reason other than it isn't plumbed in. I think making tabs support icons via labels is on our to-do list, but fairly low priority vs other items.

2 Likes

yeah i thought windows would get in the way of this before i asked.

good idea copying the desktop.ini into every folder would have to overwrite all them, but, hmmm yeah thatd be tricky to automate.

might try it thou.

and i way upvote! icon support for tabs! :smiley: please!!!!

im very visual, i go a bit nuts with icons for folders...

this is my 2nd "profile" style documents drive

dopus_2024-06-07_02-48-09PM_96x336

toolbars, menus, file types with wild cards, etc etc etc etc hahah

if it any help to revisit this idea of folder tab icons.

after of a couple days of tinkering with status bar codes i discovered this little gem of code which is working to show an icon that's sticky down through the dir.

not sure how it would translate to being used in place of the shell tab\folder icons via Preferences / Folder Tabs / Options

// drive letter & // custom location icons
{dlet}\
{h!{ifpath:"C:\Users\CLOUDEN\Documents\Notes MD(|\*)"}}{i:C:\xsysicons\icons extracted from software\obsidian logo 256x256.ico}{h!}
{h!{ifpath:"C:\Users\CLOUDEN\Documents\AutoHotkey(|\*)"}}{i:C:\xsysicons\tengo ico export\preferences-desktop-hotkeys keyboard-shortcuts_32x32.ico}{h!}
{h!{ifpath:"C:\Users\CLOUDEN\Downloads(|\*)"}}{i:C:\xsysicons\win10_shell32\imageres_184 download arrow down single layer 32x32.ico}{h!}

//template line for custom icons per-dir // duplicate, ....fill...., uncomment, & place in line above^^
//{h!{ifpath:"....paste forlder path here....(|\*)"}}{i:....paste path to icon here....}{h!}
{h!}

displays as...

image
image


at the moment
i have this as one a long run-on string of code
so there won't be | between C:\ and the :opusicon: e.g. ... ![image|67x29](upload://qapCVC35NvdG9qjTMj5jNBrRnx8.png)

but will probably have to get used to that. this string will become confusing if i break an icon by rename and have to hunt it down to fix it.

UPDATE... 02-20-2025

while this works... i don't recommend it now. once you start add a lot of custom icons in the status bar strings they start overlaping if your regex is not 100% spot on and its pain!

revisiting this months later...

for custom icons through all sub-directories shown on a the folder tab...

this may not be practical for everyone's use case or folder structure depending on the area your doing this.... BUT...

i made a AutoHotkey script that, when supplied a root\starting folder & an icon file, will create a desktop.ini for every sub-folder so they all have the some icon.


If anyone using AHK you can assign a hotkey to this snippet of code in your ahk script. which is what you see in the screen recording.

CAUTION NOTES...
I've only tested this with .ico files, use caution if your wanting to set an icon from a .dll or .exe. It should work thou the default icon # will be set to ,0, e.g. the very first icon in the file.
also...
Any existing desktop.ini files below the chosen folder will be erased before setting the custom icon. e.g. If you have set other custom options to that folders .ini via windows, such as view states, they will be reset.


setfoldericonsinallsubs:
; rootFolder := "C:\Users\CLOUDEN\test 1" ; Change this to your desired root folder
; iconPath := "C:\xsysicons\vs code icons ico\check white file_type_light_testcafe_32x32.ico" ; Change this to your desired icon file

FileSelectFolder, rootFolder, *c:\Users\%a_username%,6,Select A Folder
if !FileExist(rootfolder)
	{
	tooltip, ERR! @ Line:  %A_LineNumber% -- %A_scriptname%`n`nFolder Doesn't Exist! Opration Canceled.
	sleep 1500
	tooltip
	return	
	}

FileSelectFile, iconpath, 1, *%A_MyDocuments%, Select a Icon,
if ErrorLevel
	{
	;; todo, expand error check for acceptable icon types.
	tooltip, ERR! @ Line:  %A_LineNumber% -- %A_scriptname%`n`nA Icon File Must Be Selected! Operation Canceled.
	sleep 1500
	tooltip
	return	
	}

SetFolderIcons(rootFolder, iconPath)

; Re-Start Windows Explorer to apply changes
RunWait, ie4uinit.exe -show
RunWait, taskkill /F /IM explorer.exe
sleep 1000
Run, explorer.exe
return

SetFolderIcons(folder, icon) {
    iniFile := folder "\desktop.ini"
    
    ; Write desktop.ini with icon settings
    FileDelete, %iniFile% ; Ensure clean overwrite
    FileAppend, 
    (
    [.ShellClassInfo]
    IconResource=%icon%,0
    ), %iniFile%

    ; Make folder read-only and desktop.ini hidden/system
    FileSetAttrib, +R, %folder%
    FileSetAttrib, +SH, %iniFile%

    ; Loop through all subfolders
    Loop, %folder%\*, 2
        SetFolderIcons(A_LoopFileFullPath, icon)
}