<commit_before>define( [ "nwGui", "nwWindow", "ember" ], function( nwGui, nwWindow, Ember ) {

	var get = Ember.get;

	return Ember.Object.extend({

		init: function( name, icon ) {
			this.setProperties({
				name: name,
				icon: icon,
				tray: null,
				menu: this._buildMenu()
			});
		},


		remove: function() {
			if ( this.tray ) {
				this.tray.remove();
				this.tray = null;
			}
		},

		add: function( click ) {
			this.tray = this._buildTray();
			this.tray.on( "click", click );
		},


		iconRes: function() {
			var dpr = window.devicePixelRatio;
			var res = process.platform !== "darwin" || dpr > 2
				? 48
				: dpr > 1
					? 32
					: 16;
			return get( this, "icon" ).replace( "{res}", res );
		}.property( "icon" ),

		_buildTray: function() {
			var tray = new nwGui.Tray({
				icon   : get( this, "iconRes" ),
				tooltip: get( this, "tooltip" )
			});
			tray.menu = get( this, "menu" );
			tray.iconsAreTemplates = false;
			return tray;
		},

		_buildMenu: function() {
			var menu = new nwGui.Menu();

			menu.append( new nwGui.MenuItem({
				label: "Toggle visibility",
				click: function() {
					this.tray.emit( "click" );
				}.bind( this )
			}) );

			menu.append( new nwGui.MenuItem({
				label: "Close application",
				click: function() {
					nwWindow.close();
				}
			}) );

			return menu;
		}<commit_msg>Fixed broken tray icon tooltip of prev commit<commit_after>define( [ "nwGui", "nwWindow", "ember" ], function( nwGui, nwWindow, Ember ) {

	var get = Ember.get;

	return Ember.Object.extend({

		init: function( name, icon ) {
			this.setProperties({
				name: name,
				icon: icon,
				tray: null,
				menu: this._buildMenu()
			});
		},


		remove: function() {
			if ( this.tray ) {
				this.tray.remove();
				this.tray = null;
			}
		},

		add: function( click ) {
			this.tray = this._buildTray();
			this.tray.on( "click", click );
		},


		iconRes: function() {
			var dpr = window.devicePixelRatio;
			var res = process.platform !== "darwin" || dpr > 2
				? 48
				: dpr > 1
					? 32
					: 16;
			return get( this, "icon" ).replace( "{res}", res );
		}.property( "icon" ),

		_buildTray: function() {
			var tray = new nwGui.Tray({
				icon   : get( this, "iconRes" ),
				tooltip: get( this, "name" )
			});
			tray.menu = get( this, "menu" );
			tray.iconsAreTemplates = false;
			return tray;
		},

		_buildMenu: function() {
			var menu = new nwGui.Menu();

			menu.append( new nwGui.MenuItem({
				label: "Toggle visibility",
				click: function() {
					this.tray.emit( "click" );
				}.bind( this )
			}) );

			menu.append( new nwGui.MenuItem({
				label: "Close application",
				click: function() {
					nwWindow.close();
				}
			}) );

			return menu;
		}
{'fraction_non_alphanumeric': 0.17015034836817014, 'fraction_numerical': 0.005867253392005867, 'mean_word_length': 2.4974358974358974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2317651', 'n_tokens_mistral': 1257, 'n_tokens_neox': 979, 'n_words': 241}