river: add fullscreen rule

This commit adds a fullscreen rule for configuring
whether the view should be drawn fullscreen on start up.

The actions "fullscreen" and "no-fullscreen" map to the two
possible state of a view and semantically operate on the same
rule list. The behavior of adding, deleting and listing rules
follows that of float and ssd.
This commit is contained in:
polykernel
2023-11-06 10:53:44 -05:00
parent a0ea456ab2
commit 2b463c9e4d
6 changed files with 34 additions and 9 deletions

View File

@ -1,6 +1,6 @@
function __riverctl_completion ()
{
local rule_actions="float no-float ssd csd tag output position dimensions"
local rule_actions="float no-float ssd csd tag output position dimensions fullscreen no-fullscreen"
if [ "${COMP_CWORD}" -eq 1 ]
then
OPTS=" \
@ -66,7 +66,7 @@ function __riverctl_completion ()
"move"|"snap") OPTS="up down left right" ;;
"resize") OPTS="horizontal vertical" ;;
"rule-add"|"rule-del") OPTS="-app-id -title $rule_actions" ;;
"list-rules") OPTS="float ssd tag output position dimensions" ;;
"list-rules") OPTS="float ssd tag output position dimensions fullscreen" ;;
"map") OPTS="-release -repeat -layout" ;;
"unmap") OPTS="-release" ;;
"attach-mode") OPTS="top bottom" ;;

View File

@ -88,10 +88,10 @@ complete -c riverctl -n '__fish_seen_subcommand_from unmap'
complete -c riverctl -n '__fish_seen_subcommand_from attach-mode' -n '__fish_riverctl_complete_arg 2' -a 'top bottom'
complete -c riverctl -n '__fish_seen_subcommand_from focus-follows-cursor' -n '__fish_riverctl_complete_arg 2' -a 'disabled normal always'
complete -c riverctl -n '__fish_seen_subcommand_from set-cursor-warp' -n '__fish_riverctl_complete_arg 2' -a 'disabled on-output-change on-focus-change'
complete -c riverctl -n '__fish_seen_subcommand_from list-rules' -n '__fish_riverctl_complete_arg 2' -a 'float ssd tag output position dimensions'
complete -c riverctl -n '__fish_seen_subcommand_from list-rules' -n '__fish_riverctl_complete_arg 2' -a 'float ssd tag output position dimensions fullscreen'
# Options and subcommands for 'rule-add' and 'rule-del'
set -l rule_actions float no-float ssd csd tag output position dimensions
set -l rule_actions float no-float ssd csd tag output position dimensions fullscreen no-fullscreen
complete -c riverctl -n '__fish_seen_subcommand_from rule-add rule-del' -n "not __fish_seen_subcommand_from $rule_actions" -n 'not __fish_seen_argument -o app-id' -o 'app-id' -r
complete -c riverctl -n '__fish_seen_subcommand_from rule-add rule-del' -n "not __fish_seen_subcommand_from $rule_actions" -n 'not __fish_seen_argument -o title' -o 'title' -r
complete -c riverctl -n '__fish_seen_subcommand_from rule-add rule-del' -n "not __fish_seen_subcommand_from $rule_actions" -n 'test (math (count (commandline -opc)) % 2) -eq 0' -a "$rule_actions"

View File

@ -183,9 +183,9 @@ _riverctl()
# In case of a new rule added in river, we just need
# to add it to the third option between '()',
# i.e (float no-float <new-option>)
_arguments '1: :(-app-id -title)' '2: : ' ':: :(float no-float ssd csd tag output position dimensions)'
_arguments '1: :(-app-id -title)' '2: : ' ':: :(float no-float ssd csd tag output position dimensions fullscreen no-fullscreen)'
;;
list-rules) _alternative 'arguments:args:(float ssd tag output position dimensions)' ;;
list-rules) _alternative 'arguments:args:(float ssd tag output position dimensions fullscreen)' ;;
*) return 0 ;;
esac
;;