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 @@
1{ 1{
2 "nodes": { 2 "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 },
3 "nixpkgs": { 23 "nixpkgs": {
4 "locked": { 24 "locked": {
5 "lastModified": 1737469691, 25 "lastModified": 1737469691,
@@ -18,6 +38,7 @@
18 }, 38 },
19 "root": { 39 "root": {
20 "inputs": { 40 "inputs": {
41 "flake-parts": "flake-parts",
21 "nixpkgs": "nixpkgs", 42 "nixpkgs": "nixpkgs",
22 "systems": "systems" 43 "systems": "systems"
23 } 44 }
flake.nix +21 −9
@@ -4,21 +4,33 @@
4 inputs = { 4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 systems.url = "github:nix-systems/default"; 6 systems.url = "github:nix-systems/default";
7 flake-parts = {
8 url = "github:hercules-ci/flake-parts";
9 inputs.nixpkgs-lib.follows = "nixpkgs";
10 };
7 }; 11 };
8 12
9 outputs = { 13 outputs = {
10 nixpkgs, 14 nixpkgs,
11 systems, 15 systems,
16 flake-parts,
12 ... 17 ...
13 }: { 18 } @ inputs:
14 packages = nixpkgs.lib.genAttrs (import systems) ( 19 flake-parts.lib.mkFlake {inherit inputs;} {
15 system: let 20 systems = import systems;
16 pkgs = nixpkgs.legacyPackages.${system}; 21
22 perSystem = {pkgs, ...}: let
17 package = pkgs.callPackage ./package.nix {}; 23 package = pkgs.callPackage ./package.nix {};
18 in { 24 in {
19 default = package; 25 packages = {
20 curd = package; 26 default = package;
21 } 27 curd = package;
22 ); 28 };
23 }; 29
30 formatter = pkgs.alejandra;
31 devShells.default = pkgs.mkShellNoCC {
32 inputsFrom = [package];
33 };
34 };
35 };
24} 36}
internal/selection_menu.go +2 −2
@@ -95,7 +95,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
95 m.filter = m.filter[:len(m.filter)-1] 95 m.filter = m.filter[:len(m.filter)-1]
96 updateFilter = true 96 updateFilter = true
97 } 97 }
98 case "down": 98 case "down", "tab":
99 // Move the selection cursor down 99 // Move the selection cursor down
100 if m.selected < len(m.filteredKeys)-1 { 100 if m.selected < len(m.filteredKeys)-1 {
101 m.selected++ 101 m.selected++
@@ -105,7 +105,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
105 if m.selected >= m.scrollOffset+m.visibleItemsCount() { 105 if m.selected >= m.scrollOffset+m.visibleItemsCount() {
106 m.scrollOffset++ 106 m.scrollOffset++
107 } 107 }
108 case "up": 108 case "up", "shift+tab":
109 // Move the selection cursor up 109 // Move the selection cursor up
110 if m.selected > 0 { 110 if m.selected > 0 {
111 m.selected-- 111 m.selected--
package.nix +2 −1
@@ -11,7 +11,8 @@
11}: let 11}: let
12 inherit (lib) optional optionalString; 12 inherit (lib) optional optionalString;
13 13
14 path = optional withMpv mpv 14 path =
15 optional withMpv mpv
15 ++ optional withRofi rofi 16 ++ optional withRofi rofi
16 ++ optional withUeberzugpp ueberzugpp; 17 ++ optional withUeberzugpp ueberzugpp;
17in 18in