-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1aecae5
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
`xfce4-terminal` doesn't provide a facility for {in,de}creasing font | ||
size in a running terminal. However, `xfce4-terminal` *does* watch the | ||
file `$XDG_CONFIG_PATH/xfce4/terminal/terminalrc` for changes to the | ||
`FontName` directive (which includes size). | ||
|
||
Therefore, this script can be bound to a via a keyboard shortcut that | ||
will change the font size, albeit after a short delay. | ||
|
||
No thanks to `urxvt-unicode` for not supporting fontconfig, which is | ||
necessary to run an unpatched Monaco font in Powerline, which I *must* | ||
have, all of which prompted my switch to xfce4-terminal which *does* | ||
support fontconfig and ... oh, nevermind. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
# xfce4-terminal-font.py -- programmatically change the font size of an | ||
# xfce4-terminal. | ||
# | ||
# Copyright © 2013 Noah K. Tilton <[email protected]> | ||
# | ||
# License: GPLv2 or later. | ||
|
||
# working with xfce4-terminal-0.6.2-1 | ||
|
||
if __name__ == "__main__": | ||
|
||
import sys | ||
|
||
PM = ["+", "-"] | ||
if len(sys.argv) != 2 or sys.argv[1] not in PM: | ||
sys.exit("Usage {0} {1}".format(sys.argv[0], "/".join(PM))) | ||
|
||
delta = int("{0}1".format(sys.argv[1])) | ||
|
||
import os | ||
import re | ||
from configparser import RawConfigParser | ||
|
||
# read input file | ||
f = os.path.join(os.environ["XDG_CONFIG_HOME"], "xfce4", "terminal", "terminalrc") | ||
c = RawConfigParser() | ||
c.optionxform = str # make keys case-sensitive | ||
c.read(f) | ||
font, size = re.search(r'^(.*) (\d+)$', c['Configuration']['FontName']).group(1, 2) | ||
size = int(size) + delta | ||
c['Configuration']['FontName'] = "{0} {1}".format(font, size) | ||
|
||
with open(f, 'w') as c_new: | ||
c.write(c_new) |