Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Icon for odin.exe

Open Hyrtwol opened this issue 2 years ago • 10 comments

Wanted to explore how Odin was handling windows resources and luckily it was very easy :) For testing I ended up adding 2 icons to Odin.exe (based on the emblem in artwork) and kinda liked it and thought it was worth sharing. This can maybe also serve as a "self test" of the resource feature. btw really nice we don't have to call the rc tool and it just build-in. Both icon files only contain a 16x16 and 32x32 to keep them small 3.5 KB as they are embedded in the exe. I used the 2nd icon for .odin files. It made the compiler stand out nicely :) But this is ofc only interesing on windows so I understand this might not be the time for things like this ;) odin_with_icon

Hyrtwol avatar Jun 22 '23 18:06 Hyrtwol

Here is what it looks like when you run odin_filereg.bat

>misc\odin_filereg.bat -add
Odin file registration
ODIN_ROOT=C:\dev\odin\Odin
Writeing C:\dev\odin\Odin\odin.bat

C:\dev\odin\Odin>reg add "HKCR\Odin.File" /ve /d "Odin source file" /f 
The operation completed successfully.


C:\dev\odin\Odin>reg add "HKCR\.odin" /ve /d "HKCR\Odin.File" /f 
The operation completed successfully.


C:\dev\odin\Odin>if true == true (
reg add "HKCR\Odin.File\DefaultIcon" /d "%ODIN_ROOT%\odin.exe,1" /t REG_EXPAND_SZ /f  
 reg add "HKCR\Odin.File\shell" /f  
 reg add "HKCR\Odin.File\shell\run" /ve /d "Odin Run" /f  
 reg add "HKCR\Odin.File\shell\run\command" /d "%ODIN_ROOT%\odin.bat run \"%w\"" /t REG_EXPAND_SZ /f 
) 
The operation completed successfully.

The operation completed successfully.

The operation completed successfully.

The operation completed successfully.


C:\dev\odin\Odin>if true == true (
reg add "HKCR\Folder\shell\odin" /v "MUIVerb" /d "Odin" /f  
 reg add "HKCR\Folder\shell\odin" /v "subcommands" /d "" /f  
 reg add "HKCR\Folder\shell\odin" /v "Icon" /d "%ODIN_ROOT%\odin.exe,0" /t REG_EXPAND_SZ /f  
 
) 
The operation completed successfully.

The operation completed successfully.

The operation completed successfully.


C:\dev\odin\Odin>(
reg add "HKCR\Folder\shell\odin\Shell\build" /d "build" /f  
 reg add "HKCR\Folder\shell\odin\Shell\build\command" /d "%ODIN_ROOT%\odin.bat build \"%1\"" /t REG_EXPAND_SZ /f 
) 
The operation completed successfully.

The operation completed successfully.


C:\dev\odin\Odin>(
reg add "HKCR\Folder\shell\odin\Shell\run" /d "run" /f  
 reg add "HKCR\Folder\shell\odin\Shell\run\command" /d "%ODIN_ROOT%\odin.bat run \"%1\"" /t REG_EXPAND_SZ /f 
) 
The operation completed successfully.

The operation completed successfully.


C:\dev\odin\Odin>(
reg add "HKCR\Folder\shell\odin\Shell\check" /d "check" /f  
 reg add "HKCR\Folder\shell\odin\Shell\check\command" /d "%ODIN_ROOT%\odin.bat check \"%1\"" /t REG_EXPAND_SZ /f 
) 
The operation completed successfully.

The operation completed successfully.

Hyrtwol avatar Jun 25 '23 10:06 Hyrtwol

Added 3 command so far. Not sure if this is too clunky to be useful? :p image

Hyrtwol avatar Jun 25 '23 10:06 Hyrtwol

We may want to check that ODIN_ROOT is set to something before adding the registry entries, or people will have a broken context menu with no clue why it doesn't work.

Kelimion avatar Jun 25 '23 13:06 Kelimion

I'll rethink this and get back with a better "solution" I think we have enough in sys/windos to code this in odin instead of using .reg files.

Hyrtwol avatar Jul 30 '24 17:07 Hyrtwol