From c0d3df8af0328280836ccfef85ae7e40eb3b6b87 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Wed, 3 Aug 2022 13:47:15 +0100 Subject: Make --drun-print-exec always be true. The option is now deprecated, and a warning will be printed if it's used. It may be removed in a future version of tofi, so it should be removed from any configs now. --- README.md | 19 ++++++++++++------- completions/tofi | 1 - doc/config | 9 --------- doc/tofi.1.md | 11 ++++++----- doc/tofi.1.scd | 10 +++++----- doc/tofi.5.md | 11 ++++------- doc/tofi.5.scd | 10 ++++------ src/config.c | 3 ++- src/main.c | 13 +++---------- 9 files changed, 36 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index c5152f5..b2d8b0b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ An extremely fast and simple [dmenu](https://tools.suckless.org/dmenu/) / The aim is to do just what I want it to as quick as possible. -When configured correctly, tofi can get on screen within a single frame. +When [configured correctly](#performance), tofi can get on screen within a +single frame. ![](screenshot_fullscreen.png) @@ -57,11 +58,15 @@ executables under the user's `$PATH`. list of applications found in desktop files as described by the [Desktop Entry Specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html). -**WARNING**: Currently, when a selection is made in drun mode, the -filename of the selected desktop file is printed to stdout. In the next -version of tofi, this will change to an executable command line, to be -passed to swaymsg exec or similar. The new behaviour can be enabled now -by passing --drun-print-exec=true to tofi-drun. +**WARNING**: In the latest version of tofi, the default behaviour of drun mode +has changed. Previously, when a selection was made in drun mode, the filename +of the selected desktop file was printed to stdout. This couldn't be passed +directly to swaymsg exec however, so applications launched in drun mode +wouldn't always stay in the correct workspace. In the current version of tofi, +this has changed to an executable command line, to be passed to swaymsg exec or +similar. The drun-print-exec option is therefore useless and deprecated, and +may be removed from a future version of tofi, so you should remove it from your +configs. To use as a launcher for Sway, add something similar to the following to your Sway config file: @@ -73,7 +78,7 @@ bindsym $mod+d exec $menu For `tofi-drun`, there are two possible methods: ``` # Launch via Sway -set $drun tofi-drun --drun-print-exec=true | xargs swaymsg exec -- +set $drun tofi-drun | xargs swaymsg exec -- bindsym $mod+Shift+d exec $drun # Launch directly diff --git a/completions/tofi b/completions/tofi index add8aab..218d8fc 100644 --- a/completions/tofi +++ b/completions/tofi @@ -41,7 +41,6 @@ _tofi() --hide-cursor --history --drun-launch - --drun-print-exec --hint-font --late-keyboard-init ) diff --git a/doc/config b/doc/config index 454f275..bb7c232 100644 --- a/doc/config +++ b/doc/config @@ -120,12 +120,3 @@ # If true, directly launch applications on selection when in drun mode. # Otherwise, just print the command line to stdout. drun-launch = false - - # If true, print an executable command line for the selected - # application when in drun mode. Otherwise, just print the path of the - # .desktop file. - # - # *WARNING*: This currently defaults to false. In the next version of - # tofi, this will change to always be true, as it should have been from - # the start. - drun-print-exec = true diff --git a/doc/tofi.1.md b/doc/tofi.1.md index 970fc2b..b3dee5c 100644 --- a/doc/tofi.1.md +++ b/doc/tofi.1.md @@ -25,11 +25,12 @@ When invoked via the name **tofi-drun**, **tofi** will not accept items on stdin, and will generate a list of applications from desktop files as described in the Desktop Entry Specification. -**WARNING**: Currently, when a selection is made in drun mode, the -filename of the selected desktop file is printed to stdout. In the next -version of tofi, this will change to an executable command line, to be -passed to swaymsg exec or similar. The new behaviour can be enabled now -by passing --drun-print-exec=true to tofi-drun. +**WARNING**: In the last version of tofi, when a selection was made in +drun mode, the filename of the selected desktop file was printed to +stdout. In the current version of tofi, this has changed to an +executable command line, to be passed to swaymsg exec or similar. +Consequently, the --drun-print-exec does nothing, and may be removed in +a future version of tofi. # OPTIONS diff --git a/doc/tofi.1.scd b/doc/tofi.1.scd index 71e804d..f85e18d 100644 --- a/doc/tofi.1.scd +++ b/doc/tofi.1.scd @@ -25,11 +25,11 @@ When invoked via the name *tofi-drun*, *tofi* will not accept items on stdin, and will generate a list of applications from desktop files as described in the Desktop Entry Specification. -*WARNING*: Currently, when a selection is made in drun mode, the filename of -the selected desktop file is printed to stdout. In the next version of tofi, -this will change to an executable command line, to be passed to swaymsg exec or -similar. The new behaviour can be enabled now by passing --drun-print-exec=true -to tofi-drun. +*WARNING*: In the last version of tofi, when a selection was made in drun +mode, the filename of the selected desktop file was printed to stdout. In the +current version of tofi, this has changed to an executable command line, to be +passed to swaymsg exec or similar. Consequently, the --drun-print-exec does +nothing, and may be removed in a future version of tofi. # OPTIONS diff --git a/doc/tofi.5.md b/doc/tofi.5.md index c922fac..c425b1b 100644 --- a/doc/tofi.5.md +++ b/doc/tofi.5.md @@ -241,14 +241,11 @@ options. **drun-print-exec**=*true\|false* -> If true, print an executable command line for the selected application -> when in drun mode. Otherwise, just print the path of the .desktop -> file. +> **WARNING**: In the current version of tofi, this option has changed +> to always be true and has no effect, as it should have been from the +> start. It may be removed in a future version of tofi. > -> **WARNING**: In the next version of tofi, this will change to always -> be true, as it should have been from the start. -> -> Default: false +> Default: true. **hint-font**=*true\|false* diff --git a/doc/tofi.5.scd b/doc/tofi.5.scd index 3993e78..9841b1f 100644 --- a/doc/tofi.5.scd +++ b/doc/tofi.5.scd @@ -208,13 +208,11 @@ options. Default: false *drun-print-exec*=_true|false_ - If true, print an executable command line for the selected application - when in drun mode. Otherwise, just print the path of the .desktop file. + *WARNING*: In the current version of tofi, this option has changed to + always be true and has no effect, as it should have been from the + start. It may be removed in a future version of tofi. - *WARNING*: In the next version of tofi, this will change to always be - true, as it should have been from the start. - - Default: false + Default: true. *hint-font*=_true|false_ Perform font hinting. Only applies when a path to a font has been diff --git a/src/config.c b/src/config.c index 8cb3763..47f964d 100644 --- a/src/config.c +++ b/src/config.c @@ -298,7 +298,8 @@ bool parse_option(struct tofi *tofi, const char *filename, size_t lineno, const } else if (strcasecmp(option, "drun-launch") == 0) { tofi->drun_launch = parse_bool(filename, lineno, value, &err); } else if (strcasecmp(option, "drun-print-exec") == 0) { - tofi->drun_print_exec = parse_bool(filename, lineno, value, &err); + log_warning("drun-print-exec is deprecated, as it is now always true.\n" + " This option may be removed in a future version of tofi.\n"); } else if (strcasecmp(option, "hint-font") == 0) { tofi->window.entry.harfbuzz.disable_hinting = !parse_bool(filename, lineno, value, &err); } else if (strcasecmp(option, "late-keyboard-init") == 0) { diff --git a/src/main.c b/src/main.c index c9f770b..be13a28 100644 --- a/src/main.c +++ b/src/main.c @@ -805,7 +805,8 @@ static void usage() " --history Sort results by number of usages.\n" " --drun-launch Launch apps directly in drun mode.\n" " --drun-print-exec Print a command line in drun mode.\n" -" This will become the default in future.\n" +" This is now always the case,\n" +" and this option is deprecated.\n" " --hint-font Perform font hinting.\n" " --late-keyboard-init (EXPERIMENTAL) Delay keyboard\n" " initialisation until after the first\n" @@ -954,16 +955,8 @@ static void do_submit(struct tofi *tofi) } if (tofi->drun_launch) { drun_launch(res); - } else if (tofi->drun_print_exec) { - drun_print(res); } else { - log_warning("Using drun mode without --drun-print-exec=true is deprecated.\n" - " In the next version of tofi, this will become the default behaviour,\n" - " so fix your compositor configs now e.g. by replacing\n" - " tofi-drun | xargs swaymsg exec gio launch\n" - " with\n" - " tofi-drun --drun-print-exec=true | xargs swaymsg exec --\n"); - printf("%s\n", res); + drun_print(res); } } else { printf("%s\n", res); -- cgit v1.2.3