3

I am trying to style gv using my ~/.Xdefaults file, its working fine for other applications, but not for gv, I am able to set the background to gray:

gv*background: gray

But this gives all elements that gray background, and that is not what I want, the "canvas" or paper is also gray for instance. I would like to apply my "styling" more precisely, but I can not find any information about the resources related to the look and feel of gv, I have read the gv manual, and the info and man page, I have looked in ~/.gv but so far, nothing useful

If I use editres (X11) to try and see the resources and widgets used by gv, I only get widgets related to the menu, not the rest of the application. I have also tried xprop, etc.

editres output:

GV gv VendorShellExt shellext Aaa control MButton fileButton SimpleMenu menu ThreeD threeD SmeBSB open SmeBSB reopen SmeBSB savepos SmeBSB update SmeLine line SmeBSB printAllPages SmeBSB printMarkedPages SmeBSB saveAllPages SmeBSB saveMarkedPages SmeLine line SmeBSB copyright SmeLine line SmeBSB quit MButton stateButton SimpleMenu menu ThreeD threeD SmeBSB stop SmeBSB dsc SmeBSB eof SmeBSB antialias SmeBSB watchFile SmeBSB size SmeLine line SmeBSB optionsgv SmeBSB optionsgs SmeBSB optionsfs SmeBSB optionssetup SmeLine line SmeBSB presentation MButton pageButton SimpleMenu menu ThreeD threeD SmeBSB next SmeBSB redisplay SmeBSB prev SmeLine line SmeBSB center SmeLine line SmeBSB current SmeBSB odd SmeBSB even SmeBSB unmark MButton orientationButton SimpleMenu menu ThreeD threeD SmeBSB automatic SmeLine line SmeBSB portrait SmeBSB landscape SmeBSB upsidedown SmeBSB seascape SmeLine line SmeBSB swap MButton pagemediaButton SimpleMenu menu ThreeD threeD SmeBSB automatic SmeLine line SmeBSB BBox SmeBSB Letter SmeBSB Legal SmeBSB Statement SmeBSB Tabloid SmeBSB Ledger SmeBSB Folio SmeBSB Quarto SmeBSB 10x14 SmeBSB 14x24 SmeBSB Executive SmeBSB A3 SmeBSB A4 SmeBSB A5 SmeBSB B4 SmeBSB B5 MButton processButton MButton scaleButton SimpleMenu menu ThreeD threeD SmeBSB Natural size SmeBSB Pixel based SmeLine line SmeBSB Fit height to window SmeBSB Arbitrary magnification SmeBSB Fit width to window SmeBSB Fit to window SmeBSB 0.100 SmeBSB 0.125 SmeBSB 0.250 SmeBSB 0.500 SmeBSB 0.707 SmeBSB 1.000 SmeBSB 1.414 SmeBSB 2.000 SmeBSB 4.000 SmeBSB 8.000 SmeBSB 10.00 Button nextPage Button prevPage Button toggleCurrent Button toggleEven Button toggleOdd Button unmarkAll Button printMarked Button printAll Button saveMarked Button saveAll Button openFile Button autoResize Button redisplay MButton titleButton SimpleMenu menu ThreeD threeD SmeBSB title MButton dateButton SimpleMenu menu ThreeD threeD SmeBSB date Label locator Frame pannerFrame Composite panner Label slider Frame newtocFrame Clip newtocClip Aaa newtocControl Vlist newtoc Scrollbar newtocScroll Frame viewFrame Clip viewClip Aaa viewControl Ghostview page TransientShell fileSelPopup VendorShellExt shellext FileSelection fileSel Button rescan MButton filters SimpleMenu menu ThreeD threeD SmeBSB None SmeBSB *.*ps* *.pdf* no .* SmeBSB *.*ps* no .* SmeBSB *.pdf* no .* SmeBSB no .* MButton dirs SimpleMenu menu ThreeD threeD SmeBSB Home SmeBSB Tmp SmeBSB /usr/doc SmeBSB /usr/local/doc Button button1 Button button2 Frame pathframe Text pathtext AsciiSrc textSource AsciiSink textSink Frame filterframe Text filtertext AsciiSrc textSource AsciiSink textSink Frame topframe Clip topclip Aaa topaaa Vlist list Scrollbar subscroll Frame subframe Clip subclip Aaa subaaa Vlist list Scrollbar curscroll Frame curframe Clip curclip Aaa curaaa Vlist list 
4
  • Can you give an example of a widget that you can't locate via editres or can't change the background color of? Note that editres lets you dump the widget tree to a file. Commented Dec 30, 2024 at 13:23
  • I have added the output of editres :) Commented Dec 30, 2024 at 14:39
  • Thanks. But what is it you want to change the color of? Commented Dec 30, 2024 at 14:41
  • I would like the basic interface to be gray, but I would like the "canvas" or paper to remain white, if I do gv*background: gray, then every widget is gray, including the "paper" Commented Dec 30, 2024 at 14:42

2 Answers 2

2

Using strace on gv shows that is opens the application defaults file /usr/share/gv/gv_system.ad, on my system. In there we can see

GV*Ghostview.background: white GV*Ghostview.foreground: black 

The class GV is less specific than the name gv, so setting gv*background: gray overrides it. Simply add gv*Ghostview.background: white or use GV instead of gv in your original setting.

1

If you want all but the viewFrame to have a gray background, you can do:

gv*background: gray gv*viewFrame*background: white 

In your widget tree, that's:

GV gv [...] Aaa control [...] Frame viewFrame Clip viewClip Aaa viewControl Ghostview page [...] 

(gv.control.viewFrame). You can be even more specific with gv.control.viewFrame.viewClip.viewControl.page, which leaves the controls gray in there. Compare:

screenshot with viewFrame white screenshot with only page white

6
  • I have tried setting: gv.control.viewFrame.viewClip.viewControl.page: white gv.control.viewFrame.viewClip.viewControl.page.background: white gv*control*viewFrame*viewClip*viewControl*page: white gv*control*viewFrame*viewClip*viewControl*page.background: white None of them seems to work, I have reloaded my .Xdefaults file Commented Dec 30, 2024 at 18:26
  • Does gv -xrm 'gv*background: gray' -xrm 'gv*viewFrame*background: white' work for you? Note that ~/.Xdefaults (or rather ~/.Xdefaults-hostname) is meant to be read by applications on start-up. Though you can load the resources defined there in the X server you're connecting to as well with xrdb. Commented Dec 30, 2024 at 18:30
  • Yes, gv -xrm ... does work, I will try to restart X Commented Dec 30, 2024 at 18:33
  • What's the output of xrdb -q | grep -i background? Commented Dec 30, 2024 at 18:33
  • gv*background: gray gv*control*viewFrame*viewClip*viewControl*page*background: white The more specific setting, to avoid the context menu being white, does not work, though Commented Dec 30, 2024 at 18:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.