Commit cc9e685546

cc9e685546abc9d8a37be77c56b4a5610e32de09

parent: b08ed0902f

Unregistered key

diniamo <55629891+diniamo@users.noreply.github.com> · 2025-02-27 09:14 UTC
committer: <noreply@github.com>

Feat: Tab navigation in selection menu (#49)

* Nix: add devshell, formatter; format

* Feat: selection menu movement with tab

Layout: unified · split

flake.lock +21
@@ -1,5 +1,25 @@
11{
22 "nodes": {
3 "flake-parts": {
4 "inputs": {
5 "nixpkgs-lib": [
6 "nixpkgs"
7 ]
8 },
9 "locked": {
10 "lastModified": 1738453229,
11 "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
12 "owner": "hercules-ci",
13 "repo": "flake-parts",
14 "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
15 "type": "github"
16 },
17 "original": {
18 "owner": "hercules-ci",
19 "repo": "flake-parts",
20 "type": "github"
21 }
22 },
323 "nixpkgs": {
424 "locked": {
525 "lastModified": 1737469691,
@@ -18,6 +38,7 @@
1838 },
1939 "root": {
2040 "inputs": {
41 "flake-parts": "flake-parts",
2142 "nixpkgs": "nixpkgs",
2243 "systems": "systems"
2344 }
flake.nix +21 −9
@@ -4,21 +4,33 @@
44 inputs = {
55 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
66 systems.url = "github:nix-systems/default";
7 flake-parts = {
8 url = "github:hercules-ci/flake-parts";
9 inputs.nixpkgs-lib.follows = "nixpkgs";
10 };
711 };
812
913 outputs = {
1014 nixpkgs,
1115 systems,
16 flake-parts,
1217 ...
13 }: {
14 packages = nixpkgs.lib.genAttrs (import systems) (
15 system: let
16 pkgs = nixpkgs.legacyPackages.${system};
18 } @ inputs:
19 flake-parts.lib.mkFlake {inherit inputs;} {
20 systems = import systems;
21
22 perSystem = {pkgs, ...}: let
1723 package = pkgs.callPackage ./package.nix {};
1824 in {
19 default = package;
20 curd = package;
21 }
22 );
23 };
25 packages = {
26 default = package;
27 curd = package;
28 };
29
30 formatter = pkgs.alejandra;
31 devShells.default = pkgs.mkShellNoCC {
32 inputsFrom = [package];
33 };
34 };
35 };
2436}
internal/selection_menu.go +2 −2
@@ -95,7 +95,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
9595 m.filter = m.filter[:len(m.filter)-1]
9696 updateFilter = true
9797 }
98 case "down":
98 case "down", "tab":
9999 // Move the selection cursor down
100100 if m.selected < len(m.filteredKeys)-1 {
101101 m.selected++
@@ -105,7 +105,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
105105 if m.selected >= m.scrollOffset+m.visibleItemsCount() {
106106 m.scrollOffset++
107107 }
108 case "up":
108 case "up", "shift+tab":
109109 // Move the selection cursor up
110110 if m.selected > 0 {
111111 m.selected--
package.nix +2 −1
@@ -11,7 +11,8 @@
1111}: let
1212 inherit (lib) optional optionalString;
1313
14 path = optional withMpv mpv
14 path =
15 optional withMpv mpv
1516 ++ optional withRofi rofi
1617 ++ optional withUeberzugpp ueberzugpp;
1718in