Let T = T ri(A, M, B) be a triangular algebra where A is a unital algebra, B is an algebra which is not necessarily unital, and M is a faithful (A, B)-bimodule which is unital as a left A-module. In this paper, under some mild conditions on T , we show that if φ : T → T is a linear map satisfying A, B ∈ T , AB = P =⇒ φ([A, B]) = [A, φ(B)] = [φ(A), B], where P is the standard idempotent of T , then φ = ψ + γ where ψ : T → T is a centralizer and γ : T → Z(T ) is a linear map vanishing at commutators [A, B] with AB = P whrere Z(T ) is the center of T . Applying our result, we characterize linear maps on T that behave like generalized Lie 2-derivations at idempotent products as an application of above result. Our results are applied to upper triangular matrix algebras and nest algebras.