From 1c3c76165e49bafd54f8feafada3dc71e3697cd1 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 15 Mar 2019 19:51:58 +0100 Subject: [PATCH] Move xrandr functions into randr completions Part of #5279. [ci skip] --- share/completions/xrandr.fish | 15 +++++++++++++++ share/functions/__fish_print_xrandr_modes.fish | 11 ----------- share/functions/__fish_print_xrandr_outputs.fish | 3 --- 3 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 share/functions/__fish_print_xrandr_modes.fish delete mode 100644 share/functions/__fish_print_xrandr_outputs.fish diff --git a/share/completions/xrandr.fish b/share/completions/xrandr.fish index a4a345b96..2eed8e9f3 100644 --- a/share/completions/xrandr.fish +++ b/share/completions/xrandr.fish @@ -1,3 +1,18 @@ +function __fish_print_xrandr_outputs --description 'Print xrandr outputs' + xrandr | string replace -r --filter '^(\S+)\s+(.*)$' '$1\t$2' | string match -v -e Screen +end + +function __fish_print_xrandr_modes --description 'Print xrandr modes' + set -l output + xrandr | string match -v -r '^(Screen|\s{4,})' | while read line + switch $line + case ' *' + string trim $line | string replace -r '^(\S+)\s+(.*)$' "\$1\t\$2 [$output]" + case '*' + set output (string match -r '^\S+' $line) + end + end +end complete -c xrandr -l verbose -d 'Be more verbose' complete -c xrandr -l dryrun -d 'Make no changes' complete -c xrandr -l nograb -d 'Apply modifications without grabbing the screen' diff --git a/share/functions/__fish_print_xrandr_modes.fish b/share/functions/__fish_print_xrandr_modes.fish deleted file mode 100644 index 0023abe54..000000000 --- a/share/functions/__fish_print_xrandr_modes.fish +++ /dev/null @@ -1,11 +0,0 @@ -function __fish_print_xrandr_modes --description 'Print xrandr modes' - set -l output - xrandr | string match -v -r '^(Screen|\s{4,})' | while read line - switch $line - case ' *' - string trim $line | string replace -r '^(\S+)\s+(.*)$' "\$1\t\$2 [$output]" - case '*' - set output (string match -r '^\S+' $line) - end - end -end diff --git a/share/functions/__fish_print_xrandr_outputs.fish b/share/functions/__fish_print_xrandr_outputs.fish deleted file mode 100644 index 43614a996..000000000 --- a/share/functions/__fish_print_xrandr_outputs.fish +++ /dev/null @@ -1,3 +0,0 @@ -function __fish_print_xrandr_outputs --description 'Print xrandr outputs' - xrandr | string replace -r --filter '^(\S+)\s+(.*)$' '$1\t$2' | string match -v -e Screen -end