From 6c47cf7892d0f212b04e7b798e53c120f51022d7 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 20 Dec 2022 23:53:20 +0000 Subject: Add text cursor support. This turned out to be much more complex than anticipated, and the potential for bugs is therefore quite high. --- doc/config | 33 ++++++++++++++++++++++++- doc/tofi.5.md | 45 ++++++++++++++++++++++++++++++---- doc/tofi.5.scd | 76 +++++++++++++++++++++++++++++++++++++++++----------------- 3 files changed, 127 insertions(+), 27 deletions(-) (limited to 'doc') diff --git a/doc/config b/doc/config index 4ce0a7d..4eeb59c 100644 --- a/doc/config +++ b/doc/config @@ -110,6 +110,34 @@ # Matching portion of selection text selection-match-color = #00000000 + +# +### Text cursor theme +# + # Style of the optional text cursor. + # + # Supported values: bar, block, underscore + text-cursor-style = bar + + # Color of the text cursor + # + # If unspecified, defaults to the same as input-color + # text-cursor-color = #FFFFFF + + # Color of text behind the text cursor when text-cursor-style = block + # + # If unspecified, defaults to the same as background-color + # text-cursor-background = #000000 + + # Corner radius of the text cursor + text-cursor-corner-radius = 0 + + # Thickness of the bar and underscore text cursors. + # + # If unspecified, defaults to a font-dependent value when + # text-cursor-style = underscore, or to 2 otherwise. + # text-cursor-thickness = 2 + # ### Text layout # @@ -207,9 +235,12 @@ # ### Behaviour # - # Hide the cursor. + # Hide the mouse cursor. hide-cursor = false + # Show a text cursor in the input field. + text-cursor = false + # Sort results by number of usages in run and drun modes. history = true diff --git a/doc/tofi.5.md b/doc/tofi.5.md index 622858f..c9c5acc 100644 --- a/doc/tofi.5.md +++ b/doc/tofi.5.md @@ -34,7 +34,13 @@ options. **hide-cursor**=*true\|false* -> Hide the cursor. +> Hide the mouse cursor. +> +> Default: false + +**text-cursor**=*true\|false* + +> Show a text cursor in the input field. > > Default: false @@ -277,7 +283,7 @@ options. **placeholder-background-padding**=*directional* > Extra padding of the placeholder input text background. See -> **DIRECTIONAL** VALUES for more information. +> **DIRECTIONAL VALUES** for more information. > > Default: 0 @@ -312,6 +318,37 @@ options. > > Default: 0 +**text-cursor-style**=*bar\|block\|underscore* + +> Style of the text cursor (if shown). +> +> Default: bar + +**text-cursor-color**=*color* + +> Color of the text cursor. +> +> Default: same as **input-color** + +**text-cursor-background**=*color* + +> Color of text behind the text cursor when **text-cursor-style**=block. +> +> Default: same as **background-color** + +**text-cursor-corner-radius**=*px* + +> Corner radius of the text cursor. +> +> Default: 0 + +**text-cursor-thickness**=*px* + +> Thickness of the bar and underscore text cursors. +> +> Default: font-dependent when **text-cursor-style**=underscore, 2 +> otherwise. + **default-result-color**=*color* > Default color of result text. See **COLORS** for more information. @@ -407,8 +444,8 @@ options. **selection-background-padding**=*directional* -> Extra padding of the selected result background. See **DIRECTIONAL -> VALUES** for more information. +> Extra padding of the selected result background. See **DIRECTIONAL** +> VALUES for more information. > > Default: 0 diff --git a/doc/tofi.5.scd b/doc/tofi.5.scd index 4dde4d6..2863355 100644 --- a/doc/tofi.5.scd +++ b/doc/tofi.5.scd @@ -34,7 +34,12 @@ options. # BEHAVIOUR OPTIONS *hide-cursor*=_true|false_ - Hide the cursor. + Hide the mouse cursor. + + Default: false + +*text-cursor*=_true|false_ + Show a text cursor in the input field. Default: false @@ -98,8 +103,8 @@ options. Default: the value of the TERMINAL environment variable *drun-print-exec*=_true|false_ - *WARNING*: This option does nothing, and may be removed in a future version - of tofi. + *WARNING*: This option does nothing, and may be removed in a future + version of tofi. Default: true @@ -209,8 +214,8 @@ options. Default: #00000000 *prompt-background-padding*=_directional_ - Extra padding of the prompt background. See *DIRECTIONAL VALUES* for more - information. + Extra padding of the prompt background. See *DIRECTIONAL VALUES* for + more information. Default: 0 @@ -236,8 +241,8 @@ options. Default: #00000000 *placeholder-background-padding*=_directional_ - Extra padding of the placeholder input text background. See *DIRECTIONAL - VALUES* for more information. + Extra padding of the placeholder input text background. See + *DIRECTIONAL VALUES* for more information. Default: 0 @@ -257,8 +262,8 @@ options. Default: #00000000 *input-background-padding*=_directional_ - Extra padding of the input background. See *DIRECTIONAL VALUES* for more - information. + Extra padding of the input background. See *DIRECTIONAL VALUES* for + more information. Default: 0 @@ -267,6 +272,32 @@ options. Default: 0 +*text-cursor-style*=_bar|block|underscore_ + Style of the text cursor (if shown). + + Default: bar + +*text-cursor-color*=_color_ + Color of the text cursor. + + Default: same as *input-color* + +*text-cursor-background*=_color_ + Color of text behind the text cursor when *text-cursor-style*=block. + + Default: same as *background-color* + +*text-cursor-corner-radius*=_px_ + Corner radius of the text cursor. + + Default: 0 + +*text-cursor-thickness*=_px_ + Thickness of the bar and underscore text cursors. + + Default: font-dependent when *text-cursor-style*=underscore, 2 + otherwise. + *default-result-color*=_color_ Default color of result text. See *COLORS* for more information. @@ -278,8 +309,8 @@ options. Default: #00000000 *default-result-background-padding*=_directional_ - Default extra padding of result backgrounds. See *DIRECTIONAL VALUES* for - more information. + Default extra padding of result backgrounds. See *DIRECTIONAL VALUES* + for more information. Default: 0 @@ -295,8 +326,8 @@ options. Default: same as *default-result-color* *alternate-result-background*=_color_ - Background color of alternate (even-numbered) results. See *COLORS* for more - information. + Background color of alternate (even-numbered) results. See *COLORS* for + more information. Default: same as *default-result-background* @@ -331,8 +362,9 @@ options. Default: #00000000 *selection-padding*=_px_ - *WARNING*: This option is deprecated, and will be removed in a future version - of tofi. You should use the *selection-background-padding* option instead. + *WARNING*: This option is deprecated, and will be removed in a future + version of tofi. You should use the *selection-background-padding* + option instead. Extra horizontal padding of the selection background. If _px_ = -1, the padding will fill the whole window width. @@ -345,8 +377,8 @@ options. Default: #00000000 *selection-background-padding*=_directional_ - Extra padding of the selected result background. See *DIRECTIONAL VALUES* for - more information. + Extra padding of the selected result background. See *DIRECTIONAL + VALUES* for more information. Default: 0 @@ -387,11 +419,11 @@ options. Default: center *exclusive-zone*=_-1|px|%_ - Set the size of the exclusive zone. A value of -1 means ignore exclusive - zones completely. A value of 0 will move tofi out of the way of other - windows' exclusive zones. A value greater than 0 will set that much space as - an exclusive zone. Values greater than 0 are only meaningful when tofi is - anchored to a single edge. + Set the size of the exclusive zone. A value of -1 means ignore + exclusive zones completely. A value of 0 will move tofi out of the way + of other windows' exclusive zones. A value greater than 0 will set that + much space as an exclusive zone. Values greater than 0 are only + meaningful when tofi is anchored to a single edge. Default: -1 -- cgit v1.2.3