X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BB3B385087B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1692359363; bh=dlxRAlbKyYj4qToUzIb+t9wTGn2esT58fNWtWiB4cTA=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=tI9bsTeFLr9w1ZP73DqitRrJfsByE+d/YaEMbxOp7qv7fQH7E7/Vb80HG34V5HIxU xOwejtkgx/WjGOgEucHcOVc7kdoyOKJh3mUGXDdft4x+lprYYTCaQQ/b3Wwx0d0ji9 ih9wbEE39QBUGuUY6UZ9OQaUzd6/lUFfSjCZ1nk4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2671D3858401 Date: Fri, 18 Aug 2023 13:48:47 +0200 To: cygwin AT cygwin DOT com Subject: Re: Cygwin console: Different default background color when terminal runs as Admin? Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 37IBnOiH003240 On Aug 18 11:51, Martin Wege via Cygwin wrote: > On Fri, Aug 18, 2023 at 7:27 AM Jonathon Merz via Cygwin > wrote: > > > > On Thu, Aug 17, 2023 at 7:13 PM Martin Wege via Cygwin > > wrote: > > > > > Just an idea: Could the default background color of the Cygwin console > > > be changed from black to grey (or RED) if the terminal has been > > > started with Administrator rights? > > > > > > > Assuming that: > > 1. The Administrators group is called "Administrators" > > 2. There aren't any non-administrative groups with "Administrators" in the > > name > > 3. You're using mintty for your terminal > > > > You can run the following in bash or zsh with the desired RGB values: > > > > if [[ `id -Gn` == *Administrators* ]] > > then > > echo -ne "\e]11;#FFBBEE\a"; > > fi > > > > Looking at the output of /usr/bin/id -a was my first guess too. But > this fails quickly because the names are localized. Seriously MS runs > the Windows group names through the l10n wringer!! So what works on > Windows for Germany will surely fail for Windows for Japan. Thus I am > looking for a more portable solution. > > Maybe the numeric group ids are more 'portable' across the Windows > versions for different countries? Admin group is always Windows SID 1-5-32-544 and gid 544 in Cygwin, unless somebody overloads the gid values via an /etc/group file. If you want to be really sure, you have to check every numeric gid returned by `id -G' if it resolves to SID 1-5-32-544. You can do this with the getent(1) tool. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple