Giter Site home page Giter Site logo

urxvt-font-size's People

Contributors

grandchild avatar majutsushi avatar polynomial avatar rom1detroyes avatar step- avatar wodesuck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

urxvt-font-size's Issues

Why so complicated?

There's increase, incglobal, incsave, two different ways to access them...

why not just a bind for CtrlShift+ and CtrlShift- ?

Jump to specific size

I use this plugin a lot. When I do, I always jump in steps of four. Scale up four steps, and scale back when I'm done. Everything else just looks weird.

So, since I just jump between these two, is there any way to jump directly to a specified font size? If not, maybe adding a step-size option or something that defines that this font only jumps that many steps.

Either way, thanks for a great little plugin!

unable to calculate font width for 'DejaVu Sans Mono-16:slant=0:weight=100:antialias=True:minspace=True'

I have the following font config (while playing around with the config):

URxvt.font: xft:Ubuntu Mono:pixelsize=14:style=regular,
terminus-14,
xft:DejaVu Sans Mono:size=12,
xft:Ubuntu Mono for Powerline

After increasing the font size twice using urxvt-font-size, I see:

urxvt: unable to calculate font width for 'DejaVu Sans Mono-16:slant=0:weight=100:minspace=True', ignoring.

This appears to be related to using pixelsize with the base font, but size for the 3rd one.

The config does not make sense really, but might indicate some bug or missing feature in urxvt-font-size.

Font size problem when specifying different fonts with different sizes in .Xresources

Hi,

In my .Xresources, I have:

URxvt*font: xft:DejaVu Sans Mono:style=Regular:size=8:antialias=true:hinting=true,xft:Helvetica Neue:size=7:antialias=true:hinting=true

To fetch special UTF-8 characters such as emojis from Helvetica Neue.

I had to manually set a different size for both fonts as Helvetica is larger than its normal size and urxvt does not display characters then.

If I increase the font size with this plugin, it seems like same font size is applied to both fonts and then every character fetched from Helvetica is removed from output.

Thanks

XFT fonts may be specified without `pixelsize`

Another valid way to specify an XFT font is to use xft:DejaVu Sans Mono-8. This has not the same effect as using pixelsize. Here is a slight modification of your plugin to work with this notation (I am not very proficient with Perl, feel free to come with another solution):

    foreach my $piece (@pieces) {
        if ($piece =~ /(pixelsize=|[^=-]*?)(\d+)/) {
            $size = $2;

            if ($basesize != 0) {
                $new_size = $basesize;
            } else {
                $new_size = ($change > 0 ? ($size + 1) : ($size - 1));
            }

            $piece =~ s/$size/$new_size/;
        }
        push @resized, $piece;
    }

Reset to Default Size?

I've been using this extension for a while, and it's great for temporarily magnifying the terminal when I want to show someone something. Except that it's not temporary. Is there any way to include a binding which would reset the font size to the default?

Outdated version

Hello,

I have different variable names on my source code (user commands are known as "bigger","smaller", etc...)
It seems to be an outdated version because it doesn't work.
The package name is "urxvt-resize-font-git" and i downloaded-it on Archlinux User Repositories.
Is it right? If that's it, could you please update this version?

Regards
Buridan

Can this be called externally?

First of all, very nice script, thanks

Is there a way to call it inside another script provided the script is running inside urxvt?

second reset call breaks terminal

HI,
Thanks you for awesome plugin. I noticed that if I call reset multiple times everything disappear from terminal window. To fix that I had to change font size or resize terminal. Will appreciate any hint.

I use

dnf list installed | grep rxvt          
rxvt-unicode.x86_64                       9.22-8.fc28                   @fedora 
rxvt-unicode-256color-ml.x86_64           9.22-8.fc28                   @fedora 

>  dnf info rxvt-unicode-9.22-8.fc28.x86_64 
Last metadata expiration check: 3:20:34 ago on Fri 06 Jul 2018 09:59:53 AM +03.
Installed Packages
Name         : rxvt-unicode
Version      : 9.22
Release      : 8.fc28
Arch         : x86_64
Size         : 3.0 M
Source       : rxvt-unicode-9.22-8.fc28.src.rpm
Repo         : @System
From repo    : fedora
Summary      : Unicode version of rxvt
URL          : http://software.schmorp.de/
License      : GPLv3
Description  : rxvt-unicode is a clone of the well known terminal emulator rxvt,
             : modified to store text in Unicode (either UCS-2 or UCS-4) and to
             : use locale-correct input and output. It also supports mixing
             : multiple fonts at the same time, including Xft fonts.

reset font size

It is often handy to have a binding that sets your font size back to the original size (i.e. before you increase/decrease).

For instance, I sometimes increase my font size when I invite a collegue over to look at my screen. The number of times I press C-up depends on how close he is to the screen. Then when the interaction is over I have to hit C-down multiple times until I get back the "original" size.

This is available in "other" terminals such as gnome-terminal or terminal.app in osx.

Increasing also increases urxvt window geometry

I use floating wm (openbox), not tiling, so i open urxvt on a fixed geometry size, but when i use this script, increasing also increases the size of the window, is there any way for me to deactivate this, and increasing only the font size? (Like what happens in alacritty, for example, only the font becomes bigger (or smaller), not the window itself together)

Edit: attached a gif for demo

simplescreenrecorder-2019-03-20_23 05 18

How to fix on a monitor?

Great work for this plugin, and I have used it for a month.

But I have a question on my machine. I have two monitors, side by side. When I changed font size in secondary monitor, it always switched to the main monitor.

I used Xrandr for arranging monitors and Awesome Window Manager.

Thank you

Can't get it working

Hi. I've been banging my head on this thing for a while and can't get it running. I installed the latest for arch.

Here's the relevant lines from .Xresources.

URxvt.perl-ext-common: selection-to-clipboard,font-size
URxvt.font-step:    10
URxvt.keysym.C-Up:     font-size:increase
URxvt.keysym.C-Down:   font-size:decrease
URxvt.keysym.C-0:      font-size:reset

I tried the echo -e trick. That changes font successfully. I changed it to fixed and tried resizing there too, just in case it was having trouble figuring out the size of the xft font I was on. No luck there.

I also tried enabling logging. It looks like urxvt sees my keypresses and is trying to run things...

<11:11:11> sagotsky@bender:~ $ URXVT_PERL_VERBOSITY=11 urxvt
urxvt: loading extension '/home/sagotsky/.urxvt/ext/font-size' into package 'urxvt::ext::font_size'
urxvt: register package urxvt::ext::font_size to urxvt::term=HASH(0x17bc2f8)
urxvt: loading extension '/usr/lib/urxvt/perl/selection-to-clipboard' into package 'urxvt::ext::selection_to_clipboard'
urxvt: register package urxvt::ext::selection_to_clipboard to urxvt::term=HASH(0x17bc2f8)
urxvt: INIT (urxvt::term=HASH(0x17bc2f8))
urxvt: INIT returning <>
urxvt: START (urxvt::term=HASH(0x17bc2f8))
urxvt: START returning <>
urxvt: ACTION (urxvt::term=HASH(0x17bc2f8), font-size, decrease, 0, b)
urxvt: ACTION returning <>
urxvt: ACTION (urxvt::term=HASH(0x17bc2f8), font-size, decrease, 0, b)
urxvt: ACTION returning <>
urxvt: ACTION (urxvt::term=HASH(0x17bc2f8), font-size, increase, 0, a)
urxvt: ACTION returning <>
urxvt: ACTION (urxvt::term=HASH(0x17bc2f8), font-size, reset, 0, =)
urxvt: ACTION returning <>
urxvt: ACTION (urxvt::term=HASH(0x17bc2f8), font-size, reset, 0, =)
urxvt: ACTION returning <>
urxvt: ACTION (urxvt::term=HASH(0x17bc2f8), font-size, reset, 0, 0)
urxvt: ACTION returning <>

Finally, I edited the script itself and added some debugging to font_apply_new. It never wrote to my log file. I might dig in a bit more later

Resizing in a tabbed terminal

Enabling "tabbed" perl extension causes the plugin's resizing behavior to fail. The tab section resizes but the rest of the terminal does not.

I am using rxvt-unicode v9.16 on a Fedora 18 machine.

git tag

thanks for this very useful extension. Are you able to tag this or do a release to make it easier to port it to various platforms? I'm working on it for FreeBSD presently.

How to add keybindings?

The extension automatically binds Ctrl++ to the 'increase' function,
Ctrl+- to 'decrease', and Ctrl+0 to 'reset'. To use the other available functions
or change the keys, add some keybindings of your own:

Add where? In Xresourcers?

URxvt.keysym.C-Up: font-size:increase
URxvt.keysym.C-Down: font-size:decrease
URxvt.keysym.C-S-Up: font-size:incglobal
URxvt.keysym.C-S-Down: font-size:decglobal
URxvt.keysym.C-equal: font-size:reset
URxvt.keysym.C-slash: font-size:show

If I want to change the comand for mouse wheel up and down, or ctrl+= and ctrl+-, how do I map and where do I put the keymapped? Here?

URxvt.keysym.C-Up: (command-here) font-size:increase

URxvt.keysym.(command-here): font-size:increase

Thanks for the attention and sorry for the question, im new in linux.
Using a notebook with manjaro i3.

Make default key bindings optional

I want to preserve the bind ctrl-minus for other purposes, but since this extension registers a default binding for font decrease to that key, I cannot use. Please consider a configuraion option to not register the default bindings at start.

in new terminal, doing a decrease first will not allow an increase after that

I'm using urxvt-font-size like so:

URxvt*keysym.Mod4-M-plus:  perl:font-size:increase
URxvt*keysym.Mod4-M-minus: perl:font-size:decrease
URxvt*keysym.Mod4-M-equal: perl:font-size:reset

I experience one glitch with this. If I in a newly opened terminal do a decrease first, I cannot do an increase after than. The terminal just flashes. If I first do an increase, I can then decrease, and then increase again (and so on). With reset, I can get around this. First decrease, then reset, and then I can do increase and so on.

It's a small glitch, but it was very confusing and annoying when my first font-size use in a terminal was a decrease, and I ended up thinking it's completely broken and restart it. Until I found out that reset does work--or force myself to always to an increase first thing...

curres is not initialized

sounds great -- tried on a fresh installation of Debian wheezy with urxvt 9.15 under VirtualBox.

no effect -- when digging found that curres which is assigned $term -> resource('font'); is undefined, so with the next condition it just exits

font size on all tabs simultaneously

Hi. Thanks for your extension, without it I wouldn't move from mrxvt to urxvt and would be stuck with non-utf terminal for another few years.

Is there any way you could add feature to change font-size on all tabs simultaneously (already opened and new ones)? Or maybe just change behaviour of perl:font-size:incglobal to apply not only to current tab and new ones but also to every other existing tab.

It's the only feature from mrxvt I'm missing.

Can't get the increase binding to work

First, it doesn't support the default font format:

URxvt.font: 9x15,xft:TerminessTTFNerdFontMono

So removing 9x15, and appending :size=12, you get the decrease and reset bindings working but the increase binding won't work (it doesn't warn either which means it might have succeeded in registering). So, pressing C-plus just prints the equal sign.

Is there a workaround or a binding that works?

debian setup

on my debian 12 this extension is fully working even if I don'enable it in .Xresources perl extension and without putting the script in .urxvt/ext/

How is it possible ?

thanks

292: argument "*" isn't numeric

I get the following error with current tip:

Argument "*" isn't numeric in numeric gt (>) at $HOME/.urxvt/ext/font-size line 292.

Haven't figured out what exactly triggers this, though.

Doesn't work with fixed core X fonts?

With clean X resources (xrdb -query | grep -i urxvt | xrdb -remove):

urxvt ++iso14755 -fn 7x13 -pe font-size

The hotkeys seem to be intercepted, but have no effect.

Using xft:fixed:pixelsize=13 as the font works, however I understand that this causes font rendering to go through FreeType, thus is much less efficient than core X fonts.

Everything works except dynamic resize shortcut

I've been trying every solution in google but nothing is changing, no dynamic font resizing with urxvt using a shortcut.
At least different fonts and transparency works like a charm.
Also, echo -e "\033]710;fixed\033\\" this escape sequence works, and it's getting an entire terminal font size smaller.

I'm sharing for my entire script because of any conflict. So I couldn't find my missing point.

!!
Xft.dpi:       96
Xft.antialias: true
Xft.hinting:   true
Xft.rgba:      rgb
Xft.autohint:  false
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault

XTerm*background:        #222D31
XTerm*foreground:        #d8d8d8
XTerm*pointerColor:      #1ABB9B
XTerm*faceName:          Fixed
XTerm*faceSize:          11
XTerm*reverseVideo:      on
XTerm*selectToClipboard: true

*background:                      #222D31
*foreground:                      #d8d8d8
*fading:                          8
*fadeColor:                       #d8d8d8
*cursorColor:                     #d8d8d8
*pointerColorBackground:          #d8d8d8
*pointerColorForeground:          #d8d8d8

!! black dark/light
*color0:                          #222D31
*color8:                          #585858

!! red dark/light
*color1:                          #ab4642
*color9:                          #ab4642

!! green dark/light
*color2:                          #7E807E
*color10:                         #8D8F8D

!! yellow dark/light
*color3:                          #f7ca88
*color11:                         #f7ca88

!! blue dark/light
*color4:                          #7cafc2
*color12:                         #7cafc2

!! magenta dark/light
*color5:                          #ba8baf
*color13:                         #ba8baf

!! cyan dark/light
*color6:                          #1ABB9B
*color14:                         #1ABB9B

!! white dark/light
*color7:                          #d8d8d8
*color15:                         #f8f8f8

!Xcursor.theme: xcursor-breeze
!Xcursor.size:                     0
!! rxvt colored terminal from https://wiki.archlinux.org/title/Color_output_in_console#rxvt-unicode
URxvt.colorIT:      #87af5f
URxvt.colorBD:      #d7d7d7
URxvt.colorUL:      #87afd7


if [ "$TERM" = "linux" ]; then
    _SEDCMD='s/.*\*color\([0-9]\{1,\}\).*#\([0-9a-fA-F]\{6\}\).*/\1 \2/p'
    for i in $(sed -n "$_SEDCMD" $HOME/.Xresources | awk '$1 < 16 {printf "\\e]P%X%s", $1, $2}'); do
        echo -en "$i"
    done
    clear
fi

URxvt.font:  9x15,xft:TerminessTTFNerdFontMono
! xft:ProFontIIx Nerd Font:size=11, xft:DejaVu Sans Mono for Powerline:size=14, xft:IPAGothic:size=12      

! alternative font settings with 'terminus':
! URxvt.font:      -xos4-terminus-medium-r-normal--16-160-72-72-c-80-iso10646-1
! URxvt.bold.font: -xos4-terminus-bold-r-normal--16-160-72-72-c-80-iso10646-1
!! terminus names see end of file!

URxvt.depth:                      32
URxvt.background:                 [100]#7cafc2
URxvt*scrollBar:                  false
URxvt*mouseWheelScrollPage:       false
URxvt*cursorBlink:                false
URxvt*background:                 black
URxvt*foreground:                 grey
URxvt*saveLines:                  5000

! for 'fake' transparency (without Compton) uncomment the following three lines
URxvt*inheritPixmap:            true
URxvt*transparent: true
! URxvt*shading: 0 to 99 darkens, 101 to 200 lightens
URxvt*shading: 10
!
!!resize-font
! Outomatic font size 
! mkdir ~/.urxvt/ext/ && cd ~/.urxvt/ext/ && git clone https://github.com/majutsushi/urxvt-font-size
URxvt.keysym.Shift-Up:     font-size:increase
URxvt.keysym.Shift-Down:   font-size:decrease
URxvt.keysym.Shift-S-Up:   font-size:incglobal
URxvt.keysym.Shift-S-Down: font-size:decglobal
URxvt.keysym.Shift-equal:  font-size:reset
URxvt.keysym.Shift-slash:  font-size:show
URxvt.font-size.step: 4

!URxvt.keysym.Shift-+:      font-size:increase
!URxvt.keysym.Shift--:    font-size:decrease
!URxvt.keysym.Shift-S-Up:        font-size:incglobal
!URxvt.keysym.Shift-S-Down:      font-size:decglobal
!URxvt.keysym.Shift-equal:       font-size:reset
!URxvt.keysym.Shift-slash:       font-size:show
!URxvt.font-size.step: 2
! Normal copy-paste keybindings without perls
URxvt.iso14755:                   false
URxvt.keysym.Shift-Control-V:     eval:paste_clipboard
URxvt.keysym.Shift-Control-C:     eval:selection_to_clipboard
!Xterm escape codes, word by word movement
!URxvt.keysym.Control-Left:        \033[1;5D

The version of urxvt is rxvt-unicode (urxvt) v9.31 - released: 2023-01-02

I moved uxrvt perl script to $HOME

tree ~/.urxvt/
/home/axe/.urxvt/
├── ext
│   └── font-size
├── font-size
└── urxvtd-axe-inspiron9999

Problem if increasing font size in Vim (and others)

Hi,

I've a problem with this extension : the aspect of the window is not computed again, in some sort, when I increase the font size in urxvt. I have to manually resize the window for the shape to be correct.

For instance, if I increase the font size in Vim, the bottom of the window disappears and I can't see the prompt anymore. I have to manually resize the window for the Vim window to adapt to my urxvt window.

Is there a way to fix this ?
Thanks

Add support for multiline font-declarations

If it's not too much work, would it be possible to add support for multiline font declarations?

e.g.

[code]
URxvt*font: xft:font1...,
xft:font2
[/code]

The font-size extension works fine when both fonts are declared on the same line, but breaks down when they are declared on multiple lines as above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.