You are not logged in.

#1 2005-05-23 01:19:00

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

getting current terminal background color

is there any way to retrieve the current background color in the active terminal (xterm/konsole/whatever)? preferably in c.

tnx.

Offline

#2 2005-05-23 05:52:14

Kern
Member
From: UK
Registered: 2005-02-09
Posts: 464

Re: getting current terminal background color

z4ziggy
You could grab  xtermcontrol
then
xtermcontrol --get-bg

Sorry not much clue with C but i think theres a function http://www.freepascal.org/docs-html/rtl … tattr.html

that may point in right direction.
good luck
Kern

Offline

#3 2005-05-23 08:42:27

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: getting current terminal background color

tnx for the reply.

seems xterminfo just gets stuck under my xorg, had to kill it. also, it seems it retrieves xterm info only, and im looking for more common way to retrieve bg color from any possible terminal.
the link (tccgetattr) is for a freePascal function, which grabs terminal info - but no background either...

still looking...

Offline

#4 2005-05-23 14:58:36

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: getting current terminal background color

in C it wouldn't be that hard, however it gets difficult when you talk about different WMs...
Basically, you iterate over each top level window (the frame)... but you'd need a way to determin which child of the fram is the application (the title bar, buttons, and possibly status bar are all children as well).
Then you just call a "property get" on the app window...
the main difficulty is going to be different window managers...

Offline

#5 2005-05-24 07:08:03

z4ziggy
Member
From: Israel
Registered: 2004-03-29
Posts: 573
Website

Re: getting current terminal background color

well, tnx for that phrakture.
i think im gonna do a quick "bail out" and force my own background color on the terminal instead of drowning in an unknown and unrelated code... (/me raises the lazy flag)

Offline

Board footer

Powered by FluxBB