fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a9618477e
master
1# xinput, a tool for managing X11 input devices 2set -l cmds version list get-feedbacks set-pointer set-mode set-ptr-feedback set-integer-feedback set-button-map query-state list-props set-int-prop set-float-prop set-prop watch-props delete-prop test test-xi2 create-master remove-master reattach float set-cp map-to-output enable disable 3 4function __fish_xinput_devices 5# Yeah, this includes a "↳" char 6# There's either this or printing only name or id, not both 7xinput list --short| string replace -r'^[\W↳]*(.*?)\s+id=([0-9]+).*$' '$2\t$1' 8xinput list --short| string replace -r'^[\W↳]*(.*?)\s+id=([0-9]+).*$' '$1' 9end 10 11function __fish_xinput_device_props 12set -l device$argv [ 1 ] 13if test -n " $device " 14xinput list-props$device | string replace -rf'\s+(.*?)\s+\((\d+)\).*' '$2\t$1' 15xinput list-props$device | string replace -rf'\s+(.*?)\s+\((\d+)\).*' '$1' 16end 17end 18 19function __fish_xinput_nth_token 20set -l n$argv [ 1 ] 21set -l tokens( commandline -cx) 22set -e tokens[ 1 ] # remove command name 23# remove options 24set -l tokens( string replace -r --filter'^([^-].*)' '$1' --$tokens ) 25if set -q tokens[ $n ] 26echo $tokens [ $n ] 27end 28end 29 30complete -c xinput -f -n"not __fish_seen_subcommand_from $cmds " -a" $cmds " 31complete -c xinput -f -n"__fish_is_nth_token 2; and __fish_seen_subcommand_from list get-feedbacks set-pointer set-mode set-ptr-feedback set-integer-feedback set-button-map query-state list-props set-int-prop set-float-prop set-prop watch-props" -a"(__fish_xinput_devices)" 32complete -c xinput -f -n"__fish_seen_subcommand_from list set-int-prop set-float-prop set-prop watch-props; and not __fish_is_nth_token 2" -xa"(__fish_xinput_device_props (__fish_xinput_nth_token 2))"