Hyprland/completions/generated/hyprctl.zsh

166 lines
14 KiB
Bash
Raw Normal View History

2023-10-09 14:16:15 +02:00
_hyprctl_cmd_0 () {
hyprctl instances -j | sed -n 's/.*"instance": "\(.*\)".*/\1/p'
}
_hyprctl_cmd_1 () {
printf '%s\n' /usr/share/icons/*/cursors | cut -d/ -f5
}
_hyprctl_cmd_2 () {
hyprctl devices -j | awk '/^"keyboards"/,/^\],$/' | sed -n 's/.*"name": "\(.*\)".*/\1/p'
}
_hyprctl_cmd_3 () {
hyprctl monitors | sed -n 's/^Monitor \(.*\) (ID .*/\1/p'
}
_hyprctl_spec_1 () {
_path_files
}
_hyprctl () {
local -a literals=("misc:enable_swallow" "dwindle:split_width_multiplier" "3" "debug:suppress_errors" "input:touchpad:drag_lock" "decoration:blur:special" "alterzorder" "misc:groupbar_gradients" "misc:swallow_regex" "setprop" "resizeactive" "dwindle:preserve_split" "dwindle:smart_split" "misc:group_insert_after_current" "misc:key_press_enables_dpms" "preload" "next" "centerwindow" "wayland" "fullscreen" "pass" "execr" "misc:focus_on_activate" "input:tablet:output" "gestures:workspace_swipe_create_new" "general:hover_icon_on_border" "debug:log_damage" "general:col.nogroup_border_active" "general:max_fps" "misc:cursor_zoom_factor" "binds:focus_preferred_method" "misc:close_special_on_empty" "debug:watchdog_timeout" "misc:layers_hog_keyboard_focus" "blurls" "resizewindowpixel" "binds" "decoration:dim_inactive" "dwindle:use_active_for_splits" "cursorpos" "input:touchdevice:output" "workspaces" "input:tablet:transform" "misc:always_follow_on_dnd" "misc:vfr" "list" "gestures:workspace_swipe_distance" "devices" "decoration:dim_around" "input:numlock_by_default" "general:allow_tearing" "input:kb_variant" "misc:animate_mouse_windowdragging" "decoration:shadow_ignore_window" "exit" "gestures:workspace_swipe_invert" "misc:mouse_move_focuses_monitor" "general:cursor_inactive_timeout" "top" "decoration:col.shadow_inactive" "unbind" "movewindoworgroup" "exec" "remove" "layerrule" "autogenerated" "xwayland:force_zero_scaling" "plugin" "lockactivegroup" "general:col.inactive_border" "input:touchpad:clickfinger_behavior" "closewindow" "input:touchdevice:transform" "monitor" "animation" "debug:enable_stdout_logs" "general:col.nogroup_border" "misc:no_direct_scanout" "input:repeat_rate" "dwindle:no_gaps_when_only" "togglegroup" "input:scroll_method" "movecursor" "dwindle:permanent_direction_override" "gestures:workspace_swipe_direction_lock_threshold" "input:touchpad:tap-and-drag" "swapactiveworkspaces" "gestures:workspace_swipe" "decoration:col.shadow" "master:mfact" "setcursor" "gestures:workspace_swipe_forever" "input:sensitivity" "input:touchpad:tap-to-click" "misc:swallow_exception_regex" "misc:cursor_zoom_rigid" "activeworkspace" "debug:int" "decoration:active_opacity" "misc:force_hypr_chan" "togglespecialworkspace" "binds:allow_workspace_cycles" "dwindle:smart_resizing" "general:sensitivity" "misc:group_focus_removed_window" "-j" "prev" "pseudo" "load" "decoration:shadow_offset" "decoration:fullscreen_opacity" "togglefloating" "dwindle:pseudotile" "input:touchpad:tap_button_map" "source" "input:tablet:region_size" "decoration:shadow_render_power" "moveactive" "moveworkspacetomonitor" "general:layout" "mfact" "changegroupactive" "0" "decoration:shadow_range" "instances" "general:extend_border_grab_area" "debug:damage_tracking" "misc:render_ahead_of_time" "bezier" "decoration:screen_shader" "input:tablet:region_position" "togglesplit" "globalshortcuts" "decoration:blur:noise" "input:kb_model" "master:allow_small_split" "decoration:blur:enabled" "master:new_is_master" "killactive" "windowrule" "clients" "gestures:workspace_swipe_fingers" "master:no_gaps_when_only" "fakefullscreen" "env" "x11" "general:col.group_border_locked_active" "mouse" "bottom" "notify" "pin" "animations" "gestures:workspace_swipe_direction_lock" "wallpaper" "master:smart_resizing" "general:no_border_on_floating" "input:follow_mouse" "wsbind" "debug:disable_time" "general:no_cursor_warps" "layoutmsg" "1" "master:always_center_master" "cyclenext" "movecursortocorner" "keyword" "general:apply_sens_to_raw" "general:col.group_border_active" "movewindowpixel" "input:accel_profile" "auto" "input:natural_scroll" "activewindow" "swapwindow" "decoration:blur:contrast" "master:inherit_fullscreen" "misc:allow_session_lock_restore" "input:scroll_button_lock" "5" "input:mouse_refocus" "decoration:blur:new_optimizations" "--instance" "decoration:inactive_opacity" "misc:disable_splash_rendering" "forcerendererreload" "master:orientation" "misc:force_default_wallpaper" "xwayland:use_nearest_neighbor" "hyprpaper" "input:touchpad:scroll_factor" "movecurrentworkspacetomonitor"
local -A descriptions
descriptions[3]="error"
descriptions[10]="set windowrule properties"
descriptions[37]="list all keybindings"
descriptions[40]="print cursor position"
descriptions[42]="list all workspaces with their properties"
descriptions[48]="list all connected input devices"
descriptions[91]="set cursor theme"
descriptions[97]="show info about active workspace"
descriptions[106]="JSON output"
descriptions[123]="warning"
descriptions[125]="list running Hyprland instances"
descriptions[133]="list all global shortcuts"
descriptions[141]="list all windows with their properties"
descriptions[150]="send notification"
descriptions[152]="list animations and beziers"
descriptions[162]="info"
descriptions[166]="execute a keyword"
descriptions[173]="print active window name"
descriptions[179]="ok"
descriptions[182]="use specified Hyprland instance"
descriptions[193]="list all outputs with their properties"
descriptions[200]="switch keyboard layout"
descriptions[217]="creates/destroys a fake output"
descriptions[224]="use specified Hyprland instance"
descriptions[226]="list all layers"
descriptions[235]="show text in error bar"
descriptions[243]="hint"
descriptions[251]="print Hyprland version"
descriptions[261]="no icon"
descriptions[266]="reload config file"
descriptions[271]="kill an app by clicking on it"
descriptions[274]="run a dispatcher"
descriptions[277]="print value of config option"
descriptions[283]="confused"
descriptions[285]="execute multiple commands, separated by ';'"
descriptions[292]="print current random splash"
local -A literal_transitions
literal_transitions[1]="([106]=1 [68]=2 [37]=3 [150]=9 [40]=3 [152]=3 [42]=3 [266]=3 [10]=3 [235]=8 [48]=3 [271]=3 [125]=3 [274]=10 [166]=11 [277]=7 [91]=12 [173]=3 [217]=13 [285]=3 [133]=3 [292]=3 [97]=3 [141]=3 [182]=14 [251]=3 [224]=14 [189]=5 [226]=3 [200]=15 [193]=3)"
literal_transitions[2]="([46]=3 [109]=4 [229]=4)"
literal_transitions[5]="([16]=4 [154]=3 [229]=6)"
literal_transitions[6]="([287]=3)"
literal_transitions[7]="([147]=3 [2]=3 [4]=3 [5]=3 [6]=3 [8]=3 [153]=3 [155]=3 [9]=3 [156]=3 [157]=3 [12]=3 [13]=3 [159]=3 [160]=3 [163]=3 [14]=3 [15]=3 [167]=3 [168]=3 [170]=3 [172]=3 [175]=3 [176]=3 [177]=3 [23]=3 [178]=3 [24]=3 [25]=3 [26]=3 [180]=3 [27]=3 [28]=3 [29]=3 [30]=3 [31]=3 [181]=3 [183]=3 [32]=3 [184]=3 [186]=3 [33]=3 [190]=3 [198]=3 [34]=3 [194]=3 [188]=3 [197]=3 [187]=3 [38]=3 [39]=3 [201]=3 [41]=3 [43]=3 [44]=3 [45]=3 [202]=3 [204]=3 [47]=3 [205]=3 [207]=3 [208]=3 [209]=3 [210]=3 [49]=3 [50]=3 [51]=3 [52]=3 [53]=3 [54]=3 [211]=3 [212]=3 [213]=3 [216]=3 [56]=3 [57]=3 [58]=3 [219]=3 [60]=3 [220]=3 [221]=3 [222]=3 [223]=3 [66]=3 [228]=3 [67]=3 [70]=3 [71]=3 [73]=3 [231]=3 [78]=3 [76]=3 [77]=3 [233]=3 [234]=3 [79]=3 [80]=3 [82]=3 [237]=3 [84]=3 [238]=3 [85]=3 [239]=3 [86]=3 [240]=3 [88]=3 [89]=3 [90]=3 [242]=3 [244]=3 [92]=3 [93]=3 [94]=3 [95]=3 [96]=3 [245]=3 [246]=3 [247]=3 [98]=3 [248]=3 [99]=3 [249]=3 [250]=3 [100]=3 [252]=3 [102]=3 [254]=3 [103]=3 [104]=3 [105]=3 [255]=3 [256]=3 [257]=3 [258]=3 [110]=3 [259]=3 [111]=3 [113]=3 [114]=3 [260]=3 [263]=3 [116]=3 [264]=3 [267]=3 [117]=3 [268]=3 [269]=3 [120]=3 [272]=3 [273]=3 [281]=3 [124]=3 [126]=3 [279]=3 [127]=3 [282]=3 [128]=3 [130]=3 [284]=3 [131]=3 [286]=3 [288]=3 [134]=3 [135]=3 [136]=3 [137]=3 [138]=3 [293]=3 [142]=3 [294]=3 [143]=3 [296]=3 [297]=3 [298]=3 [1]=3 [300]=3)"
literal_transitions[8]="([289]=3)"
literal_transitions[9]="([3]=3 [123]=3 [243]=3 [162]=3 [261]=3 [283]=3 [179]=3)"
literal_transitions[10]="([108]=3 [148]=3 [69]=3 [36]=3 [195]=3 [112]=3 [196]=3 [7]=16 [72]=3 [151]=3 [199]=3 [262]=3 [206]=3 [227]=3 [236]=3 [11]=3 [270]=3 [81]=3 [118]=3 [83]=3 [119]=3 [121]=3 [122]=3 [161]=3 [164]=3 [87]=3 [165]=3 [214]=3 [169]=3 [215]=3 [18]=3 [55]=3 [174]=3 [241]=3 [132]=3 [21]=3 [20]=3 [22]=3 [218]=3 [275]=3 [276]=3 [62]=3 [278]=3 [139]=3 [280]=3 [290]=3 [291]=3 [63]=3 [185]=3 [101]=3 [144]=3 [225]=3 [295]=3 [191]=3 [299]=3 [192]=3)"
literal_transitions[11]="([68]=3 [129]=3 [199]=3 [74]=3 [61]=3 [265]=3 [75]=3 [115]=4 [140]=3 [232]=3 [63]=3 [158]=3 [65]=3 [253]=3 [215]=3 [145]=3 [35]=3)"
literal_transitions[13]="([203]=17 [64]=19)"
literal_transitions[16]="([59]=3 [149]=3)"
literal_transitions[17]="([171]=3 [19]=3 [146]=3 [230]=3)"
literal_transitions[18]="([17]=3 [107]=3)"
local -A match_anything_transitions
match_anything_transitions=([4]=3 [14]=1 [12]=3 [6]=3 [15]=18 [19]=3)
declare -A subword_transitions
local state=1
local word_index=2
while [[ $word_index -lt $CURRENT ]]; do
if [[ -v "literal_transitions[$state]" ]]; then
local state_transitions_initializer=${literal_transitions[$state]}
local -A state_transitions
eval "state_transitions=$state_transitions_initializer"
local word=${words[$word_index]}
local word_matched=0
for literal_id in {1..$#literals}; do
if [[ ${literals[$literal_id]} = "$word" ]]; then
if [[ -v "state_transitions[$literal_id]" ]]; then
state=${state_transitions[$literal_id]}
word_index=$((word_index + 1))
word_matched=1
break
fi
fi
done
if [[ $word_matched -ne 0 ]]; then
continue
fi
fi
if [[ -v "match_anything_transitions[$state]" ]]; then
state=${match_anything_transitions[$state]}
word_index=$((word_index + 1))
continue
fi
return 1
done
args=()
no_descr_args=()
descrs=()
compadd_completions=()
compadd_descriptions=()
if [[ -v "literal_transitions[$state]" ]]; then
local state_transitions_initializer=${literal_transitions[$state]}
local -A state_transitions
eval "state_transitions=$state_transitions_initializer"
for literal_id in ${(k)state_transitions}; do
if [[ -v "descriptions[$literal_id]" ]]; then
args+=("${literals[$literal_id]}")
descrs+=("${literals[$literal_id]//:/\\:}:${descriptions[$literal_id]}")
else
no_descr_args+=("${literals[$literal_id]}")
fi
done
fi
local -A commands=([19]=3 [12]=1 [14]=0 [15]=2)
if [[ -v "commands[$state]" ]]; then
local command_id=${commands[$state]}
local output=$(_hyprctl_cmd_${command_id} "${words[$CURRENT]}")
local -a command_completions=("${(@f)output}")
for line in ${command_completions[@]}; do
local parts=(${(@s: :)line})
if [[ -v "parts[2]" ]]; then
args+=(${parts[1]})
descrs+=("${parts[1]//:/\\:}:${parts[2]}")
else
no_descr_args+=(${parts[1]})
fi
done
fi
local -A specialized_commands=([6]=1 [4]=1)
if [[ -v "specialized_commands[$state]" ]]; then
local command_id=${specialized_commands[$state]}
_hyprctl_spec_${command_id} ${words[$CURRENT]}
fi
compadd -a -Q -S '' no_descr_args
compadd -a -Q -S '' -d compadd_descriptions compadd_completions
_describe '' descrs args -Q -S ''
return 0
}
compdef _hyprctl hyprctl