             defaults.setDouble(switchInterval, forKey: udkSwitchInterval)
         }
         intervalSlider.doubleValue = switchInterval
-        print(switchInterval);
+        print(switchInterval)
 
-        let desktopWindowNumber = getDesktopWindowNumber();
+        let desktopWindowNumber = getDesktopWindowNumber()
 
         NSEvent.addGlobalMonitorForEventsMatchingMask(.ScrollWheelMask, handler: { event in
 

            desktopWindowNumber = winDict["kCGWindowNumber"] as! Int
        }
    }
    return desktopWindowNumber;
}

func postKeyboardEvent(keyCode: CGKeyCode, keyDown:Bool, controlKeyDown:Bool, shiftKeyDown:Bool) {
    let src = CGEventSourceCreate(CGEventSourceStateID.HIDSystemState)
    let keyEvent = CGEventCreateKeyboardEvent(src, keyCode, keyDown)

    if controlKeyDown && shiftKeyDown {
        CGEventSetFlags(keyEvent,
            // there should be a better way...
            CGEventFlags(rawValue: (CGEventFlags.MaskControl.rawValue | CGEventFlags.MaskShift.rawValue))!);
    }
    else if controlKeyDown {
        CGEventSetFlags(keyEvent, CGEventFlags.MaskControl);
    }
    else if shiftKeyDown {
        CGEventSetFlags(keyEvent, CGEventFlags.MaskShift);
    }

    let location = CGEventTapLocation.CGHIDEventTap

    CGEventPost(location, keyEvent);
}

extension NSEventModifierFlags {

    func isSet(flag: NSEventModifierFlags) -> Bool {
        return self.rawValue & flag.rawValue == flag.rawValue
    }

}



    @IBAction func sliderChanged(sender: AnyObject) {
        let value = sender.doubleValue
        print(value)
        switchInterval = value
        self.defaults.setDouble(switchInterval, forKey: udkSwitchInterval)
    }

