regnarg / urxvt-config-reload

43 stars 13 forks source link

Retrieve xresources by parsing xrdb output #21

Closed qualiaa closed 3 years ago

qualiaa commented 3 years ago

This is a moderately large change which removes config-print and instead parses the output of xrdb -query directly. I think this is a desirable change, but it may break some things.

Fixes #20: though I'm not entirely sure what the root cause of #20 is.

rnhmjoj commented 3 years ago

Seems to work fine.

Barbaross93 commented 3 years ago

I can make a separate issue for this if need be, but for some reason the background/foreground colors dont get updated. I'm not sure of this is from these specific changes themselves or something else within the plugin. I'm using your fork @qualiaa by the way.

qualiaa commented 3 years ago

@Barbarossa93 If you could raise an issue on my fork with the output of your xrdb -query that would be great - if it's related to these changes I'll add the fix to this PR.

Barbaross93 commented 3 years ago

It looks like issues are disabled at your fork. Nonetheless, the output of xrdb -query is:

Xft.dpi:    96
Xft.antialias:  1
Xft.autohint:   0
Xft.hinting:    1
Xft.hintstyle:  hintfull
Xft.rgba:   rgb
Xft.lcdfilter:  lcddefault
URxvt.font: -spectrum-berry-medium-r-normal-sans-11-80-75-75-m-50-iso10646-1, xft:tewihm:size=9:antialias=false, xft:Cozette:size=9:antialias=false, xft:SijiPlus:size=9:antialias=false, xft:Kochi Gothic:size=9:antialias=true, xft:Hack Nerd Font Mono:size=7.5:antialias=true:minspace=false, xft:Twemoji:size=7:antialias=true
URxvt.boldFont: -spectrum-berry-bold-r-normal--11-80-75-75-m-50-iso10646-1, xft:tewihm:size=9:antialias=false, xft:Cozette:size=9:antialias=false, xft:SijiPlus:size=9:antialias=false, xft:Kochi Gothic:size=9:antialias=true, xft:Hack Nerd Font Mono:size=7.5:antialias=true:minspace=false, xft:Twemoji:size=7:antialias=true
URxvt.italicFont:   
URxvt.boldItalicFont:   
*.foreground:   #5c6a72
*.background:   #f8f0dc
*.cursorColor:  #5c6a72
*.color0:   #efead4
*.color8:   #999f93
*.color1:   #f85552
*.color9:   #f85552
*.color2:   #8da101
*.color10:  #8da101
*.color3:   #dfa000
*.color11:  #dfa000
*.color4:   #3a94c5
*.color12:  #3a94c5
*.color5:   #df69ba
*.color13:  #df69ba
*.color6:   #35a77c
*.color14:  #35a77c
*.color7:   #5c6a72
*.color15:  #5c6a72
URxvt.borderColor:  #f8f0dc
URxvt.depth:    24
URxvt*lineSpace:    0
URxvt*letterSpace:  0
URxvt.iso14755: false
URxvt.iso14755_52:  false
URxvt*geometry: 80x24
URxvt.scrollBar:    false
URxvt*loginShell:   true
URxvt.internalBorder:   44
URxvt.skipBuiltinGlyphs:    false
URxvt.perl-ext: default,matcher,selection-to-clipboard,keyboard-select,tabbedex,searchable-scrollback,newterm,config-reload
URxvt.url-launcher: linkhandler
URxvt.matcher.button:   1
URxvt.keysym.M-r:   perl:matcher:last
URxvt.keysym.S-C-U: perl:matcher:list
URxvt.keysym.M-l:   perl:matcher:select
URxvt.saveLine: 10000
URxvt.cursorBlink:  true
URxvt.cursorUnderline:  true
URxvt*inheritPixmap:    false
URxvt*transparent:  false
URxvt.termName: rxvt-unicode-256color
URxvt*scrollTtyOutput:  false
URxvt*scrollWithBuffer: true
URxvt*scrollTtyKeypress:    true
URxvt.keysym.Control-l: command:\033c
URxvt.keysym.Control-Shift-T:   perl:newterm
URxvt.keysym.Shift-Up:  command:\033]720;1\007
URxvt.keysym.Shift-Down:    command:\033]721;1\007
URxvt.secondaryScreen:  1
URxvt.secondaryScroll:  0
URxvt.secondaryWheel:   1
URxvt.keysym.Control-Meta-c:    builtin-string:
URxvt.keysym.Control-Meta-v:    builtin-string:
URxvt.keysym.Shift-Control-V:   eval:paste_clipboard
URxvt.keysym.Shift-Control-C:   eval:selection_to_clipboard
URxvt.keyboard-select.clipboard:    true
URxvt.keysym.C-S-Escape:    perl:keyboard-select:activate
URxvt.keysym.Control-Shift-S:   perl:keyboard-select:search
URxvt.tabbedex.autohide:    true
URxvt.tabbedex.tabbar-fg:   2
URxvt.tabbedex.tabbar-bg:   0
URxvt.tabbedex.tab-fg:  3
URxvt.tabbedex.tab-bg:  0
URxvt.tabbedex.no-tabbedex-keys:    true
URxvt.keysym.Control-t: perl:tabbedex:new_tab
URxvt.keysym.Control-Tab:   perl:tabbedex:next_tab
URxvt.keysym.Control-Shift-Tab: perl:tabbedex:prev_tab
URxvt.keysym.Control-Shift-Left:    perl:tabbedex:move_tab_left
URxvt.keysym.Control-Shift-Right:   perl:tabbedex:move_tab_right
URxvt.keysym.Control-Shift-R:   perl:tabbedex:rename_tab
xterm.vt100.termName:   xterm-256color
xterm.vt100.scaleHeight:    1.0
XTerm.vt100.geometry:   80x32
xterm.vt100.internalBorder: 44
xterm.vt100.borderWidth:    0
XTerm*loginshell:   true
XTerm*savelines:    16384
XTerm*charClass:    33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48
XTerm.vt100.metaSendsEscape:    true
xterm.vt100.utf8:   true
XTerm.vt100.locale: false
xterm.vt100.scrollBar:  false
xterm.vt100.cursorBlink:    true
xterm.vt100.selectToClipboard:  true
xterm.vt100.trimSelection:  true
xterm.vt100.renderFont: true
xterm.vt100.wideChars:  true
xterm.vt100.visualBell: false
xterm.vt100.forceBoxChars:  true
xterm.vt100.font-linedrawing:   true
XTerm.vt100.backarrowKey:   false
XTerm.ttyModes: erase ^?
*VT100*translations:    #override Shift <Btn1Up>: exec-formatted("linkhandler '%t'", PRIMARY)
xterm.vt100.translations:   #override \n Shift Ctrl <KeyPress> v:insert-selection(CLIPBOARD) \n Shift Ctrl <KeyPress> c:select-set(CLIPBOARD)
XTerm*limitFontsets:    50
XTerm*faceSize: 9
XTerm*faceName: xft:berry
xterm.vt100.faceNameDoublesize: Kochi Gothic, Symbola
xterm.vt100.assumeAllChars: true
XTerm*cjkWidth: false
XTerm*scrollTtyOutput:  false
st.tabspaces:   4
st.borderpx:    44
qualiaa commented 3 years ago

Ah, I just mindlessly implemented the most common Xresources syntax. I'll fix the implementation for hierarchies this weekend (and I'll throw in the ? operator).

Hopefully I won't have to implement a full parser but the BNF is in man XrmGetDatabase if it comes to it...

Barbaross93 commented 3 years ago

If I understand you correctly, I wrote my settings incorrectly in terms of how the extension parses for them? What would work for now? Something like URxvt.background: #323d43 instead of *.background: #323d43?

I understand that you intend to improve on the parsing mechanism, but I'm fine with a quick rewrite of my settings just to get it to work for the moment.

qualiaa commented 3 years ago

@Barbarossa93 for now . isn't supported at all, you can do *background or URxvt*background.

Barbaross93 commented 3 years ago

Brilliant, thanks!

regnarg commented 3 years ago

I created the hack with config-print precisely because I did not want to deal with the all the corner cases of parsing the resource database. But it seems like the best hotfix so far. Perhaps in the future one could create a C helper that would call XResourceManagerString, XrmGetStringDatabase and XrmGetResource directly. This seems to be a good starting point: https://gist.github.com/dcat/05dc5d45e8c60f2645da

rnhmjoj commented 3 years ago

Incidentally I've submitted a patch to xorg-devel that, if accepted, will allow to query individual resources: like xrdb -get URxvt.internalBorder. So, in the future you'll hopefully be able to just use this.

qualiaa commented 3 years ago

@Barbarossa93 what can I say - long weekend. FInally got around to this in #22 , if you care enough to test it :)