Jump to content

Clover Theme Manager


blackosx
 Share

589 posts in this topic

Recommended Posts

Thanks. I've updated the repo with the revised files.

 

Note: The repo, which I thought to have fixed, is still not 100% as it used to be with regard to the bare git repos for each theme. I will try to find time to look at it again. As a result, any installed themes will be flagged again with updates available.

 

EDIT:

After some changes and testing today I am happy to have a working server-side post-update script which seems to do what I think it needs to do. CloverThemeManager should now correctly report a theme update when a theme is amended.  Sorry for all the false-positives for updates that anyone's been seeing recently. If anyone has updates for themes showing then please click update them to clear the notification.

 

Good.

 

Anyways,

I just noticed something weird. When I put this theme along with other themes in "/ESP/CLOVER/themes" and set it as default theme; then boot to Clover GUI; If I then go to "Themes" section of the Bootloader GUI (in "Options"), I can't go back to OS Selection page. The bootloader gets stuck -_- 

Are you getting similar problem ? Or is it just me ?!

Link to comment
Share on other sites

No I don't see that here. All works fine.

 

For the issue you see, please confirm it happens when you:

1 - select options>themes and then you cannot return to the main screen by pressing escape? or

2 - select options>themes, delete existing theme entry and type the name of another installed theme followed by escape?

Link to comment
Share on other sites

hmm.. interesting.

 

Please can you enable debug mode and post the log file so I can see what’s happening?

 
To enable debug mode:
- Edit CloverThemeManager.app/Contents/Resources/public/bash/shared.sh
- Change line #46 from DEBUG=0 to DEBUG=1
- Save the file
 
Get the log file
- Run Clover Theme Manager
- While the app is running, go to /tmp/CloverThemeManager and copy CloverThemeManagerLog.txt
 
Post the CloverThemeManagerLog.txt.
 
Thanks
Link to comment
Share on other sites

 

hmm.. interesting.

 

Please can you enable debug mode and post the log file so I can see what’s happening?

 
To enable debug mode:
- Edit CloverThemeManager.app/Contents/Resources/public/bash/shared.sh
- Change line #46 from DEBUG=0 to DEBUG=1
- Save the file
 
Get the log file
- Run Clover Theme Manager
- While the app is running, go to /tmp/CloverThemeManager and copy CloverThemeManagerLog.txt
 
Post the CloverThemeManagerLog.txt.
 
Thanks

 

 

Log attached

Thanks

CloverThemeManagerLog.txt

Link to comment
Share on other sites

if help you can add a button somewere to do that from the app:

 

 

- (IBAction)removeThemeHtml:(id)sender

{

    NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:

                      @"Library/Application Support/CloverThemeManager/theme.html"];

    

    NSError *error;

    

#if __has_feature(objc_arc)

    // working in ARC

    NSAlert* alert = [[NSAlert alloc] init];

#else

    // non ARC

    NSAlert* alert = [[[NSAlert alloc] init] autorelease];

#endif

    

    if ([[NSFileManager defaultManager] fileExistsAtPath:path])

    {

        [[NSFileManager defaultManager] removeItemAtPath:path error:&error];

        

        if (!error)

        {

            [alert setMessageText: @"theme.html deleted, click OK to reload.."]; //or tell user to restart the app

            [alert addButtonWithTitle: @"OK"];

            [alert runModal];

            

            // here the code to reload the interface

        }

        else

        {

            [alert setMessageText: @"theme.html was found but an error is encountered deleting the file.."];

            [alert addButtonWithTitle: @"OK"];

            [alert runModal];

        }

    }

    else

    {

        [alert setMessageText: @"theme.html was not present!"];

        [alert addButtonWithTitle: @"OK"];

        [alert runModal];

    }

}

 

 

like a reset.. just connect the action to a button in Interface Builder..

 

EDIT

code tested  :) (can work with ARC enabled or not..)

 

EDIT II
 
that is the same with code to relauch the application after deleting theme.html:

 

 

- (IBAction)removeThemeHtml:(id)sender

{

    NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:

                      @"Library/Application Support/CloverThemeManager/theme.html"];

    

    NSError *error;

    

#if __has_feature(objc_arc)

    // working in ARC

    NSAlert* alert = [[NSAlert alloc] init];

#else

    // non ARC

    NSAlert* alert = [[[NSAlert alloc] init] autorelease];

#endif

    

    if ([[NSFileManager defaultManager] fileExistsAtPath:path])

    {

        [[NSFileManager defaultManager] removeItemAtPath:path error:&error];

        

        if (!error)

        {

            [alert setMessageText: @"theme.html deleted,\nclick \"relauch\" to restart Clover Theme Manager"];

            [alert addButtonWithTitle: @"relauch"];

            [alert runModal];

            [self relaunch];

        }

        else

        {

            [alert setMessageText:

             @"theme.html was found but an error is encountered deleting the file.\n\nclick \"relauch\" to restart Clover Theme Manager.."];

            [alert addButtonWithTitle: @"relauch"];

            [alert runModal];

            [self relaunch];

        }

    }

    else

    {

        [alert setMessageText: @"theme.html was not present,\nclick \"relauch\" to restart Clover Theme Manager"];

        [alert addButtonWithTitle: @"relauch"];

        [alert runModal];

        [self relaunch];

    }

    [self relaunch];

}

 

- (void) relaunch

{

    int processIdentifier = [[NSProcessInfo processInfo] processIdentifier];

    NSString *myPath = [NSString stringWithFormat:@"%s",

                        [[[NSBundle mainBundle] executablePath] fileSystemRepresentation]];

    [NSTask launchedTaskWithLaunchPath:myPath arguments:[NSArray

                                                         arrayWithObject:[NSString stringWithFormat:@"%d",

                                                                          processIdentifier]]];

    [NSApp terminate:self];

 

}

 

 

  • Like 1
Link to comment
Share on other sites

Imported to the app the code from previous post.

 

- connected the reset action to the app menu (the app clean the theme.html and relaunch itself)

- connected the showLog to "Show log" in the app menu

- small change in shared.sh in WriteToLog() func

- some warnings removed (remain 5 of it)

 

if you like, 

Edited by Micky1979
app removed
  • Like 1
Link to comment
Share on other sites

Thank you for the welcome additions/changes Micky1979. I have much to learn when it comes to objective-C and you demonstrate a good understanding of how it all pieces together.

 

I will look at your submission and see what can be used.

 

Regards

  • Like 1
Link to comment
Share on other sites

Thank you @blackosx.

 

However after the first attempt, I improved how the app is relaunched through more sophisticated and recommended way: an embedded secondary app that thinks of doing this really well.
Please tell me what you think!  (to tell the truth is cool :lol: ...IMHO)
 
EDIT
if you want delete some other files generated by the app, just tell me what.. atm only theme.html is removed.
..also corrected "relauch" to "relaunch"..
 
EDIT II
the "Tool" menu... is a funcy name, just have no other words to call it, but just dowble click to edit it in Interface Builder to change as you like, and of course if you like.

 
Edited by Micky1979
app removed
  • Like 1
Link to comment
Share on other sites

Fantastic! That works great.  :)

I will digest your changes whilst double checking all that needs to be done for a proper reset before creating an updated version.

 

Thanks.

 

For ref, I already had the open log menu option under theme CloverThemeManager menu.

Link to comment
Share on other sites

For ref, I already had the open log menu option under theme CloverThemeManager menu.

OMG sorry, only found the funcion not connected in Interface Builder (IBAction mean that you want do that) and not expected under "CloverThemeManager" menu ..not seen until now.

 

Yea,  more actions can be added to "reset" the app, and I was just thinking to add a delay (0.5/1 second) to reopen the app... just to let finish some children working process (like the .sh scripts) from the previous execution, simply because they probably are running on another thread different from the main one, I suppose that they need some milliseconds in more to be killed (actually the process to reopen is really fast).

Link to comment
Share on other sites

No problem.

I’ve now moved the Relaunch menu option to also be under the CloverThemeManager menu.
 
Yes, the bash script does indeed exit once it detects the process ID of the main CloverThemeManager.app has terminated so a delay would be very useful. As it currently is, without a delay, testing this morning on three different machines results in the app relaunching cleanly 99% of the time. But adding a delay would be very useful just incase the system is under load. Can you make it 1 second just to be safe?
 
I have changed your reset function to this:
- (IBAction)reset:(id)sender
{
    NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:
                      @"Library/Application Support/CloverThemeManager/theme.html"];
    
    NSError *error;
    
#if __has_feature(objc_arc)
    // working in ARC
    NSAlert* alert = [[NSAlert alloc] init];
#else
    // non ARC
    NSAlert* alert = [[[NSAlert alloc] init] autorelease];
#endif
    
    [alert setMessageText: @"Please confirm you wish to Clear and Relaunch Clover Theme Manager"];
    [alert addButtonWithTitle: @"Clear and Relaunch"];
    [alert addButtonWithTitle: @"Cancel"];
    if ([alert runModal] == NSAlertFirstButtonReturn) {
        NSLog (@"User chose to Clear and Relaunch.");
        
        if ([[NSFileManager defaultManager] fileExistsAtPath:path])
        {
            [[NSFileManager defaultManager] removeItemAtPath:path error:&error];
            
            if (!error)
            {
                [self relaunch];
            }
            else
            {
                NSLog (@"Clear and Relaunch: failed to remove theme.html.");
                [self relaunch];
            }
        }
        else
        {
            NSLog (@"Clear and Relaunch: theme.html was not present.");
            [self relaunch];
        }
        
    }
    else
    {
        NSLog (@"User clicked Cancel to Clear and Relaunch.");
    }
}
  • Like 1
Link to comment
Share on other sites

Good!

 

script.sh produce this error: [: ==: unary operator expected at line 2064

 

changed to

if [ "${gLastSelectedPartitionGUID}" == "${zeroUUID}" ]; then

just double quoting solve the problem

 

Another idea is to delete temporary files using the relaunch.app, why? after CTM is closed these/those files are surely unlocked (not busy by CTM), better.

Anyway deleting all temporary files and the  Application Support/CTM dir made the app in a 100% working state  each time:

 

Relaunch.m

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    NSError *error;
    // deleting temporary files from the previous execution:
    if ([[NSFileManager defaultManager] fileExistsAtPath:@"/private/tmp/CloverThemeManager"])
    {
        [[NSFileManager defaultManager] removeItemAtPath:@"/private/tmp/CloverThemeManager" error:&error];
        
        if (error) NSLog(@"Problem encountered deleting /private/tmp/CloverThemeManager directory.\n");
    } else
    {
        NSLog(@"/private/tmp/CloverThemeManager directory not found.\n");
    }
    
    // deleting ~/Library/Application Support/CloverThemeManager
    error = nil;
    NSString *AppSupportPath = [NSHomeDirectory() stringByAppendingPathComponent:
                                @"Library/Application Support/CloverThemeManager"];
    
    if ([[NSFileManager defaultManager] fileExistsAtPath:AppSupportPath])
    {
        [[NSFileManager defaultManager] removeItemAtPath:AppSupportPath error:&error];
        
        if (error) NSLog(@"Problem encountered deleting ~/Library/Application Support/CloverThemeManager directory.\n");
    }
    else
    {
        NSLog(@"~/Library/Application Support/CloverThemeManager directory not found.\n");
    }
    
    // relaunch CloverThemeManager after one second
    [self performSelector:@selector(relaunch) withObject:nil afterDelay:1.0];
}

- (void)relaunch
{
    NSString *myBundlePath = [[NSBundle mainBundle] bundlePath];
    
    NSString *ThemeManagerPath = [[[myBundlePath stringByDeletingLastPathComponent]
                                   stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
    NSLog(@"Relaunching %@\n", ThemeManagerPath);
    [[NSWorkspace sharedWorkspace] launchApplication:ThemeManagerPath];
    [NSApp terminate:self];
}

If you want take a look this is what I do (with your changes about "cancel" the reset):CloverThemeManagerApp.zip

 

EDIT

 

delay added

  • Like 1
Link to comment
Share on other sites

Thanks for the update Micky1979. I'll take a look in a bit and let you know.

 

But I like the idea of using the relaunch app to remove the /tmp files though for ref, I wish to retain the Application Support/CloverThemeManager dir as that stores the downloaded items and bare-git repo's of the installed themes. This saves re-downloading the index.git (theme.plists and screenshots) as long as there has not been a change on the repo and the theme.git's are used to git fetch against to pull any updates from the repo. The bash script manages these items and deletes them when they're no longer required.

Link to comment
Share on other sites

Not really a problem, just delete what is not necessary:

/*
    // deleting ~/Library/Application Support/CloverThemeManager
    error = nil;
    NSString *AppSupportPath = [NSHomeDirectory() stringByAppendingPathComponent:
                                @"Library/Application Support/CloverThemeManager"];
    
    if ([[NSFileManager defaultManager] fileExistsAtPath:AppSupportPath])
    {
        [[NSFileManager defaultManager] removeItemAtPath:AppSupportPath error:&error];
        
        if (error) NSLog(@"Problem encountered deleting ~/Library/Application Support/CloverThemeManager directory.\n");
    }
    else
    {
        NSLog(@"~/Library/Application Support/CloverThemeManager directory not found.\n");
    }
    */

EDIT
I can see two updates, BGM and Pandora (THX carbo :D )


Another thing, I see that the project has the "deployment target" set to 10.8 not 10.7, confirm?

  • Like 2
Link to comment
Share on other sites

script.sh produce this error: [: ==: unary operator expected at line [/size]2064[/size]

 

changed to

if[/size] [ [/size]"${gLastSelectedPartitionGUID}"[/size] == [/size]"${zeroUUID}"[/size] ]; [/size]then[/size]

just double quoting solve the problem

Good spot. Thanks.

 

Not really a problem, just delete what is not necessary:

Of course :)

 

Another thing, I see that the project has the "deployment target" set to 10.8 not 10.7, confirm?

It should be 10.7.

I did have a build which worked on 10.6 but I had issue with some objective-C JSON function which wasn't supported on 10.6 which stopped it from working properly.

  • Like 1
Link to comment
Share on other sites

It should be 10.7.

Check it on the repo, is 10.8

MACOSX_DEPLOYMENT_TARGET = 10.8;

http://sourceforge.net/p/cloverefiboot/themes/ci/master/tree/CloverThemeManagerApp/CloverThemeManager/CloverThemeManager.xcodeproj/project.pbxproj

 if you change CTM to 10.7 be sure relaunch.app it has inherited the same settings

Link to comment
Share on other sites

 Share

×
×
  • Create New...