summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-08-20 09:37:40 +0100
committerPhil Jones <philj56@gmail.com>2022-08-20 09:37:40 +0100
commitea64fc43a6a321fcc7417f35d5ce50a2c7ee9d7e (patch)
tree07a42f4955c0ec2633558e5bbda6332f77cd5d5c /src/main.c
parentaaccdaa155a82bc7a98e4f82fc24415d6dd4e4db (diff)
Add scale option.
Previously, tofi wouldn't scale pixel values by the output's scale factor. This allows pixel-perfect sizes on displays with scale factors >1, but means that configs need to be changed on a per-monitor basis, and is at odds with how other applications (notable Sway) behave. This commit adds a new option, --scale, to scale pixel values by the output's scale factor. For backwards compatibility, this currently defaults to false, and font scaling is performed regardless (the existing behaviour). In the next release, this will default to true, and font scaling will follow the same behaviour as everything else.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 8cc913d..7d861b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -763,6 +763,7 @@ static void usage()
" --height <px|%> Height of the window.\n"
" --corner-radius <px> Radius of window corners.\n"
" --output <name> Name of output to display window on.\n"
+" --scale <true|false> Follow the output's scale factor.\n"
" --anchor <position> Location on screen to anchor window.\n"
" --margin-top <px|%> Offset from top of screen.\n"
" --margin-bottom <px|%> Offset from bottom of screen.\n"
@@ -827,6 +828,7 @@ const struct option long_options[] = {
{"drun-print-exec", required_argument, NULL, 0},
{"hint-font", required_argument, NULL, 0},
{"output", required_argument, NULL, 0},
+ {"scale", required_argument, NULL, 0},
{"late-keyboard-init", optional_argument, NULL, 'k'},
{NULL, 0, NULL, 0}
};
@@ -1139,11 +1141,11 @@ int main(int argc, char *argv[])
log_debug("Selected output %s.\n", el->name);
}
- /* We can now calculate any percentages, as we know the output size. */
- config_fix_percentages(&tofi);
-
- /* Scale fonts to the correct size. */
- tofi.window.entry.font_size *= tofi.window.scale;
+ /*
+ * We can now scale values and calculate any percentages, as we know
+ * the output size and scale.
+ */
+ config_fixup_values(&tofi);
/*
* If we were invoked as tofi-run, generate the command list.