dustinrue / ControlPlane

ControlPlane - context-sensitive computing for OS X
http://www.controlplaneapp.com
BSD 3-Clause "New" or "Revised" License
1.76k stars 180 forks source link

Only working when language is set to english? #432

Closed Metal-Snake closed 8 years ago

Metal-Snake commented 8 years ago

I want to turn on WiFi when no Thunderbolt Ethernet cable is connected and turn WiFi off when I connect the cable. But it just doesn't work. When I started to write this issue I changed the language to english to check for the english words to use here. The thing is, when set to english it works as expected, I just tried German and French, restarted ControlPlane and it doesn't work anymore.

This is on OS X El Capitan 10.11.1 with ControlPlane 1.6.1

I have set 2 rules in ControlPlane:

NetworkLink - Thunderbolt Ethernet link active - Context1 NetworkLink - Thunderbolt Ethernet link inactive - Context2

and 2 I have 2 Actions

ToggleWiFi - off - On arrival - Context1 ToggleWiFi - on - On arrival - Context2

2silver commented 8 years ago

I can confirm this issue.

OSX 10.11.2 ControlPlane 1.6.1

On default language (German) ControlPlane does nothing, if switching to English it is working as expected

Multiple Actions (Mount/Unmount Shares, Default Printer on specific IP-Adresses/Wlan SSIDs available)

dustinrue commented 8 years ago

You created the rules while running under German?

dustinrue commented 8 years ago

Can you issue defaults read com.dustinrue.ControlPlane | pbcopy and paste the results here. I have a feeling I know what it is. The rules are stored into the config based on the language you're in when the rule is created. If you change languages ControlPlane will never match because the lookup has the wrong key assigned. If that is the case I probably can't fix it as it's how the system is telling me about network interfaces depending on the language.

Metal-Snake commented 8 years ago

Yes, I created the rules while running under German. Didn't work when German was the active language, but when I changed to english those rules started to work.

{
    Actions =     (
                {
            context = "E65F8585-11FA-4DB3-B094-6FA225C1B183";
            delay = 0;
            description = einschalten;
            enabled = 1;
            parameter = 1;
            type = ToggleWiFi;
            when = Arrival;
        },
                {
            context = "DA4CB8A1-65B5-4D1E-87BC-A9126478DDD0";
            delay = 0;
            description = ausschalten;
            enabled = 1;
            parameter = 0;
            type = ToggleWiFi;
            when = Arrival;
        }
    );
    Contexts =     (
                {
            name = Kabel;
            parent = "";
            uuid = "DA4CB8A1-65B5-4D1E-87BC-A9126478DDD0";
        },
                {
            name = Automatic;
            parent = "";
            uuid = "F1EF45CF-A0A3-4D16-9E9B-ADC740BAEC53";
        },
                {
            name = WLAN;
            parent = "";
            uuid = "E65F8585-11FA-4DB3-B094-6FA225C1B183";
        }
    );
    "CrashReportSender.appVersion" = 73;
    "CrashReportSender.lastCrashDate" = "2015-10-10 12:33:18 +0000";
    DefaultContext = "E65F8585-11FA-4DB3-B094-6FA225C1B183";
    EnableAudioOutputEvidenceSource = 0;
    EnableIPAddrEvidenceSource = 1;
    EnableNetworkLinkEvidenceSource = 1;
    EnablePersistentContext = 0;
    EnablePowerEvidenceSource = 0;
    EnableRunningApplicationEvidenceSource = 0;
    "EnableSleep/WakeEvidenceSource" = 1;
    EnableTimeOfDayEvidenceSource = 0;
    EnableUSBEvidenceSource = 0;
    EnableWiFiEvidenceSource = 1;
    "NSTableView Columns Preferences/Actions" =     (
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 04747970 6586>,
        80,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 0b646573 63726970 74696f6e 86>,
        105,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 04776865 6e86>,
        104,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 07636f6e 74657874 86>,
        76,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 0564656c 617986>,
        76
    );
    "NSTableView Columns Preferences/Rules" =     (
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 06737461 74757386>,
        15,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 04747970 6586>,
        136,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 0b646573 63726970 74696f6e 86>,
        269,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 07636f6e 74657874 86>,
        82,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 0a636f6e 66696465 6e636586>,
        121
    );
    "NSTableView Hidden Columns Preferences/Actions" =     (
    );
    "NSTableView Hidden Columns Preferences/Rules" =     (
    );
    "NSTableView Sort Ordering Preferences/Actions" =     (
    );
    "NSTableView Sort Ordering Preferences/Rules" =     (
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 07636f6e 74657874 86>,
        1
    );
    "NSToolbar Configuration com.apple.NSColorPanel" =     {
        "TB Is Shown" = 1;
    };
    "NSView Size Preferences/Rules" = <040b7374 7265616d 74797065 6481e803 84014084 8484074e 5356616c 75650084 84084e53 4f626a65 63740085 84012a84 840b7b43 4753697a 653d6464 7d9681d9 02811c01 86>;
    Rules =     (
                {
            confidence = 1;
            context = "DA4CB8A1-65B5-4D1E-87BC-A9126478DDD0";
            description = "Thunderbolt Ethernet link active";
            negate = 0;
            parameter = "+Thunderbolt Ethernet";
            type = NetworkLink;
        },
                {
            confidence = 1;
            context = "E65F8585-11FA-4DB3-B094-6FA225C1B183";
            description = "Thunderbolt Ethernet link inactive";
            negate = 0;
            parameter = "-Thunderbolt Ethernet";
            type = NetworkLink;
        }
    );
    SUEnableAutomaticChecks = 1;
    SULastCheckTime = "2016-01-04 18:30:45 +0000";
    UseDefaultContext = 1;
    userHasSeenMultipleActiveContextsNotification = 1;
}

(edited formatting)

2silver commented 8 years ago
{
    Actions =     (
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "cinema";
            enabled = 1;
            parameter = "afp://share/cinema";
            type = Mount;
            when = Arrival;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "cinema";
            enabled = 1;
            parameter = "afp://share/cinema";
            type = Unmount;
            when = Departure;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "home";
            enabled = 1;
            parameter = "afp://share/home";
            type = Mount;
            when = Arrival;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "home";
            enabled = 1;
            parameter = "afp://share/home";
            type = Unmount;
            when = Departure;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "dokumente";
            enabled = 1;
            parameter = "afp://share/dokuments";
            type = Mount;
            when = Arrival;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "dokumente";
            enabled = 1;
            parameter = "afp://share/dokuments";
            type = Unmount;
            when = Departure;
        },
                {
            context = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
            delay = 0;
            description = foo;
            enabled = 1;
            parameter = "smb://10.0.0.7/foo";
            type = Mount;
            when = Arrival;
        },
                {
            context = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
            delay = 0;
            description = foo;
            enabled = 1;
            parameter = "smb://10.0.0.7/foo";
            type = Unmount;
            when = Departure;
        },
                {
            context = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
            delay = 0;
            description = "Print_SW";
            enabled = 1;
            parameter = "Print_SW";
            type = DefaultPrinter;
            when = Arrival;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "share";
            enabled = 1;
            parameter = "afp://share/share";
            type = Mount;
            when = Arrival;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "share";
            enabled = 1;
            parameter = "afp://share/share";
            type = Unmount;
            when = Departure;
        },
                {
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            delay = 0;
            description = "LaserJet";
            enabled = 1;
            parameter = "LaserJet";
            type = DefaultPrinter;
            when = Arrival;
        }
    );
    AllowMultipleActiveContexts = 1;
    Contexts =     (
                {
            iconColor = <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 84046666 666683a8 d7c53e83 3bca3d3f 835a768d 3d0186>;
            name = home;
            parent = "";
            uuid = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
        },
                {
            iconColor = <040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016303 84026666 000186>;
            name = work;
            parent = "";
            uuid = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
        }
    );
    "CrashReportSender.appVersion" = 73;
    "CrashReportSender.lastCrashDate" = "2015-12-28 11:49:12 +0000";
    DefaultContext = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
    EnableActiveApplicationEvidenceSource = 1;
    EnableActiveContextEvidenceSource = 1;
    EnableMountedVolumeEvidenceSource = 1;
    EnableNetworkLinkEvidenceSource = 1;
    EnablePersistentContext = 0;
    "EnableSleep/WakeEvidenceSource" = 1;
    EnableTimeOfDayEvidenceSource = 1;
    EnableWiFiEvidenceSource = 1;
    MinimumConfidenceRequired = "0.8046875";
    NSColorPanelMode = 4;
    "NSTableView Columns Preferences/Actions" =     (
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 04747970 6586>,
        134,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 0b646573 63726970 74696f6e 86>,
        264,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 04776865 6e86>,
        147,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 07636f6e 74657874 86>,
        76,
        <040b7374 7265616d 74797065 6481e803 84014084 8484084e 53537472 696e6701 8484084e 534f626a 65637400 8584012b 0564656c 617986>,
        224
    );
    "NSTableView Hidden Columns Preferences/Actions" =     (
    );
    "NSTableView Sort Ordering Preferences/Actions" =     (
    );
    "NSToolbar Configuration com.apple.NSColorPanel" =     {
        "TB Is Shown" = 1;
    };
    "NSView Size Preferences/Actions" = <040b7374 7265616d 74797065 6481e803 84014084 8484074e 5356616c 75650084 84084e53 4f626a65 63740085 84012a84 840b7b43 4753697a 653d6464 7d968196 03819d01 86>;
    PersistentContext = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
    Rules =     (
                {
            confidence = 1;
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            description = serenity;
            negate = 0;
            parameter = serenity;
            type = "WiFi SSID";
        },
                {
            confidence = 1;
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            description = "10.0.0.3,255.255.255.255";
            negate = 0;
            parameter = "10.0.0.3,255.255.255.255";
            type = IP;
        },
                {
            confidence = "0.4677459278185884";
            context = "CF40EA10-D20E-44C5-B6DD-15AD5EF40779";
            description = "Acer AL1951";
            negate = 0;
            parameter = 44353;
            type = Monitor;
        },
                {
            confidence = 1;
            context = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
            description = "WLAN";
            negate = 0;
            parameter = "WLAN";
            type = "WiFi SSID";
        },
                {
            confidence = "0.7";
            context = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
            description = "10.222.100.2,255.255.255.255";
            negate = 0;
            parameter = "10.222.100.2,255.255.255.255";
            type = IP;
        },
                {
            confidence = "0.6022555443548387";
            context = "EE2B9DDC-5F96-4ED4-AA4E-A8616A513FAD";
            description = SyncMaster;
            negate = 0;
            parameter = 1236;
            type = Monitor;
        }
    );
    SUEnableAutomaticChecks = 1;
    SULastCheckTime = "2016-01-06 11:25:00 +0000";
    menuBarOption = 2;
    userHasSeenMultipleActiveContextsNotification = 1;
}
dustinrue commented 8 years ago

After some testing locally I found that the rules were indeed created using English. If I switch my system to German and create the rules they are created properly. The issue is that under English the interface is called "Thunderbolt Ethernet" but under German it's referred to, by the system, as "Thunderbolt-Ethernet." The configuration file will store the location translation for the interface and will use that to compare it to the available interfaces at run time.

Metal-Snake commented 8 years ago

Nope, my rules were created using German. I'm 100% certain. I just don't know how to prove that to you. Any ideas?

2silver commented 8 years ago

My rules were also created using German Settings:
German GUI:
I installed/created all my rules - > nothing worked Switch to English GUI Only changed language settings in OSX, do nothing in Controlplane -> rules work