summaryrefslogtreecommitdiff
path: root/nixos/profiles
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-06-15 09:49:15 +0200
committerMartin Fischer <martin@push-f.com>2025-06-18 21:15:31 +0200
commit340416cc38bb68dc97ae3577f717e8505c18114f (patch)
tree922e98cc4d09bc7b5ec199699dee81560480078a /nixos/profiles
parent7d65ee9b6b6046b73b9e7736b8ce7596724449e9 (diff)
feat(workstation): add shortcut to edit notes
Diffstat (limited to 'nixos/profiles')
-rw-r--r--nixos/profiles/common/nixpkgs/overlays.nix11
-rw-r--r--nixos/profiles/workstation/dev.nix1
-rw-r--r--nixos/profiles/workstation/patches/skim-blank.patch73
3 files changed, 85 insertions, 0 deletions
diff --git a/nixos/profiles/common/nixpkgs/overlays.nix b/nixos/profiles/common/nixpkgs/overlays.nix
index 7bad946..63e9de9 100644
--- a/nixos/profiles/common/nixpkgs/overlays.nix
+++ b/nixos/profiles/common/nixpkgs/overlays.nix
@@ -1,6 +1,17 @@
# https://nixos.org/manual/nixpkgs/stable/#sec-overlays-definition
{ pkgs, ... }:
[
+ # features
+ (final: prev: {
+ skim = prev.skim.overrideAttrs (old: {
+ patches = old.patches ++ [
+ # https://github.com/skim-rs/skim/issues/803
+ ../../workstation/patches/skim-blank.patch
+ ];
+ });
+ })
+
+ # bug fixes
(final: prev: {
sway-unwrapped = prev.sway-unwrapped.overrideAttrs (old: {
patches = old.patches ++ [
diff --git a/nixos/profiles/workstation/dev.nix b/nixos/profiles/workstation/dev.nix
index 6c546b6..87e461b 100644
--- a/nixos/profiles/workstation/dev.nix
+++ b/nixos/profiles/workstation/dev.nix
@@ -8,6 +8,7 @@
nodejs_22
# CLI tools
+ skim
docker-compose
gnumake
jq
diff --git a/nixos/profiles/workstation/patches/skim-blank.patch b/nixos/profiles/workstation/patches/skim-blank.patch
new file mode 100644
index 0000000..590515c
--- /dev/null
+++ b/nixos/profiles/workstation/patches/skim-blank.patch
@@ -0,0 +1,73 @@
+commit bd0a387d9a4c6ad2cea1a3270e2897f2b740ece4
+Author: Martin Fischer <martin@push-f.com>
+Date: Sun Jun 15 08:37:25 2025 +0200
+
+ feat: add --blank option
+
+diff --git a/skim/src/model/mod.rs b/skim/src/model/mod.rs
+index ff9ec6c..c3d2966 100644
+--- a/skim/src/model/mod.rs
++++ b/skim/src/model/mod.rs
+@@ -93,6 +93,7 @@ pub struct Model {
+ info: InfoDisplay,
+ no_clear_if_empty: bool,
+ theme: Arc<ColorTheme>,
++ hide_results_for_empty_query: bool,
+
+ // timer thread for scheduled events
+ timer: Timer,
+@@ -177,6 +178,7 @@ impl Model {
+ info: InfoDisplay::Default,
+ no_clear_if_empty: false,
+ theme,
++ hide_results_for_empty_query: false,
+ timer: Timer::new(),
+ hb_timer_guard: None,
+
+@@ -201,6 +203,7 @@ impl Model {
+ } else {
+ options.info.clone()
+ };
++ self.hide_results_for_empty_query = options.blank;
+
+ self.use_regex = options.regex;
+
+@@ -316,7 +319,9 @@ impl Model {
+ }
+ };
+ self.num_options += matched.len();
+- self.selection.append_sorted_items(matched);
++ if !self.hide_results_for_empty_query || !self.query.get_query().is_empty() {
++ self.selection.append_sorted_items(matched);
++ }
+ }
+
+ let items_consumed = self.item_pool.num_not_taken() == 0;
+diff --git a/skim/src/options.rs b/skim/src/options.rs
+index 657130a..b78b3e7 100644
+--- a/skim/src/options.rs
++++ b/skim/src/options.rs
+@@ -650,6 +650,10 @@ pub struct SkimOptions {
+ #[arg(long, default_value = "0", help_heading = "Display")]
+ pub header_lines: usize,
+
++ /// Don't show results if the query is empty.
++ #[arg(long, help_heading = "Display")]
++ pub blank: bool,
++
+ // --- History ---
+ /// History file
+ ///
+diff --git a/skim/src/query.rs b/skim/src/query.rs
+index 7a09091..9e9ff24 100644
+--- a/skim/src/query.rs
++++ b/skim/src/query.rs
+@@ -170,7 +170,7 @@ impl Query {
+ .collect()
+ }
+
+- fn get_query(&mut self) -> String {
++ pub fn get_query(&mut self) -> String {
+ match self.mode {
+ QueryMode::Query => self.get_fz_query(),
+ QueryMode::Cmd => self.get_cmd_query(),