mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 02:25:59 +01:00
hyprpm: add shell completions (#5423)
* hyprpm: add completions * hyprctl: correct spell mistakes * Apply fixes * makefile: correct shell completion paths * makefile: remove complletions on uninstalling
This commit is contained in:
parent
b50182326c
commit
20899d0df2
9 changed files with 670 additions and 285 deletions
17
Makefile
17
Makefile
|
@ -37,15 +37,18 @@ install:
|
|||
mkdir -p ${PREFIX}/share/wayland-sessions
|
||||
mkdir -p ${PREFIX}/bin
|
||||
mkdir -p ${PREFIX}/share/hyprland
|
||||
mkdir -p ${PREFIX}/share/bash-completion
|
||||
mkdir -p ${PREFIX}/share/fish/completions
|
||||
mkdir -p ${PREFIX}/share/bash-completion/completions
|
||||
mkdir -p ${PREFIX}/share/fish/vendor_completions.d
|
||||
mkdir -p ${PREFIX}/share/zsh/site-functions
|
||||
cp -f ./build/Hyprland ${PREFIX}/bin
|
||||
cp -f ./build/hyprctl/hyprctl ${PREFIX}/bin
|
||||
cp -f ./build/hyprpm/hyprpm ${PREFIX}/bin
|
||||
cp -f ./hyprctl/hyprctl.bash ${PREFIX}/share/bash-completion/hyprctl
|
||||
cp -f ./hyprctl/hyprctl.fish ${PREFIX}/share/fish/completions/hyprctl.fish
|
||||
cp -f ./hyprctl/hyprctl.bash ${PREFIX}/share/bash-completion/completions/hyprctl
|
||||
cp -f ./hyprctl/hyprctl.fish ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish
|
||||
cp -f ./hyprctl/hyprctl.zsh ${PREFIX}/share/zsh/site-functions/_hyprctl
|
||||
cp -f ./hyprpm/hyprpm.bash ${PREFIX}/share/bash-completion/completions/hyprpm
|
||||
cp -f ./hyprpm/hyprpm.fish ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish
|
||||
cp -f ./hyprpm/hyprpm.zsh ${PREFIX}/share/zsh/site-functions/_hyprpm
|
||||
chmod 755 ${PREFIX}/bin/Hyprland
|
||||
chmod 755 ${PREFIX}/bin/hyprctl
|
||||
chmod 755 ${PREFIX}/bin/hyprpm
|
||||
|
@ -73,6 +76,12 @@ uninstall:
|
|||
rm -rf ${PREFIX}/share/hyprland
|
||||
rm -f ${PREFIX}/share/man/man1/Hyprland.1
|
||||
rm -f ${PREFIX}/share/man/man1/hyprctl.1
|
||||
rm -f ${PREFIX}/share/bash-completion/completions/hyprctl
|
||||
rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish
|
||||
rm -f ${PREFIX}/share/zsh/site-functions/_hyprctl
|
||||
rm -f ${PREFIX}/share/bash-completion/completions/hyprpm
|
||||
rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish
|
||||
rm -f ${PREFIX}/share/zsh/site-functions/_hyprpm
|
||||
|
||||
pluginenv:
|
||||
@echo -en "$(MAKE) pluginenv has been deprecated.\nPlease run $(MAKE) all && sudo $(MAKE) installheaders\n"
|
||||
|
|
|
@ -2,16 +2,16 @@ _hyprctl_cmd_2 () {
|
|||
hyprctl monitors | grep Monitor | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_1 () {
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprpm list | grep "Plugin" | awk '{print $4}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
_hyprctl_cmd_1 () {
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_3 () {
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
}
|
||||
|
||||
_hyprctl () {
|
||||
|
@ -23,30 +23,25 @@ _hyprctl () {
|
|||
local words cword
|
||||
_get_comp_words_by_ref -n "$COMP_WORDBREAKS" words cword
|
||||
|
||||
local -a literals=("cyclenext" "globalshortcuts" "cursorpos" "bordersize" "renameworkspace" "animationstyle" "focuswindow" "0" "auto" "swapnext" "forceallowsinput" "moveactive" "activebordercolor" "wayland" "layers" "minsize" "monitors" "1" "3" "settiled" "kill" "focusmonitor" "swapwindow" "moveoutofgroup" "notify" "movecursor" "setcursor" "seterror" "4" "movecurrentworkspacetomonitor" "nomaxsize" "forcenoanims" "setprop" "-i" "togglefloating" "workspacerules" "movetoworkspace" "disable" "setignoregrouplock" "workspaces" "0" "closewindow" "movegroupwindow" "binds" "movewindow" "splitratio" "alpha" "denywindowfromgroup" "workspace" "configerrors" "togglegroup" "getoption" "forceopaque" "keepaspectratio" "--instance" "killactive" "pass" "decorations" "devices" "focuscurrentorlast" "submap" "global" "headless" "forcerendererreload" "movewindowpixel" "version" "dpms" "resizeactive" "moveintogroup" "5" "alphaoverride" "setfloating" "rollinglog" "::=" "rounding" "layouts" "moveworkspacetomonitor" "exec" "alphainactiveoverride" "alterzorder" "fakefullscreen" "nofocus" "keyword" "forcenoborder" "forcenodim" "pin" "output" "forcenoblur" "togglespecialworkspace" "fullscreen" "toggleopaque" "focusworkspaceoncurrentmonitor" "next" "changegroupactive" "-j" "instances" "execr" "exit" "clients" "all" "--batch" "dismissnotify" "inactivebordercolor" "switchxkblayout" "movetoworkspacesilent" "movewindoworgroup" "-r" "movefocus" "focusurgentorlast" "remove" "activeworkspace" "dispatch" "create" "centerwindow" "2" "hyprpaper" "-1" "reload" "alphainactive" "systeminfo" "plugin" "dimaround" "activewindow" "swapactiveworkspaces" "splash" "maxsize" "lockactivegroup" "windowdancecompat" "forceopaqueoverriden" "lockgroups" "movecursortocorner" "x11" "prev" "1" "resizewindowpixel" "forcenoshadow")
|
||||
local -a literals=("resizeactive" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "animationstyle" "setprop" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-i" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "auto" "forcerendererreload" "centerwindow" "focuswindow" "seterror" "nofocus" "version" "binds" "togglespecialworkspace" "fullscreen" "windowdancecompat" "globalshortcuts" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "disable" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize")
|
||||
|
||||
declare -A literal_transitions
|
||||
literal_transitions[0]="([101]=1 [72]=2 [32]=3 [1]=2 [2]=2 [75]=2 [103]=4 [35]=2 [106]=5 [39]=2 [43]=2 [110]=2 [82]=6 [111]=8 [49]=2 [51]=2 [86]=9 [115]=2 [117]=2 [119]=2 [14]=2 [57]=10 [58]=2 [16]=11 [120]=12 [20]=2 [122]=2 [124]=2 [24]=13 [65]=2 [94]=5 [95]=2 [26]=2 [27]=14 [98]=2 [100]=5)"
|
||||
literal_transitions[3]="([70]=26 [31]=26 [52]=26 [53]=26 [87]=26 [102]=2 [118]=2 [74]=1 [15]=2 [121]=26 [3]=1 [5]=2 [125]=2 [127]=26 [78]=26 [128]=26 [81]=26 [30]=26 [46]=2 [12]=2 [83]=26 [10]=26 [84]=26 [135]=26)"
|
||||
literal_transitions[7]="([101]=1 [72]=2 [32]=3 [1]=2 [2]=2 [75]=2 [103]=4 [35]=2 [39]=2 [43]=2 [110]=2 [82]=6 [111]=8 [49]=2 [51]=2 [86]=9 [115]=2 [117]=2 [119]=2 [14]=2 [57]=10 [58]=2 [16]=11 [120]=12 [20]=2 [122]=2 [124]=2 [24]=13 [65]=2 [95]=2 [26]=2 [27]=14 [98]=2)"
|
||||
literal_transitions[8]="([126]=2 [129]=2 [0]=2 [71]=2 [34]=2 [104]=2 [36]=2 [105]=2 [4]=2 [76]=2 [38]=2 [77]=2 [108]=2 [6]=2 [42]=2 [41]=2 [79]=2 [80]=2 [44]=2 [45]=2 [9]=2 [107]=2 [48]=2 [50]=2 [11]=2 [113]=2 [85]=2 [47]=2 [55]=2 [88]=2 [56]=2 [89]=2 [90]=2 [59]=2 [60]=2 [123]=2 [91]=2 [61]=2 [19]=2 [93]=2 [21]=2 [22]=2 [63]=2 [64]=2 [23]=2 [130]=2 [25]=2 [66]=2 [96]=2 [67]=2 [29]=2 [134]=2 [68]=2 [97]=2)"
|
||||
literal_transitions[9]="([112]=17 [109]=20)"
|
||||
literal_transitions[10]="([18]=2 [114]=2 [28]=2 [133]=2 [69]=2 [116]=2)"
|
||||
literal_transitions[11]="([99]=2)"
|
||||
literal_transitions[14]="([37]=2)"
|
||||
literal_transitions[15]="([73]=16)"
|
||||
literal_transitions[17]="([8]=2 [62]=2 [13]=2 [131]=2)"
|
||||
literal_transitions[18]="([73]=19)"
|
||||
literal_transitions[22]="([73]=23)"
|
||||
literal_transitions[23]="([40]=2)"
|
||||
literal_transitions[24]="([33]=5 [54]=5)"
|
||||
literal_transitions[25]="([73]=24)"
|
||||
literal_transitions[26]="([17]=2 [7]=2)"
|
||||
literal_transitions[27]="([132]=2 [92]=2)"
|
||||
literal_transitions[29]="([73]=32)"
|
||||
literal_transitions[0]="([74]=2 [2]=19 [47]=2 [46]=2 [112]=2 [7]=2 [80]=2 [9]=2 [11]=3 [114]=4 [12]=5 [87]=6 [89]=2 [117]=7 [90]=2 [21]=2 [18]=2 [120]=2 [123]=8 [24]=2 [94]=2 [95]=9 [127]=2 [62]=2 [101]=2 [32]=2 [71]=19 [35]=2 [132]=2 [103]=2 [37]=10 [105]=11 [72]=13 [107]=12 [108]=2 [110]=19)"
|
||||
literal_transitions[1]="([47]=2 [46]=2 [112]=2 [7]=2 [80]=2 [9]=2 [11]=3 [114]=4 [12]=5 [87]=6 [89]=2 [117]=7 [90]=2 [21]=2 [18]=2 [120]=2 [123]=8 [24]=2 [94]=2 [95]=9 [127]=2 [62]=2 [101]=2 [32]=2 [35]=2 [103]=2 [37]=10 [105]=11 [108]=2 [107]=12 [72]=13 [132]=2 [74]=2)"
|
||||
literal_transitions[3]="([122]=2 [57]=14 [58]=14 [41]=14 [93]=14 [26]=2 [25]=2 [48]=4 [4]=14 [60]=2 [61]=14 [113]=14 [10]=2 [67]=4 [33]=14 [133]=14 [88]=14 [53]=14 [104]=14 [39]=14 [16]=2 [121]=14 [135]=2 [109]=14)"
|
||||
literal_transitions[6]="([111]=2)"
|
||||
literal_transitions[10]="([8]=2)"
|
||||
literal_transitions[11]="([13]=16 [73]=20)"
|
||||
literal_transitions[12]="([0]=2 [75]=2 [1]=2 [76]=2 [42]=2 [43]=2 [3]=2 [44]=2 [45]=2 [78]=2 [79]=2 [49]=2 [81]=2 [51]=2 [82]=2 [84]=2 [85]=2 [115]=2 [86]=2 [116]=2 [14]=2 [118]=2 [54]=2 [119]=2 [17]=2 [91]=2 [20]=2 [92]=2 [22]=2 [124]=2 [23]=2 [59]=2 [125]=2 [27]=2 [28]=2 [29]=2 [96]=2 [126]=2 [128]=2 [63]=2 [31]=2 [64]=2 [65]=2 [66]=2 [99]=2 [68]=2 [34]=2 [69]=2 [36]=2 [100]=2 [129]=2 [106]=2 [131]=2 [134]=2)"
|
||||
literal_transitions[13]="([77]=4 [5]=4 [97]=4 [55]=4 [70]=4 [50]=4 [56]=4)"
|
||||
literal_transitions[14]="([38]=2 [40]=2)"
|
||||
literal_transitions[15]="([30]=2 [130]=2)"
|
||||
literal_transitions[16]="([83]=2 [15]=2 [102]=2 [19]=2)"
|
||||
literal_transitions[17]="([6]=18)"
|
||||
literal_transitions[18]="([52]=19 [98]=19)"
|
||||
|
||||
declare -A match_anything_transitions
|
||||
match_anything_transitions=([1]=2 [27]=2 [10]=31 [30]=22 [14]=25 [7]=7 [2]=25 [28]=29 [16]=21 [12]=2 [31]=15 [0]=7 [19]=28 [20]=2 [6]=2 [32]=30 [13]=1 [11]=25 [21]=18 [4]=27)
|
||||
match_anything_transitions=([15]=2 [6]=17 [7]=2 [0]=1 [5]=15 [4]=2 [2]=17 [20]=2 [8]=2 [9]=2 [10]=17 [1]=1)
|
||||
declare -A subword_transitions
|
||||
|
||||
local state=0
|
||||
|
@ -113,7 +108,7 @@ _hyprctl () {
|
|||
done
|
||||
fi
|
||||
declare -A commands
|
||||
commands=([32]=3 [16]=1 [19]=2 [10]=0)
|
||||
commands=([7]=0 [20]=2 [8]=3 [5]=1)
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
local completions=()
|
||||
|
|
|
@ -3,19 +3,19 @@ function _hyprctl_3
|
|||
hyprctl monitors | grep Monitor | awk '{ print $2 }'
|
||||
end
|
||||
|
||||
function _hyprctl_2
|
||||
function _hyprctl_1
|
||||
set 1 $argv[1]
|
||||
hyprpm list | grep "Plugin" | awk '{print $4}'
|
||||
end
|
||||
|
||||
function _hyprctl_1
|
||||
function _hyprctl_2
|
||||
set 1 $argv[1]
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
end
|
||||
|
||||
function _hyprctl_4
|
||||
set 1 $argv[1]
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
end
|
||||
|
||||
function _hyprctl
|
||||
|
@ -29,130 +29,125 @@ function _hyprctl
|
|||
set COMP_CWORD (count $COMP_WORDS)
|
||||
end
|
||||
|
||||
set --local literals "cyclenext" "globalshortcuts" "cursorpos" "bordersize" "renameworkspace" "animationstyle" "focuswindow" "0" "auto" "swapnext" "forceallowsinput" "moveactive" "activebordercolor" "wayland" "layers" "minsize" "monitors" "1" "3" "settiled" "kill" "focusmonitor" "swapwindow" "moveoutofgroup" "notify" "movecursor" "setcursor" "seterror" "4" "movecurrentworkspacetomonitor" "nomaxsize" "forcenoanims" "setprop" "-i" "togglefloating" "workspacerules" "movetoworkspace" "disable" "setignoregrouplock" "workspaces" "0" "closewindow" "movegroupwindow" "binds" "movewindow" "splitratio" "alpha" "denywindowfromgroup" "workspace" "configerrors" "togglegroup" "getoption" "forceopaque" "keepaspectratio" "--instance" "killactive" "pass" "decorations" "devices" "focuscurrentorlast" "submap" "global" "headless" "forcerendererreload" "movewindowpixel" "version" "dpms" "resizeactive" "moveintogroup" "5" "alphaoverride" "setfloating" "rollinglog" "::=" "rounding" "layouts" "moveworkspacetomonitor" "exec" "alphainactiveoverride" "alterzorder" "fakefullscreen" "nofocus" "keyword" "forcenoborder" "forcenodim" "pin" "output" "forcenoblur" "togglespecialworkspace" "fullscreen" "toggleopaque" "focusworkspaceoncurrentmonitor" "next" "changegroupactive" "-j" "instances" "execr" "exit" "clients" "all" "--batch" "dismissnotify" "inactivebordercolor" "switchxkblayout" "movetoworkspacesilent" "movewindoworgroup" "-r" "movefocus" "focusurgentorlast" "remove" "activeworkspace" "dispatch" "create" "centerwindow" "2" "hyprpaper" "-1" "reload" "alphainactive" "systeminfo" "plugin" "dimaround" "activewindow" "swapactiveworkspaces" "splash" "maxsize" "lockactivegroup" "windowdancecompat" "forceopaqueoverriden" "lockgroups" "movecursortocorner" "x11" "prev" "1" "resizewindowpixel" "forcenoshadow"
|
||||
set --local literals "resizeactive" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "animationstyle" "setprop" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-i" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "auto" "forcerendererreload" "centerwindow" "focuswindow" "seterror" "nofocus" "version" "binds" "togglespecialworkspace" "fullscreen" "windowdancecompat" "globalshortcuts" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "disable" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize"
|
||||
|
||||
set --local descriptions
|
||||
set descriptions[1] "Focus the next window on a workspace"
|
||||
set descriptions[3] "Get the current cursor pos in global layout coordinates"
|
||||
set descriptions[5] "Rename a workspace"
|
||||
set descriptions[7] "Focus the first window matching"
|
||||
set descriptions[10] "Swap the focused window with the next window"
|
||||
set descriptions[12] "Move the active window"
|
||||
set descriptions[15] "List the layers"
|
||||
set descriptions[17] "List active outputs with their properties"
|
||||
set descriptions[19] "ERROR"
|
||||
set descriptions[20] "Set the current window's floating state to false"
|
||||
set descriptions[21] "Get into a kill mode, where you can kill an app by clicking on it"
|
||||
set descriptions[22] "Focus a monitor"
|
||||
set descriptions[23] "Swap the active window with another window"
|
||||
set descriptions[24] "Move the active window out of a group"
|
||||
set descriptions[25] "Send a notification using the built-in Hyprland notification system"
|
||||
set descriptions[26] "Move the cursor to a specified position"
|
||||
set descriptions[27] "Set the cursor theme and reloads the cursor manager"
|
||||
set descriptions[28] "Set the hyprctl error string"
|
||||
set descriptions[29] "CONFUSED"
|
||||
set descriptions[30] "Move the active workspace to a monitor"
|
||||
set descriptions[33] "Set a property of a window"
|
||||
set descriptions[34] "Specify the Hyprland instance"
|
||||
set descriptions[35] "Toggle the current window's floating state"
|
||||
set descriptions[36] "Get the list of defined workspace rules"
|
||||
set descriptions[37] "Move the focused window to a workspace"
|
||||
set descriptions[39] "Temporarily enable or disable binds:ignore_group_lock"
|
||||
set descriptions[40] "List all workspaces with their properties"
|
||||
set descriptions[41] "WARNING"
|
||||
set descriptions[42] "Close a specified window"
|
||||
set descriptions[43] "Swap the active window with the next or previous in a group"
|
||||
set descriptions[44] "List all registered binds"
|
||||
set descriptions[45] "Move the active window in a direction or to a monitor"
|
||||
set descriptions[46] "Change the split ratio"
|
||||
set descriptions[48] "Prohibit the active window from becoming or being inserted into group"
|
||||
set descriptions[49] "Change the workspace"
|
||||
set descriptions[50] "List all current config parsing errors"
|
||||
set descriptions[51] "Toggle the current active window into a group"
|
||||
set descriptions[52] "Get the config option status (values)"
|
||||
set descriptions[55] "Specify the Hyprland instance"
|
||||
set descriptions[56] "Close the active window"
|
||||
set descriptions[57] "Pass the key to a specified window"
|
||||
set descriptions[58] "List all decorations and their info"
|
||||
set descriptions[59] "List all connected keyboards and mice"
|
||||
set descriptions[60] "Switch focus from current to previously focused window"
|
||||
set descriptions[61] "Change the current mapping group"
|
||||
set descriptions[62] "Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
set descriptions[64] "Force the renderer to reload all resources and outputs"
|
||||
set descriptions[65] "Move a selected window"
|
||||
set descriptions[66] "Print the Hyprland version: flags, commit and branch of build"
|
||||
set descriptions[67] "Set all monitors' DPMS status"
|
||||
set descriptions[68] "Resize the active window"
|
||||
set descriptions[69] "Move the active window into a group"
|
||||
set descriptions[70] "OK"
|
||||
set descriptions[72] "Set the current window's floating state to true"
|
||||
set descriptions[73] "Print tail of the log"
|
||||
set descriptions[76] "List all layouts available (including plugin ones)"
|
||||
set descriptions[77] "Move a workspace to a monitor"
|
||||
set descriptions[78] "Execute a shell command"
|
||||
set descriptions[80] "Modify the window stack order of the active or specified window"
|
||||
set descriptions[81] "Toggle the focused window's internal fullscreen state"
|
||||
set descriptions[83] "Issue a keyword to call a config keyword dynamically"
|
||||
set descriptions[86] "Pin a window"
|
||||
set descriptions[87] "Allows adding/removing fake outputs to a specific backend"
|
||||
set descriptions[89] "Toggle a special workspace on/off"
|
||||
set descriptions[90] "Toggle the focused window's fullscreen state"
|
||||
set descriptions[91] "Toggle the current window to always be opaque"
|
||||
set descriptions[92] "Focus the requested workspace"
|
||||
set descriptions[94] "Switch to the next window in a group"
|
||||
set descriptions[95] "Output in JSON format"
|
||||
set descriptions[96] "List all running Hyprland instances and their info"
|
||||
set descriptions[97] "Execute a raw shell command"
|
||||
set descriptions[98] "Exit the compositor with no questions asked"
|
||||
set descriptions[99] "List all windows with their properties"
|
||||
set descriptions[101] "Execute a batch of commands separated by ;"
|
||||
set descriptions[102] "Dismiss all or up to amount of notifications"
|
||||
set descriptions[104] "Set the xkb layout index for a keyboard"
|
||||
set descriptions[105] "Move window doesnt switch to the workspace"
|
||||
set descriptions[106] "Behave as moveintogroup"
|
||||
set descriptions[107] "Refresh state after issuing the command"
|
||||
set descriptions[108] "Move the focus in a direction"
|
||||
set descriptions[109] "Focus the urgent window or the last window"
|
||||
set descriptions[111] "Get the active workspace name and its properties"
|
||||
set descriptions[112] "Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
set descriptions[114] "Center the active window"
|
||||
set descriptions[115] "HINT"
|
||||
set descriptions[116] "Interact with hyprpaper if present"
|
||||
set descriptions[117] "No Icon"
|
||||
set descriptions[118] "Force reload the config"
|
||||
set descriptions[120] "Print system info"
|
||||
set descriptions[121] "Interact with a plugin"
|
||||
set descriptions[123] "Get the active window name and its properties"
|
||||
set descriptions[124] "Swap the active workspaces between two monitors"
|
||||
set descriptions[125] "Print the current random splash"
|
||||
set descriptions[127] "Lock the focused group"
|
||||
set descriptions[130] "Lock the groups"
|
||||
set descriptions[131] "Move the cursor to the corner of the active window"
|
||||
set descriptions[134] "INFO"
|
||||
set descriptions[135] "Resize a selected window"
|
||||
set descriptions[1] "Resize the active window"
|
||||
set descriptions[2] "Switch to the next window in a group"
|
||||
set descriptions[3] "Refresh state after issuing the command"
|
||||
set descriptions[4] "Move the active window into a group"
|
||||
set descriptions[6] "CONFUSED"
|
||||
set descriptions[8] "Print system info"
|
||||
set descriptions[10] "List all layouts available (including plugin ones)"
|
||||
set descriptions[12] "Set a property of a window"
|
||||
set descriptions[13] "Set the xkb layout index for a keyboard"
|
||||
set descriptions[15] "Prohibit the active window from becoming or being inserted into group"
|
||||
set descriptions[18] "Execute a shell command"
|
||||
set descriptions[19] "Set the cursor theme and reloads the cursor manager"
|
||||
set descriptions[21] "Focus the urgent window or the last window"
|
||||
set descriptions[22] "Get the list of defined workspace rules"
|
||||
set descriptions[23] "Move the active workspace to a monitor"
|
||||
set descriptions[24] "Move window doesnt switch to the workspace"
|
||||
set descriptions[25] "Interact with hyprpaper if present"
|
||||
set descriptions[28] "Swap the active window with the next or previous in a group"
|
||||
set descriptions[29] "Move the cursor to the corner of the active window"
|
||||
set descriptions[30] "Move a selected window"
|
||||
set descriptions[32] "Move the active window in a direction or to a monitor"
|
||||
set descriptions[33] "List all windows with their properties"
|
||||
set descriptions[35] "Temporarily enable or disable binds:ignore_group_lock"
|
||||
set descriptions[36] "Print the current random splash"
|
||||
set descriptions[37] "Execute a raw shell command"
|
||||
set descriptions[38] "List active outputs with their properties"
|
||||
set descriptions[43] "Change the split ratio"
|
||||
set descriptions[44] "Move the active window"
|
||||
set descriptions[45] "Pass the key to a specified window"
|
||||
set descriptions[46] "Swap the focused window with the next window"
|
||||
set descriptions[47] "List all connected keyboards and mice"
|
||||
set descriptions[48] "List the layers"
|
||||
set descriptions[50] "Lock the focused group"
|
||||
set descriptions[51] "OK"
|
||||
set descriptions[52] "Move a workspace to a monitor"
|
||||
set descriptions[53] "Specify the Hyprland instance"
|
||||
set descriptions[55] "Pin a window"
|
||||
set descriptions[56] "WARNING"
|
||||
set descriptions[57] "INFO"
|
||||
set descriptions[60] "Set the current window's floating state to true"
|
||||
set descriptions[63] "List all workspaces with their properties"
|
||||
set descriptions[64] "Focus the next window on a workspace"
|
||||
set descriptions[65] "Modify the window stack order of the active or specified window"
|
||||
set descriptions[66] "Toggle the current active window into a group"
|
||||
set descriptions[67] "Lock the groups"
|
||||
set descriptions[69] "Set all monitors' DPMS status"
|
||||
set descriptions[70] "Switch focus from current to previously focused window"
|
||||
set descriptions[71] "No Icon"
|
||||
set descriptions[72] "Execute a batch of commands separated by ;"
|
||||
set descriptions[73] "Send a notification using the built-in Hyprland notification system"
|
||||
set descriptions[75] "List all running Hyprland instances and their info"
|
||||
set descriptions[76] "Move the active window out of a group"
|
||||
set descriptions[77] "Close the active window"
|
||||
set descriptions[78] "HINT"
|
||||
set descriptions[79] "Move the focused window to a workspace"
|
||||
set descriptions[80] "Move the cursor to a specified position"
|
||||
set descriptions[81] "List all current config parsing errors"
|
||||
set descriptions[82] "Close a specified window"
|
||||
set descriptions[83] "Swap the active window with another window"
|
||||
set descriptions[85] "Force the renderer to reload all resources and outputs"
|
||||
set descriptions[86] "Center the active window"
|
||||
set descriptions[87] "Focus the first window matching"
|
||||
set descriptions[88] "Set the hyprctl error string"
|
||||
set descriptions[90] "Print the Hyprland version: flags, commit and branch of build"
|
||||
set descriptions[91] "List all registered binds"
|
||||
set descriptions[92] "Toggle a special workspace on/off"
|
||||
set descriptions[93] "Toggle the focused window's fullscreen state"
|
||||
set descriptions[96] "Issue a keyword to call a config keyword dynamically"
|
||||
set descriptions[97] "Toggle the current window to always be opaque"
|
||||
set descriptions[98] "ERROR"
|
||||
set descriptions[99] "Specify the Hyprland instance"
|
||||
set descriptions[100] "Toggle the current window's floating state"
|
||||
set descriptions[101] "Rename a workspace"
|
||||
set descriptions[102] "Get the active workspace name and its properties"
|
||||
set descriptions[104] "Get into a kill mode, where you can kill an app by clicking on it"
|
||||
set descriptions[106] "Allows adding/removing fake outputs to a specific backend"
|
||||
set descriptions[107] "Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
set descriptions[108] "Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
set descriptions[109] "Force reload the config"
|
||||
set descriptions[111] "Output in JSON format"
|
||||
set descriptions[113] "Get the active window name and its properties"
|
||||
set descriptions[115] "Dismiss all or up to amount of notifications"
|
||||
set descriptions[116] "Focus a monitor"
|
||||
set descriptions[117] "Move the focus in a direction"
|
||||
set descriptions[118] "Interact with a plugin"
|
||||
set descriptions[119] "Exit the compositor with no questions asked"
|
||||
set descriptions[120] "Change the workspace"
|
||||
set descriptions[121] "Get the config option status (values)"
|
||||
set descriptions[124] "List all decorations and their info"
|
||||
set descriptions[125] "Set the current window's floating state to false"
|
||||
set descriptions[126] "Resize a selected window"
|
||||
set descriptions[127] "Toggle the focused window's internal fullscreen state"
|
||||
set descriptions[128] "Print tail of the log"
|
||||
set descriptions[129] "Swap the active workspaces between two monitors"
|
||||
set descriptions[130] "Change the current mapping group"
|
||||
set descriptions[132] "Behave as moveintogroup"
|
||||
set descriptions[133] "Get the current cursor pos in global layout coordinates"
|
||||
set descriptions[135] "Focus the requested workspace"
|
||||
|
||||
set --local literal_transitions
|
||||
set literal_transitions[1] "set inputs 102 73 33 2 3 76 104 36 107 40 44 111 83 112 50 52 87 116 118 120 15 58 59 17 121 21 123 125 25 66 95 96 27 28 99 101; set tos 2 3 4 3 3 3 5 3 6 3 3 3 7 9 3 3 10 3 3 3 3 11 3 12 13 3 3 3 14 3 6 3 3 15 3 6"
|
||||
set literal_transitions[4] "set inputs 71 32 53 54 88 103 119 75 16 122 4 6 126 128 79 129 82 31 47 13 84 11 85 136; set tos 27 27 27 27 27 3 3 2 3 27 2 3 3 27 27 27 27 27 3 3 27 27 27 27"
|
||||
set literal_transitions[8] "set inputs 102 73 33 2 3 76 104 36 40 44 111 83 112 50 52 87 116 118 120 15 58 59 17 121 21 123 125 25 66 96 27 28 99; set tos 2 3 4 3 3 3 5 3 3 3 3 7 9 3 3 10 3 3 3 3 11 3 12 13 3 3 3 14 3 3 3 15 3"
|
||||
set literal_transitions[9] "set inputs 127 130 1 72 35 105 37 106 5 77 39 78 109 7 43 42 80 81 45 46 10 108 49 51 12 114 86 48 56 89 57 90 91 60 61 124 92 62 20 94 22 23 64 65 24 131 26 67 97 68 30 135 69 98; set tos 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"
|
||||
set literal_transitions[10] "set inputs 113 110; set tos 18 21"
|
||||
set literal_transitions[11] "set inputs 19 115 29 134 70 117; set tos 3 3 3 3 3 3"
|
||||
set literal_transitions[12] "set inputs 100; set tos 3"
|
||||
set literal_transitions[15] "set inputs 38; set tos 3"
|
||||
set literal_transitions[16] "set inputs 74; set tos 17"
|
||||
set literal_transitions[18] "set inputs 9 63 14 132; set tos 3 3 3 3"
|
||||
set literal_transitions[19] "set inputs 74; set tos 20"
|
||||
set literal_transitions[23] "set inputs 74; set tos 24"
|
||||
set literal_transitions[24] "set inputs 41; set tos 3"
|
||||
set literal_transitions[25] "set inputs 34 55; set tos 6 6"
|
||||
set literal_transitions[26] "set inputs 74; set tos 25"
|
||||
set literal_transitions[27] "set inputs 18 8; set tos 3 3"
|
||||
set literal_transitions[28] "set inputs 133 93; set tos 3 3"
|
||||
set literal_transitions[30] "set inputs 74; set tos 33"
|
||||
set literal_transitions[1] "set inputs 75 3 48 47 113 8 81 10 12 115 13 88 90 118 91 22 19 121 124 25 95 96 128 63 102 33 72 36 133 104 38 106 73 108 109 111; set tos 3 20 3 3 3 3 3 3 4 5 6 7 3 8 3 3 3 3 9 3 3 10 3 3 3 3 20 3 3 3 11 12 14 13 3 20"
|
||||
set literal_transitions[2] "set inputs 48 47 113 8 81 10 12 115 13 88 90 118 91 22 19 121 124 25 95 96 128 63 102 33 36 104 38 106 109 108 73 133 75; set tos 3 3 3 3 3 3 4 5 6 7 3 8 3 3 3 3 9 3 3 10 3 3 3 3 3 3 11 12 3 13 14 3 3"
|
||||
set literal_transitions[4] "set inputs 123 58 59 42 94 27 26 49 5 61 62 114 11 68 34 134 89 54 105 40 17 122 136 110; set tos 3 15 15 15 15 3 3 5 15 3 15 15 3 5 15 15 15 15 15 15 3 15 3 15"
|
||||
set literal_transitions[7] "set inputs 112; set tos 3"
|
||||
set literal_transitions[11] "set inputs 9; set tos 3"
|
||||
set literal_transitions[12] "set inputs 14 74; set tos 17 21"
|
||||
set literal_transitions[13] "set inputs 1 76 2 77 43 44 4 45 46 79 80 50 82 52 83 85 86 116 87 117 15 119 55 120 18 92 21 93 23 125 24 60 126 28 29 30 97 127 129 64 32 65 66 67 100 69 35 70 37 101 130 107 132 135; set tos 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"
|
||||
set literal_transitions[14] "set inputs 78 6 98 56 71 51 57; set tos 5 5 5 5 5 5 5"
|
||||
set literal_transitions[15] "set inputs 39 41; set tos 3 3"
|
||||
set literal_transitions[16] "set inputs 31 131; set tos 3 3"
|
||||
set literal_transitions[17] "set inputs 84 16 103 20; set tos 3 3 3 3"
|
||||
set literal_transitions[18] "set inputs 7; set tos 19"
|
||||
set literal_transitions[19] "set inputs 53 99; set tos 20 20"
|
||||
|
||||
set --local match_anything_transitions_from 2 28 11 31 15 8 3 29 17 13 32 1 20 21 7 33 14 12 22 5
|
||||
set --local match_anything_transitions_to 3 3 32 23 26 8 26 30 22 3 16 8 29 3 3 31 2 26 19 28
|
||||
set --local match_anything_transitions_from 16 7 8 1 6 5 3 21 9 10 11 2
|
||||
set --local match_anything_transitions_to 3 18 3 2 16 3 18 3 3 3 18 2
|
||||
|
||||
set --local state 1
|
||||
set --local word_index 2
|
||||
|
@ -204,8 +199,8 @@ function _hyprctl
|
|||
end
|
||||
end
|
||||
|
||||
set command_states 33 17 20 11
|
||||
set command_ids 4 2 3 1
|
||||
set command_states 8 21 9 6
|
||||
set command_ids 1 3 4 2
|
||||
if contains $state $command_states
|
||||
set --local index (contains --index $state $command_states)
|
||||
set --local function_id $command_ids[$index]
|
||||
|
|
|
@ -10,13 +10,13 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
|||
| (--batch) "Execute a batch of commands separated by ;"
|
||||
;
|
||||
|
||||
<WINDOWS> ::= {{{ hyprctl clients | grep class | awk '{print $2}' }}}
|
||||
<WINDOWS> ::= {{{ hyprctl clients | grep class | awk '{print $2}' }}};
|
||||
|
||||
<AVAILABLE_PLUGINS> ::= {{{ hyprpm list | grep "Plugin" | awk '{print $4}' }}}
|
||||
<AVAILABLE_PLUGINS> ::= {{{ hyprpm list | grep "Plugin" | awk '{print $4}' }}};
|
||||
|
||||
<MONITORS> ::= {{{ hyprctl monitors | grep Monitor | awk '{ print $2 }' }}}
|
||||
<MONITORS> ::= {{{ hyprctl monitors | grep Monitor | awk '{ print $2 }' }}};
|
||||
|
||||
<KEYBOARDS> ::= {{{ hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}' }}}
|
||||
<KEYBOARDS> ::= {{{ hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}' }}};
|
||||
|
||||
<NOTIFICATION_TYPES> ::= (0) "WARNING"
|
||||
| (1) "INFO"
|
||||
|
@ -75,7 +75,7 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
|||
| (monitors [all]) "List active outputs with their properties"
|
||||
| (notify <NOTIFICATION_TYPES> <NUM>) "Send a notification using the built-in Hyprland notification system"
|
||||
| (output (create (wayland | x11 | headless | auto) | remove <MONITORS>)) "Allows adding/removing fake outputs to a specific backend"
|
||||
| (plugin <AVIABLE_PLUGINS>) "Interact with a plugin"
|
||||
| (plugin <AVAILABLE_PLUGINS>) "Interact with a plugin"
|
||||
| (reload) "Force reload the config"
|
||||
| (rollinglog) "Print tail of the log"
|
||||
| (setcursor) "Set the cursor theme and reloads the cursor manager"
|
||||
|
|
|
@ -1,144 +1,141 @@
|
|||
#compdef hyprctl
|
||||
|
||||
_hyprctl_cmd_2 () {
|
||||
hyprctl monitors | grep Monitor | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_1 () {
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprpm list | grep "Plugin" | awk '{print $4}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_3 () {
|
||||
_hyprctl_cmd_1 () {
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_3 () {
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
}
|
||||
|
||||
_hyprctl () {
|
||||
local -a literals=("cyclenext" "globalshortcuts" "cursorpos" "bordersize" "renameworkspace" "animationstyle" "focuswindow" "0" "auto" "swapnext" "forceallowsinput" "moveactive" "activebordercolor" "wayland" "layers" "minsize" "monitors" "1" "3" "settiled" "kill" "focusmonitor" "swapwindow" "moveoutofgroup" "notify" "movecursor" "setcursor" "seterror" "4" "movecurrentworkspacetomonitor" "nomaxsize" "forcenoanims" "setprop" "-i" "togglefloating" "workspacerules" "movetoworkspace" "disable" "setignoregrouplock" "workspaces" "0" "closewindow" "movegroupwindow" "binds" "movewindow" "splitratio" "alpha" "denywindowfromgroup" "workspace" "configerrors" "togglegroup" "getoption" "forceopaque" "keepaspectratio" "--instance" "killactive" "pass" "decorations" "devices" "focuscurrentorlast" "submap" "global" "headless" "forcerendererreload" "movewindowpixel" "version" "dpms" "resizeactive" "moveintogroup" "5" "alphaoverride" "setfloating" "rollinglog" "::=" "rounding" "layouts" "moveworkspacetomonitor" "exec" "alphainactiveoverride" "alterzorder" "fakefullscreen" "nofocus" "keyword" "forcenoborder" "forcenodim" "pin" "output" "forcenoblur" "togglespecialworkspace" "fullscreen" "toggleopaque" "focusworkspaceoncurrentmonitor" "next" "changegroupactive" "-j" "instances" "execr" "exit" "clients" "all" "--batch" "dismissnotify" "inactivebordercolor" "switchxkblayout" "movetoworkspacesilent" "movewindoworgroup" "-r" "movefocus" "focusurgentorlast" "remove" "activeworkspace" "dispatch" "create" "centerwindow" "2" "hyprpaper" "-1" "reload" "alphainactive" "systeminfo" "plugin" "dimaround" "activewindow" "swapactiveworkspaces" "splash" "maxsize" "lockactivegroup" "windowdancecompat" "forceopaqueoverriden" "lockgroups" "movecursortocorner" "x11" "prev" "1" "resizewindowpixel" "forcenoshadow")
|
||||
local -a literals=("resizeactive" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "animationstyle" "setprop" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-i" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "auto" "forcerendererreload" "centerwindow" "focuswindow" "seterror" "nofocus" "version" "binds" "togglespecialworkspace" "fullscreen" "windowdancecompat" "globalshortcuts" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "disable" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize")
|
||||
|
||||
local -A descriptions
|
||||
descriptions[1]="Focus the next window on a workspace"
|
||||
descriptions[3]="Get the current cursor pos in global layout coordinates"
|
||||
descriptions[5]="Rename a workspace"
|
||||
descriptions[7]="Focus the first window matching"
|
||||
descriptions[10]="Swap the focused window with the next window"
|
||||
descriptions[12]="Move the active window"
|
||||
descriptions[15]="List the layers"
|
||||
descriptions[17]="List active outputs with their properties"
|
||||
descriptions[19]="ERROR"
|
||||
descriptions[20]="Set the current window's floating state to false"
|
||||
descriptions[21]="Get into a kill mode, where you can kill an app by clicking on it"
|
||||
descriptions[22]="Focus a monitor"
|
||||
descriptions[23]="Swap the active window with another window"
|
||||
descriptions[24]="Move the active window out of a group"
|
||||
descriptions[25]="Send a notification using the built-in Hyprland notification system"
|
||||
descriptions[26]="Move the cursor to a specified position"
|
||||
descriptions[27]="Set the cursor theme and reloads the cursor manager"
|
||||
descriptions[28]="Set the hyprctl error string"
|
||||
descriptions[29]="CONFUSED"
|
||||
descriptions[30]="Move the active workspace to a monitor"
|
||||
descriptions[33]="Set a property of a window"
|
||||
descriptions[34]="Specify the Hyprland instance"
|
||||
descriptions[35]="Toggle the current window's floating state"
|
||||
descriptions[36]="Get the list of defined workspace rules"
|
||||
descriptions[37]="Move the focused window to a workspace"
|
||||
descriptions[39]="Temporarily enable or disable binds:ignore_group_lock"
|
||||
descriptions[40]="List all workspaces with their properties"
|
||||
descriptions[41]="WARNING"
|
||||
descriptions[42]="Close a specified window"
|
||||
descriptions[43]="Swap the active window with the next or previous in a group"
|
||||
descriptions[44]="List all registered binds"
|
||||
descriptions[45]="Move the active window in a direction or to a monitor"
|
||||
descriptions[46]="Change the split ratio"
|
||||
descriptions[48]="Prohibit the active window from becoming or being inserted into group"
|
||||
descriptions[49]="Change the workspace"
|
||||
descriptions[50]="List all current config parsing errors"
|
||||
descriptions[51]="Toggle the current active window into a group"
|
||||
descriptions[52]="Get the config option status (values)"
|
||||
descriptions[55]="Specify the Hyprland instance"
|
||||
descriptions[56]="Close the active window"
|
||||
descriptions[57]="Pass the key to a specified window"
|
||||
descriptions[58]="List all decorations and their info"
|
||||
descriptions[59]="List all connected keyboards and mice"
|
||||
descriptions[60]="Switch focus from current to previously focused window"
|
||||
descriptions[61]="Change the current mapping group"
|
||||
descriptions[62]="Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
descriptions[64]="Force the renderer to reload all resources and outputs"
|
||||
descriptions[65]="Move a selected window"
|
||||
descriptions[66]="Print the Hyprland version: flags, commit and branch of build"
|
||||
descriptions[67]="Set all monitors' DPMS status"
|
||||
descriptions[68]="Resize the active window"
|
||||
descriptions[69]="Move the active window into a group"
|
||||
descriptions[70]="OK"
|
||||
descriptions[72]="Set the current window's floating state to true"
|
||||
descriptions[73]="Print tail of the log"
|
||||
descriptions[76]="List all layouts available (including plugin ones)"
|
||||
descriptions[77]="Move a workspace to a monitor"
|
||||
descriptions[78]="Execute a shell command"
|
||||
descriptions[80]="Modify the window stack order of the active or specified window"
|
||||
descriptions[81]="Toggle the focused window's internal fullscreen state"
|
||||
descriptions[83]="Issue a keyword to call a config keyword dynamically"
|
||||
descriptions[86]="Pin a window"
|
||||
descriptions[87]="Allows adding/removing fake outputs to a specific backend"
|
||||
descriptions[89]="Toggle a special workspace on/off"
|
||||
descriptions[90]="Toggle the focused window's fullscreen state"
|
||||
descriptions[91]="Toggle the current window to always be opaque"
|
||||
descriptions[92]="Focus the requested workspace"
|
||||
descriptions[94]="Switch to the next window in a group"
|
||||
descriptions[95]="Output in JSON format"
|
||||
descriptions[96]="List all running Hyprland instances and their info"
|
||||
descriptions[97]="Execute a raw shell command"
|
||||
descriptions[98]="Exit the compositor with no questions asked"
|
||||
descriptions[99]="List all windows with their properties"
|
||||
descriptions[101]="Execute a batch of commands separated by ;"
|
||||
descriptions[102]="Dismiss all or up to amount of notifications"
|
||||
descriptions[104]="Set the xkb layout index for a keyboard"
|
||||
descriptions[105]="Move window doesnt switch to the workspace"
|
||||
descriptions[106]="Behave as moveintogroup"
|
||||
descriptions[107]="Refresh state after issuing the command"
|
||||
descriptions[108]="Move the focus in a direction"
|
||||
descriptions[109]="Focus the urgent window or the last window"
|
||||
descriptions[111]="Get the active workspace name and its properties"
|
||||
descriptions[112]="Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
descriptions[114]="Center the active window"
|
||||
descriptions[115]="HINT"
|
||||
descriptions[116]="Interact with hyprpaper if present"
|
||||
descriptions[117]="No Icon"
|
||||
descriptions[118]="Force reload the config"
|
||||
descriptions[120]="Print system info"
|
||||
descriptions[121]="Interact with a plugin"
|
||||
descriptions[123]="Get the active window name and its properties"
|
||||
descriptions[124]="Swap the active workspaces between two monitors"
|
||||
descriptions[125]="Print the current random splash"
|
||||
descriptions[127]="Lock the focused group"
|
||||
descriptions[130]="Lock the groups"
|
||||
descriptions[131]="Move the cursor to the corner of the active window"
|
||||
descriptions[134]="INFO"
|
||||
descriptions[135]="Resize a selected window"
|
||||
descriptions[1]="Resize the active window"
|
||||
descriptions[2]="Switch to the next window in a group"
|
||||
descriptions[3]="Refresh state after issuing the command"
|
||||
descriptions[4]="Move the active window into a group"
|
||||
descriptions[6]="CONFUSED"
|
||||
descriptions[8]="Print system info"
|
||||
descriptions[10]="List all layouts available (including plugin ones)"
|
||||
descriptions[12]="Set a property of a window"
|
||||
descriptions[13]="Set the xkb layout index for a keyboard"
|
||||
descriptions[15]="Prohibit the active window from becoming or being inserted into group"
|
||||
descriptions[18]="Execute a shell command"
|
||||
descriptions[19]="Set the cursor theme and reloads the cursor manager"
|
||||
descriptions[21]="Focus the urgent window or the last window"
|
||||
descriptions[22]="Get the list of defined workspace rules"
|
||||
descriptions[23]="Move the active workspace to a monitor"
|
||||
descriptions[24]="Move window doesnt switch to the workspace"
|
||||
descriptions[25]="Interact with hyprpaper if present"
|
||||
descriptions[28]="Swap the active window with the next or previous in a group"
|
||||
descriptions[29]="Move the cursor to the corner of the active window"
|
||||
descriptions[30]="Move a selected window"
|
||||
descriptions[32]="Move the active window in a direction or to a monitor"
|
||||
descriptions[33]="List all windows with their properties"
|
||||
descriptions[35]="Temporarily enable or disable binds:ignore_group_lock"
|
||||
descriptions[36]="Print the current random splash"
|
||||
descriptions[37]="Execute a raw shell command"
|
||||
descriptions[38]="List active outputs with their properties"
|
||||
descriptions[43]="Change the split ratio"
|
||||
descriptions[44]="Move the active window"
|
||||
descriptions[45]="Pass the key to a specified window"
|
||||
descriptions[46]="Swap the focused window with the next window"
|
||||
descriptions[47]="List all connected keyboards and mice"
|
||||
descriptions[48]="List the layers"
|
||||
descriptions[50]="Lock the focused group"
|
||||
descriptions[51]="OK"
|
||||
descriptions[52]="Move a workspace to a monitor"
|
||||
descriptions[53]="Specify the Hyprland instance"
|
||||
descriptions[55]="Pin a window"
|
||||
descriptions[56]="WARNING"
|
||||
descriptions[57]="INFO"
|
||||
descriptions[60]="Set the current window's floating state to true"
|
||||
descriptions[63]="List all workspaces with their properties"
|
||||
descriptions[64]="Focus the next window on a workspace"
|
||||
descriptions[65]="Modify the window stack order of the active or specified window"
|
||||
descriptions[66]="Toggle the current active window into a group"
|
||||
descriptions[67]="Lock the groups"
|
||||
descriptions[69]="Set all monitors' DPMS status"
|
||||
descriptions[70]="Switch focus from current to previously focused window"
|
||||
descriptions[71]="No Icon"
|
||||
descriptions[72]="Execute a batch of commands separated by ;"
|
||||
descriptions[73]="Send a notification using the built-in Hyprland notification system"
|
||||
descriptions[75]="List all running Hyprland instances and their info"
|
||||
descriptions[76]="Move the active window out of a group"
|
||||
descriptions[77]="Close the active window"
|
||||
descriptions[78]="HINT"
|
||||
descriptions[79]="Move the focused window to a workspace"
|
||||
descriptions[80]="Move the cursor to a specified position"
|
||||
descriptions[81]="List all current config parsing errors"
|
||||
descriptions[82]="Close a specified window"
|
||||
descriptions[83]="Swap the active window with another window"
|
||||
descriptions[85]="Force the renderer to reload all resources and outputs"
|
||||
descriptions[86]="Center the active window"
|
||||
descriptions[87]="Focus the first window matching"
|
||||
descriptions[88]="Set the hyprctl error string"
|
||||
descriptions[90]="Print the Hyprland version: flags, commit and branch of build"
|
||||
descriptions[91]="List all registered binds"
|
||||
descriptions[92]="Toggle a special workspace on/off"
|
||||
descriptions[93]="Toggle the focused window's fullscreen state"
|
||||
descriptions[96]="Issue a keyword to call a config keyword dynamically"
|
||||
descriptions[97]="Toggle the current window to always be opaque"
|
||||
descriptions[98]="ERROR"
|
||||
descriptions[99]="Specify the Hyprland instance"
|
||||
descriptions[100]="Toggle the current window's floating state"
|
||||
descriptions[101]="Rename a workspace"
|
||||
descriptions[102]="Get the active workspace name and its properties"
|
||||
descriptions[104]="Get into a kill mode, where you can kill an app by clicking on it"
|
||||
descriptions[106]="Allows adding/removing fake outputs to a specific backend"
|
||||
descriptions[107]="Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
descriptions[108]="Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
descriptions[109]="Force reload the config"
|
||||
descriptions[111]="Output in JSON format"
|
||||
descriptions[113]="Get the active window name and its properties"
|
||||
descriptions[115]="Dismiss all or up to amount of notifications"
|
||||
descriptions[116]="Focus a monitor"
|
||||
descriptions[117]="Move the focus in a direction"
|
||||
descriptions[118]="Interact with a plugin"
|
||||
descriptions[119]="Exit the compositor with no questions asked"
|
||||
descriptions[120]="Change the workspace"
|
||||
descriptions[121]="Get the config option status (values)"
|
||||
descriptions[124]="List all decorations and their info"
|
||||
descriptions[125]="Set the current window's floating state to false"
|
||||
descriptions[126]="Resize a selected window"
|
||||
descriptions[127]="Toggle the focused window's internal fullscreen state"
|
||||
descriptions[128]="Print tail of the log"
|
||||
descriptions[129]="Swap the active workspaces between two monitors"
|
||||
descriptions[130]="Change the current mapping group"
|
||||
descriptions[132]="Behave as moveintogroup"
|
||||
descriptions[133]="Get the current cursor pos in global layout coordinates"
|
||||
descriptions[135]="Focus the requested workspace"
|
||||
|
||||
local -A literal_transitions
|
||||
literal_transitions[1]="([102]=2 [73]=3 [33]=4 [2]=3 [3]=3 [76]=3 [104]=5 [36]=3 [107]=6 [40]=3 [44]=3 [111]=3 [83]=7 [112]=9 [50]=3 [52]=3 [87]=10 [116]=3 [118]=3 [120]=3 [15]=3 [58]=11 [59]=3 [17]=12 [121]=13 [21]=3 [123]=3 [125]=3 [25]=14 [66]=3 [95]=6 [96]=3 [27]=3 [28]=15 [99]=3 [101]=6)"
|
||||
literal_transitions[4]="([71]=27 [32]=27 [53]=27 [54]=27 [88]=27 [103]=3 [119]=3 [75]=2 [16]=3 [122]=27 [4]=2 [6]=3 [126]=3 [128]=27 [79]=27 [129]=27 [82]=27 [31]=27 [47]=3 [13]=3 [84]=27 [11]=27 [85]=27 [136]=27)"
|
||||
literal_transitions[8]="([102]=2 [73]=3 [33]=4 [2]=3 [3]=3 [76]=3 [104]=5 [36]=3 [40]=3 [44]=3 [111]=3 [83]=7 [112]=9 [50]=3 [52]=3 [87]=10 [116]=3 [118]=3 [120]=3 [15]=3 [58]=11 [59]=3 [17]=12 [121]=13 [21]=3 [123]=3 [125]=3 [25]=14 [66]=3 [96]=3 [27]=3 [28]=15 [99]=3)"
|
||||
literal_transitions[9]="([127]=3 [130]=3 [1]=3 [72]=3 [35]=3 [105]=3 [37]=3 [106]=3 [5]=3 [77]=3 [39]=3 [78]=3 [109]=3 [7]=3 [43]=3 [42]=3 [80]=3 [81]=3 [45]=3 [46]=3 [10]=3 [108]=3 [49]=3 [51]=3 [12]=3 [114]=3 [86]=3 [48]=3 [56]=3 [89]=3 [57]=3 [90]=3 [91]=3 [60]=3 [61]=3 [124]=3 [92]=3 [62]=3 [20]=3 [94]=3 [22]=3 [23]=3 [64]=3 [65]=3 [24]=3 [131]=3 [26]=3 [67]=3 [97]=3 [68]=3 [30]=3 [135]=3 [69]=3 [98]=3)"
|
||||
literal_transitions[10]="([113]=18 [110]=21)"
|
||||
literal_transitions[11]="([19]=3 [115]=3 [29]=3 [134]=3 [70]=3 [117]=3)"
|
||||
literal_transitions[12]="([100]=3)"
|
||||
literal_transitions[15]="([38]=3)"
|
||||
literal_transitions[16]="([74]=17)"
|
||||
literal_transitions[18]="([9]=3 [63]=3 [14]=3 [132]=3)"
|
||||
literal_transitions[19]="([74]=20)"
|
||||
literal_transitions[23]="([74]=24)"
|
||||
literal_transitions[24]="([41]=3)"
|
||||
literal_transitions[25]="([34]=6 [55]=6)"
|
||||
literal_transitions[26]="([74]=25)"
|
||||
literal_transitions[27]="([18]=3 [8]=3)"
|
||||
literal_transitions[28]="([133]=3 [93]=3)"
|
||||
literal_transitions[30]="([74]=33)"
|
||||
literal_transitions[1]="([75]=3 [3]=20 [48]=3 [47]=3 [113]=3 [8]=3 [81]=3 [10]=3 [12]=4 [115]=5 [13]=6 [88]=7 [90]=3 [118]=8 [91]=3 [22]=3 [19]=3 [121]=3 [124]=9 [25]=3 [95]=3 [96]=10 [128]=3 [63]=3 [102]=3 [33]=3 [72]=20 [36]=3 [133]=3 [104]=3 [38]=11 [106]=12 [73]=14 [108]=13 [109]=3 [111]=20)"
|
||||
literal_transitions[2]="([48]=3 [47]=3 [113]=3 [8]=3 [81]=3 [10]=3 [12]=4 [115]=5 [13]=6 [88]=7 [90]=3 [118]=8 [91]=3 [22]=3 [19]=3 [121]=3 [124]=9 [25]=3 [95]=3 [96]=10 [128]=3 [63]=3 [102]=3 [33]=3 [36]=3 [104]=3 [38]=11 [106]=12 [109]=3 [108]=13 [73]=14 [133]=3 [75]=3)"
|
||||
literal_transitions[4]="([123]=3 [58]=15 [59]=15 [42]=15 [94]=15 [27]=3 [26]=3 [49]=5 [5]=15 [61]=3 [62]=15 [114]=15 [11]=3 [68]=5 [34]=15 [134]=15 [89]=15 [54]=15 [105]=15 [40]=15 [17]=3 [122]=15 [136]=3 [110]=15)"
|
||||
literal_transitions[7]="([112]=3)"
|
||||
literal_transitions[11]="([9]=3)"
|
||||
literal_transitions[12]="([14]=17 [74]=21)"
|
||||
literal_transitions[13]="([1]=3 [76]=3 [2]=3 [77]=3 [43]=3 [44]=3 [4]=3 [45]=3 [46]=3 [79]=3 [80]=3 [50]=3 [82]=3 [52]=3 [83]=3 [85]=3 [86]=3 [116]=3 [87]=3 [117]=3 [15]=3 [119]=3 [55]=3 [120]=3 [18]=3 [92]=3 [21]=3 [93]=3 [23]=3 [125]=3 [24]=3 [60]=3 [126]=3 [28]=3 [29]=3 [30]=3 [97]=3 [127]=3 [129]=3 [64]=3 [32]=3 [65]=3 [66]=3 [67]=3 [100]=3 [69]=3 [35]=3 [70]=3 [37]=3 [101]=3 [130]=3 [107]=3 [132]=3 [135]=3)"
|
||||
literal_transitions[14]="([78]=5 [6]=5 [98]=5 [56]=5 [71]=5 [51]=5 [57]=5)"
|
||||
literal_transitions[15]="([39]=3 [41]=3)"
|
||||
literal_transitions[16]="([31]=3 [131]=3)"
|
||||
literal_transitions[17]="([84]=3 [16]=3 [103]=3 [20]=3)"
|
||||
literal_transitions[18]="([7]=19)"
|
||||
literal_transitions[19]="([53]=20 [99]=20)"
|
||||
|
||||
local -A match_anything_transitions
|
||||
match_anything_transitions=([2]=3 [28]=3 [11]=32 [31]=23 [15]=26 [8]=8 [3]=26 [29]=30 [17]=22 [13]=3 [32]=16 [1]=8 [20]=29 [21]=3 [7]=3 [33]=31 [14]=2 [12]=26 [22]=19 [5]=28)
|
||||
match_anything_transitions=([16]=3 [7]=18 [8]=3 [1]=2 [6]=16 [5]=3 [3]=18 [21]=3 [9]=3 [10]=3 [11]=18 [2]=2)
|
||||
|
||||
declare -A subword_transitions
|
||||
|
||||
|
@ -198,7 +195,7 @@ _hyprctl () {
|
|||
fi
|
||||
done
|
||||
fi
|
||||
local -A commands=([33]=3 [17]=1 [20]=2 [11]=0)
|
||||
local -A commands=([8]=0 [21]=2 [9]=3 [6]=1)
|
||||
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
|
@ -251,4 +248,8 @@ _hyprctl () {
|
|||
return 0
|
||||
}
|
||||
|
||||
compdef _hyprctl hyprctl
|
||||
if [[ $ZSH_EVAL_CONTEXT =~ :file$ ]]; then
|
||||
compdef _hyprctl hyprctl
|
||||
else
|
||||
_hyprctl
|
||||
fi
|
||||
|
|
106
hyprpm/hyprpm.bash
Normal file
106
hyprpm/hyprpm.bash
Normal file
|
@ -0,0 +1,106 @@
|
|||
_hyprpm_cmd_0 () {
|
||||
hyprpm list | grep Plugin | awk '{print $4}'
|
||||
}
|
||||
|
||||
_hyprpm () {
|
||||
if [[ $(type -t _get_comp_words_by_ref) != function ]]; then
|
||||
echo _get_comp_words_by_ref: function not defined. Make sure the bash-completions system package is installed
|
||||
return 1
|
||||
fi
|
||||
|
||||
local words cword
|
||||
_get_comp_words_by_ref -n "$COMP_WORDBREAKS" words cword
|
||||
|
||||
local -a literals=("-n" "::=" "list" "disable" "--help" "update" "add" "--verbose" "-v" "--force" "remove" "enable" "--notify" "-h" "reload" "-f")
|
||||
|
||||
declare -A literal_transitions
|
||||
literal_transitions[0]="([9]=6 [2]=2 [7]=6 [8]=6 [4]=6 [10]=2 [11]=3 [5]=2 [13]=6 [3]=3 [14]=2 [15]=6 [6]=2)"
|
||||
literal_transitions[1]="([10]=2 [11]=3 [3]=3 [2]=2 [14]=2 [5]=2 [6]=2)"
|
||||
literal_transitions[4]="([1]=5)"
|
||||
literal_transitions[5]="([0]=6 [12]=6)"
|
||||
|
||||
declare -A match_anything_transitions
|
||||
match_anything_transitions=([3]=2 [2]=4 [0]=1 [1]=1)
|
||||
declare -A subword_transitions
|
||||
|
||||
local state=0
|
||||
local word_index=1
|
||||
while [[ $word_index -lt $cword ]]; do
|
||||
local word=${words[$word_index]}
|
||||
|
||||
if [[ -v "literal_transitions[$state]" ]]; then
|
||||
declare -A state_transitions
|
||||
eval "state_transitions=${literal_transitions[$state]}"
|
||||
|
||||
local word_matched=0
|
||||
for literal_id in $(seq 0 $((${#literals[@]} - 1))); 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
|
||||
|
||||
|
||||
local prefix="${words[$cword]}"
|
||||
|
||||
local shortest_suffix="$word"
|
||||
for ((i=0; i < ${#COMP_WORDBREAKS}; i++)); do
|
||||
local char="${COMP_WORDBREAKS:$i:1}"
|
||||
local candidate="${word##*$char}"
|
||||
if [[ ${#candidate} -lt ${#shortest_suffix} ]]; then
|
||||
shortest_suffix=$candidate
|
||||
fi
|
||||
done
|
||||
local superfluous_prefix=""
|
||||
if [[ "$shortest_suffix" != "$word" ]]; then
|
||||
local superfluous_prefix=${word%$shortest_suffix}
|
||||
fi
|
||||
|
||||
if [[ -v "literal_transitions[$state]" ]]; then
|
||||
local state_transitions_initializer=${literal_transitions[$state]}
|
||||
declare -A state_transitions
|
||||
eval "state_transitions=$state_transitions_initializer"
|
||||
|
||||
for literal_id in "${!state_transitions[@]}"; do
|
||||
local literal="${literals[$literal_id]}"
|
||||
if [[ $literal = "${prefix}"* ]]; then
|
||||
local completion=${literal#"$superfluous_prefix"}
|
||||
COMPREPLY+=("$completion ")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
declare -A commands
|
||||
commands=([3]=0)
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
local completions=()
|
||||
mapfile -t completions < <(_hyprpm_cmd_${command_id} "$prefix" | cut -f1)
|
||||
for item in "${completions[@]}"; do
|
||||
if [[ $item = "${prefix}"* ]]; then
|
||||
COMPREPLY+=("$item")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -o nospace -F _hyprpm hyprpm
|
109
hyprpm/hyprpm.fish
Normal file
109
hyprpm/hyprpm.fish
Normal file
|
@ -0,0 +1,109 @@
|
|||
function _hyprpm_1
|
||||
set 1 $argv[1]
|
||||
hyprpm list | grep Plugin | awk '{print $4}'
|
||||
end
|
||||
|
||||
function _hyprpm
|
||||
set COMP_LINE (commandline --cut-at-cursor)
|
||||
|
||||
set COMP_WORDS
|
||||
echo $COMP_LINE | read --tokenize --array COMP_WORDS
|
||||
if string match --quiet --regex '.*\s$' $COMP_LINE
|
||||
set COMP_CWORD (math (count $COMP_WORDS) + 1)
|
||||
else
|
||||
set COMP_CWORD (count $COMP_WORDS)
|
||||
end
|
||||
|
||||
set --local literals "-n" "::=" "list" "disable" "--help" "update" "add" "--verbose" "-v" "--force" "remove" "enable" "--notify" "-h" "reload" "-f"
|
||||
|
||||
set --local descriptions
|
||||
set descriptions[1] "Send a hyprland notification for important events (e.g. load fail)"
|
||||
set descriptions[3] "List all installed plugins"
|
||||
set descriptions[4] "Unload a plugin"
|
||||
set descriptions[5] "Show help menu"
|
||||
set descriptions[6] "Check and update all plugins if needed"
|
||||
set descriptions[7] "Install a new plugin repository from git"
|
||||
set descriptions[8] "Enable too much loggin"
|
||||
set descriptions[9] "Enable too much loggin"
|
||||
set descriptions[10] "Force an operation ignoring checks (e.g. update -f)"
|
||||
set descriptions[11] "Remove a plugin repository"
|
||||
set descriptions[12] "Load a plugin"
|
||||
set descriptions[13] "Send a hyprland notification for important events (e.g. load fail)"
|
||||
set descriptions[14] "Show help menu"
|
||||
set descriptions[15] "Reload all plugins"
|
||||
set descriptions[16] "Force an operation ignoring checks (e.g. update -f)"
|
||||
|
||||
set --local literal_transitions
|
||||
set literal_transitions[1] "set inputs 10 3 8 9 5 11 12 6 14 4 15 16 7; set tos 7 3 7 7 7 3 4 3 7 4 3 7 3"
|
||||
set literal_transitions[2] "set inputs 11 12 4 3 15 6 7; set tos 3 4 4 3 3 3 3"
|
||||
set literal_transitions[5] "set inputs 2; set tos 6"
|
||||
set literal_transitions[6] "set inputs 1 13; set tos 7 7"
|
||||
|
||||
set --local match_anything_transitions_from 4 3 1 2
|
||||
set --local match_anything_transitions_to 3 5 2 2
|
||||
|
||||
set --local state 1
|
||||
set --local word_index 2
|
||||
while test $word_index -lt $COMP_CWORD
|
||||
set --local -- word $COMP_WORDS[$word_index]
|
||||
|
||||
if set --query literal_transitions[$state] && test -n $literal_transitions[$state]
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
eval $literal_transitions[$state]
|
||||
|
||||
if contains -- $word $literals
|
||||
set --local literal_matched 0
|
||||
for literal_id in (seq 1 (count $literals))
|
||||
if test $literals[$literal_id] = $word
|
||||
set --local index (contains --index -- $literal_id $inputs)
|
||||
set state $tos[$index]
|
||||
set word_index (math $word_index + 1)
|
||||
set literal_matched 1
|
||||
break
|
||||
end
|
||||
end
|
||||
if test $literal_matched -ne 0
|
||||
continue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if set --query match_anything_transitions_from[$state] && test -n $match_anything_transitions_from[$state]
|
||||
set --local index (contains --index -- $state $match_anything_transitions_from)
|
||||
set state $match_anything_transitions_to[$index]
|
||||
set word_index (math $word_index + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
return 1
|
||||
end
|
||||
|
||||
if set --query literal_transitions[$state] && test -n $literal_transitions[$state]
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
eval $literal_transitions[$state]
|
||||
for literal_id in $inputs
|
||||
if test -n $descriptions[$literal_id]
|
||||
printf '%s\t%s\n' $literals[$literal_id] $descriptions[$literal_id]
|
||||
else
|
||||
printf '%s\n' $literals[$literal_id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set command_states 4
|
||||
set command_ids 1
|
||||
if contains $state $command_states
|
||||
set --local index (contains --index $state $command_states)
|
||||
set --local function_id $command_ids[$index]
|
||||
set --local function_name _hyprpm_$function_id
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
$function_name "$COMP_WORDS[$COMP_CWORD]"
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
complete --command hyprpm --no-files --arguments "(_hyprpm)"
|
19
hyprpm/hyprpm.usage
Normal file
19
hyprpm/hyprpm.usage
Normal file
|
@ -0,0 +1,19 @@
|
|||
hyprpm [<FLAGS>]... <ARGUMENT>
|
||||
|
||||
|
||||
<FLAGS> ::= (--notify | -n) "Send a hyprland notification for important events (e.g. load fail)"
|
||||
| (--help | -h) "Show help menu"
|
||||
| (--verbose | -v) "Enable too much loggin"
|
||||
| (--force | -f) "Force an operation ignoring checks (e.g. update -f)"
|
||||
;
|
||||
|
||||
<ARGUMENT> ::= (add) "Install a new plugin repository from git"
|
||||
| (remove) "Remove a plugin repository"
|
||||
| (update) "Check and update all plugins if needed"
|
||||
| (list) "List all installed plugins"
|
||||
| (enable <PLUGINS>) "Load a plugin"
|
||||
| (disable <PLUGINS>) "Unload a plugin"
|
||||
| (reload) "Reload all plugins"
|
||||
;
|
||||
|
||||
<PLUGINS> ::= {{{ hyprpm list | grep Plugin | awk '{print $4}' }}};
|
151
hyprpm/hyprpm.zsh
Normal file
151
hyprpm/hyprpm.zsh
Normal file
|
@ -0,0 +1,151 @@
|
|||
#compdef hyprpm
|
||||
|
||||
_hyprpm_cmd_0 () {
|
||||
hyprpm list | grep Plugin | awk '{print $4}'
|
||||
}
|
||||
|
||||
_hyprpm () {
|
||||
local -a literals=("-n" "::=" "list" "disable" "--help" "update" "add" "--verbose" "-v" "--force" "remove" "enable" "--notify" "-h" "reload" "-f")
|
||||
|
||||
local -A descriptions
|
||||
descriptions[1]="Send a hyprland notification for important events (e.g. load fail)"
|
||||
descriptions[3]="List all installed plugins"
|
||||
descriptions[4]="Unload a plugin"
|
||||
descriptions[5]="Show help menu"
|
||||
descriptions[6]="Check and update all plugins if needed"
|
||||
descriptions[7]="Install a new plugin repository from git"
|
||||
descriptions[8]="Enable too much loggin"
|
||||
descriptions[9]="Enable too much loggin"
|
||||
descriptions[10]="Force an operation ignoring checks (e.g. update -f)"
|
||||
descriptions[11]="Remove a plugin repository"
|
||||
descriptions[12]="Load a plugin"
|
||||
descriptions[13]="Send a hyprland notification for important events (e.g. load fail)"
|
||||
descriptions[14]="Show help menu"
|
||||
descriptions[15]="Reload all plugins"
|
||||
descriptions[16]="Force an operation ignoring checks (e.g. update -f)"
|
||||
|
||||
local -A literal_transitions
|
||||
literal_transitions[1]="([10]=7 [3]=3 [8]=7 [9]=7 [5]=7 [11]=3 [12]=4 [6]=3 [14]=7 [4]=4 [15]=3 [16]=7 [7]=3)"
|
||||
literal_transitions[2]="([11]=3 [12]=4 [4]=4 [3]=3 [15]=3 [6]=3 [7]=3)"
|
||||
literal_transitions[5]="([2]=6)"
|
||||
literal_transitions[6]="([1]=7 [13]=7)"
|
||||
|
||||
local -A match_anything_transitions
|
||||
match_anything_transitions=([4]=3 [3]=5 [1]=2 [2]=2)
|
||||
|
||||
declare -A subword_transitions
|
||||
|
||||
local state=1
|
||||
local word_index=2
|
||||
while [[ $word_index -lt $CURRENT ]]; do
|
||||
if [[ -v "literal_transitions[$state]" ]]; then
|
||||
local -A state_transitions
|
||||
eval "state_transitions=${literal_transitions[$state]}"
|
||||
|
||||
local word=${words[$word_index]}
|
||||
local word_matched=0
|
||||
for ((literal_id = 1; literal_id <= $#literals; literal_id++)); 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
|
||||
|
||||
completions_no_description_trailing_space=()
|
||||
completions_no_description_no_trailing_space=()
|
||||
completions_trailing_space=()
|
||||
suffixes_trailing_space=()
|
||||
descriptions_trailing_space=()
|
||||
completions_no_trailing_space=()
|
||||
suffixes_no_trailing_space=()
|
||||
descriptions_no_trailing_space=()
|
||||
|
||||
if [[ -v "literal_transitions[$state]" ]]; then
|
||||
local -A state_transitions
|
||||
eval "state_transitions=${literal_transitions[$state]}"
|
||||
|
||||
for literal_id in ${(k)state_transitions}; do
|
||||
if [[ -v "descriptions[$literal_id]" ]]; then
|
||||
completions_trailing_space+=("${literals[$literal_id]}")
|
||||
suffixes_trailing_space+=("${literals[$literal_id]}")
|
||||
descriptions_trailing_space+=("${descriptions[$literal_id]}")
|
||||
else
|
||||
completions_no_description_trailing_space+=("${literals[$literal_id]}")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
local -A commands=([4]=0)
|
||||
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
local output=$(_hyprpm_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
|
||||
completions_trailing_space+=("${parts[1]}")
|
||||
suffixes_trailing_space+=("${parts[1]}")
|
||||
descriptions_trailing_space+=("${parts[2]}")
|
||||
else
|
||||
completions_no_description_trailing_space+=("${parts[1]}")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
local maxlen=0
|
||||
for suffix in ${suffixes_trailing_space[@]}; do
|
||||
if [[ ${#suffix} -gt $maxlen ]]; then
|
||||
maxlen=${#suffix}
|
||||
fi
|
||||
done
|
||||
for suffix in ${suffixes_no_trailing_space[@]}; do
|
||||
if [[ ${#suffix} -gt $maxlen ]]; then
|
||||
maxlen=${#suffix}
|
||||
fi
|
||||
done
|
||||
|
||||
for ((i = 1; i <= $#suffixes_trailing_space; i++)); do
|
||||
if [[ -z ${descriptions_trailing_space[$i]} ]]; then
|
||||
descriptions_trailing_space[$i]="${(r($maxlen)( ))${suffixes_trailing_space[$i]}}"
|
||||
else
|
||||
descriptions_trailing_space[$i]="${(r($maxlen)( ))${suffixes_trailing_space[$i]}} -- ${descriptions_trailing_space[$i]}"
|
||||
fi
|
||||
done
|
||||
|
||||
for ((i = 1; i <= $#suffixes_no_trailing_space; i++)); do
|
||||
if [[ -z ${descriptions_no_trailing_space[$i]} ]]; then
|
||||
descriptions_no_trailing_space[$i]="${(r($maxlen)( ))${suffixes_no_trailing_space[$i]}}"
|
||||
else
|
||||
descriptions_no_trailing_space[$i]="${(r($maxlen)( ))${suffixes_no_trailing_space[$i]}} -- ${descriptions_no_trailing_space[$i]}"
|
||||
fi
|
||||
done
|
||||
|
||||
compadd -Q -a completions_no_description_trailing_space
|
||||
compadd -Q -S ' ' -a completions_no_description_no_trailing_space
|
||||
compadd -l -Q -a -d descriptions_trailing_space completions_trailing_space
|
||||
compadd -l -Q -S '' -a -d descriptions_no_trailing_space completions_no_trailing_space
|
||||
return 0
|
||||
}
|
||||
|
||||
if [[ $ZSH_EVAL_CONTEXT =~ :file$ ]]; then
|
||||
compdef _hyprpm hyprpm
|
||||
else
|
||||
_hyprpm
|
||||
fi
|
Loading…
Reference in a new issue