Compare commits

...

5 Commits

8 changed files with 350 additions and 142 deletions

11
flake.lock generated
View File

@@ -398,15 +398,16 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1775400071,
"narHash": "sha256-uFoqOUB1wbqqDKRdHNEYdgyRQECYWhJBq4Oxjm3Dx9M=",
"ref": "refs/heads/develop",
"rev": "3da214ae4c14f57dc5f6ecd480330936f00e1a4f",
"revCount": 35,
"lastModified": 1776813492,
"narHash": "sha256-gydjnWdoZm++hK0B1vpXerwKJQdCeUcxrbBr9iEUTTA=",
"ref": "develop",
"rev": "9a6b94276b68263ad5b2ffebb64354b3bb4cc92a",
"revCount": 38,
"type": "git",
"url": "https://labs.phundrak.com/phundrak/jj-cz"
},
"original": {
"ref": "develop",
"type": "git",
"url": "https://labs.phundrak.com/phundrak/jj-cz"
}

View File

@@ -26,7 +26,7 @@
};
jj-cz = {
url = "git+https://labs.phundrak.com/phundrak/jj-cz";
url = "git+https://labs.phundrak.com/phundrak/jj-cz?ref=develop";
inputs.nixpkgs.follows = "nixpkgs";
};

View File

@@ -27,9 +27,10 @@ in {
explorer = ["${pkgs.nemo-with-extensions}/bin/nemo"];
};
idle = {
inhibitWhenAudio = true;
timeouts = [
{
timeout = 300;
timeout = 3600;
idleAction = "lock";
}
];

View File

@@ -6,8 +6,42 @@
}:
with lib; let
cfg = config.home.shell.tmux;
keyType = types.submodule {
options = {
key = mkOption {
type = types.str;
example = "C-b";
};
action = mkOption {
type = types.str;
example = "resize-pane -Z";
};
};
};
in {
options.home.shell.tmux.enable = mkEnableOption "Enable tmux";
options.home.shell.tmux = with types; {
enable = mkEnableOption "Enable tmux";
bind = mkOption {
type = attrsOf (listOf keyType);
default = {};
example = {
"prefix" = [
{
key = "C-r";
action = "resize-pane -R";
}
];
};
};
unbind = mkOption {
type = listOf (either str (attrsOf (listOf str)));
default = [];
};
extraConfig = mkOption {
type = types.lines;
default = "";
};
};
config.programs.tmux = mkIf cfg.enable {
inherit (cfg) enable;
baseIndex = 1;
@@ -25,71 +59,23 @@ in {
sensible
yank
];
extraConfig = ''
set-option -sa terminal-overrides ",xterm*:Tc"
extraConfig = let
generateBinds = concatLines (
mapAttrsToList (table: keys: concatMapStrings (key: "bind -T ${table} ${key.key} ${key.action}\n") keys) cfg.bind
);
generateUnbind =
concatMapStrings (
entry:
if builtins.isString entry
then "unbind ${entry}\n"
else concatStrings (mapAttrsToList (table: keys: concatMapStrings (key: "unbind -T ${table} ${key}\n") keys) entry)
)
cfg.unbind;
in ''
${cfg.extraConfig}
unbind C-b
bind-key -T prefix « select-window -p
bind-key -T prefix » select-window -n
bind-key -T prefix Tab switch-client -T windows
bind-key -T prefix w switch-client -T pane
bind-key -T prefix y switch-client -T copy-mode
bind-key -T pane / split-window -h -c "#{pane-current_path}"
bind-key -T pane - split-window -v -c "#{pane-current_path}"
bind-key -T pane c select-pane -L
bind-key -T pane t select-pane -D
bind-key -T pane s select-pane -U
bind-key -T pane r select-pane -R
bind-key -T pane f resize-pane -Z
bind-key -T pane . switch-client -T pane-resize
bind-key -T pane-resize c resize-pane -L 5\; switch-client -T pane-resize
bind-key -T pane-resize t resize-pane -D 5\; switch-client -T pane-resize
bind-key -T pane-resize s resize-pane -U 5\; switch-client -T pane-resize
bind-key -T pane-resize r resize-pane -R 5\; switch-client -T pane-resize
bind-key -T pane-resize C resize-pane -L\; switch-client -T pane-resize
bind-key -T pane-resize T resize-pane -D\; switch-client -T pane-resize
bind-key -T pane-resize S resize-pane -U\; switch-client -T pane-resize
bind-key -T pane-resize R resize-pane -R\; switch-client -T pane-resize
bind-key -T windows c new-window
bind-key -T windows n next-window
bind-key -T windows p previous-window
bind-key -T windows \" select-window -t :=1
bind-key -T windows « select-window -t :=2
bind-key -T windows » select-window -t :=3
bind-key -T windows ( select-window -t :=4
bind-key -T windows ) select-window -t :=5
bind-key -T windows @ select-window -t :=6
bind-key -T windows + select-window -t :=7
bind-key -T windows - select-window -t :=8
bind-key -T windows / select-window -t :=9
bind-key -T windows * select-window -t :=10
unbind -T copy-mode-vi H
unbind -T copy-mode-vi J
unbind -T copy-mode-vi K
unbind -T copy-mode-vi L
unbind -T copy-mode-vi h
unbind -T copy-mode-vi j
unbind -T copy-mode-vi k
unbind -T copy-mode-vi l
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi C send-keys -X top-line
bind-key -T copy-mode-vi J send-keys -X jump-to-backward
bind-key -T copy-mode-vi S send-keys -X scroll-up
bind-key -T copy-mode-vi R send-keys -X bottom-line
bind-key -T copy-mode-vi T send-keys -X scroll-down
bind-key -T copy-mode-vi c send-keys -X cursor-left
bind-key -T copy-mode-vi t send-keys -X cursor-down
bind-key -T copy-mode-vi s send-keys -X cursor-up
bind-key -T copy-mode-vi r send-keys -X cursor-right
${generateUnbind}
${generateBinds}
'';
};
}

View File

@@ -0,0 +1,77 @@
{
config.home.desktop.firefox = {
enable = true;
useZen = true;
tridactyl = {
enable = true;
preConfig = "sanitise tridactyllocal tridactylsync";
config = {
editorcmd = "emacsclient -c";
keyboardlayoutbase = "bepo";
keyboardlayoutforce = "true";
hintchars = "auiectsr";
smothscroll = "true";
};
extraConfig = ''
unbind h
unbind j
unbind k
unbind l
unbind c
unbind t
unbind s
unbind r
unbind H
unbind J
unbind K
unbind L
unbind C
unbind T
unbind S
unbind R
" === Bépo layout scrolling (ctsr = hjkl) ===
bind c scrollpx -300 0
bind t scrollline 5
bind s scrollline -5
bind r scrollpx 300 0
" Half/full page scroll (replacing C-f/C-b/C-d/C-u)
bind <C-t> scrollpage 0.5
bind <C-s> scrollpage -0.5
" === History navigation (C/R = H/L) ===
bind C back
bind R forward
" === Tab navigation ===
bind T tabnext
bind S tabprev
" === Displaced commands ===
" reload was on r move to h (bépo's 'replace' position)
bind h reload
bind H reloadhard
" tabopen was on t move to j (bépo's 'find char to' position)
bind j fillcmdline tabopen
unbind ^http(s?)://youtube\.com f
unbind ^http(s?)://youtube\.com t
unbind ^http(s?)://youtube\.com l
unbind ^http(s?)://youtube\.com j
unbind ^http(s?)://twitch\.tv f
bind n findnext
bind N findnext -f
bind p findnext --reverse
bind P findnext -f --reverse
bind < urlincrement -1
bind > urlincrement 1
bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`)
bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`)
'';
};
};
}

View File

@@ -8,6 +8,8 @@
./light-home.nix
./packages.nix
./email.nix
./firefox.nix
./tmux.nix
./wlr-which-key
../modules
];
@@ -65,76 +67,6 @@
};
desktop = {
caelestia.enable = true;
firefox = {
enable = true;
useZen = true;
tridactyl = {
enable = true;
preConfig = "sanitise tridactyllocal tridactylsync";
config = {
editorcmd = "emacsclient -c";
keyboardlayoutbase = "bepo";
keyboardlayoutforce = "true";
hintchars = "auiectsr";
smothscroll = "true";
};
extraConfig = ''
unbind h
unbind j
unbind k
unbind l
unbind c
unbind t
unbind s
unbind r
unbind H
unbind J
unbind K
unbind L
unbind C
unbind T
unbind S
unbind R
" === Bépo layout scrolling (ctsr = hjkl) ===
bind c scrollpx -300 0
bind t scrollline 5
bind s scrollline -5
bind r scrollpx 300 0
" Half/full page scroll (replacing C-f/C-b/C-d/C-u)
bind <C-t> scrollpage 0.5
bind <C-s> scrollpage -0.5
" === History navigation (C/R = H/L) ===
bind C back
bind R forward
" === Tab navigation ===
bind T tabnext
bind S tabprev
" === Displaced commands ===
" reload was on r move to h (bépo's 'replace' position)
bind h reload
bind H reloadhard
" tabopen was on t move to j (bépo's 'find char to' position)
bind j fillcmdline tabopen
unbind ^http(s?)://youtube\.com f
unbind ^http(s?)://youtube\.com t
unbind ^http(s?)://youtube\.com l
unbind ^http(s?)://youtube\.com j
unbind ^http(s?)://twitch\.tv f
bind < urlincrement -1
bind > urlincrement 1
bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`)
bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`)
'';
};
};
spotify = {
enable = true;
spicetify.enable = true;

View File

@@ -40,6 +40,7 @@ in {
# Misc
# gplates
kicad-small
qgis
handy
libnotify

210
users/phundrak/tmux.nix Normal file
View File

@@ -0,0 +1,210 @@
{
home.shell.tmux = {
enable = true;
extraConfig = "set-option -sa terminal-overrides \",xterm*:Tc\"";
unbind = [
"C-b"
{"copy-mode-vi" = ["H" "J" "K" "L" "h" "j" "k" "l"];}
];
bind = {
prefix = [
{
key = "«";
action = "select-window -p";
}
{
key = "»";
action = "select-window -n";
}
{
key = "Tab";
action = "switch-client -T windows";
}
{
key = "w";
action = "switch-client -T pane";
}
{
key = "y";
action = "switch-client -T copy-mode";
}
];
pane = [
{
key = "/";
action = "split-window -h -c \"#{pane-current_path}\"";
}
{
key = "-";
action = "split-window -v -c \"#{pane-current_path}\"";
}
{
key = "c";
action = "select-pane -L";
}
{
key = "t";
action = "select-pane -D";
}
{
key = "s";
action = "select-pane -U";
}
{
key = "r";
action = "select-pane -R";
}
{
key = "f";
action = "resize-pane -Z";
}
{
key = ".";
action = "switch-client -T pane-resize";
}
];
"pane-resize" = [
{
key = "c";
action = "resize-pane -L 5\\; switch-client -T pane-resize";
}
{
key = "t";
action = "resize-pane -D 5\\; switch-client -T pane-resize";
}
{
key = "s";
action = "resize-pane -U 5\\; switch-client -T pane-resize";
}
{
key = "r";
action = "resize-pane -R 5\\; switch-client -T pane-resize";
}
{
key = "C";
action = "resize-pane -L\\; switch-client -T pane-resize";
}
{
key = "T";
action = "resize-pane -D\\; switch-client -T pane-resize";
}
{
key = "S";
action = "resize-pane -U\\; switch-client -T pane-resize";
}
{
key = "R";
action = "resize-pane -R\\; switch-client -T pane-resize";
}
];
windows = [
{
key = "c";
action = "new-window";
}
{
key = "n";
action = "next-window";
}
{
key = "p";
action = "previous-window";
}
{
key = "r";
action = "command-prompt \"rename-window '%%'\"";
}
{
key = "\\\"";
action = "select-window -t :=1";
}
{
key = "«";
action = "select-window -t :=2";
}
{
key = "»";
action = "select-window -t :=3";
}
{
key = "(";
action = "select-window -t :=4";
}
{
key = ")";
action = "select-window -t :=5";
}
{
key = "@";
action = "select-window -t :=6";
}
{
key = "+";
action = "select-window -t :=7";
}
{
key = "-";
action = "select-window -t :=8";
}
{
key = "/";
action = "select-window -t :=9";
}
{
key = "*";
action = "select-window -t :=10";
}
];
"copy-mode-vi" = [
{
key = "v";
action = "send-keys -X begin-selection";
}
{
key = "C-v";
action = "send-keys -X rectangle-toggle";
}
{
key = "y";
action = "send-keys -X copy-selection-and-cancel";
}
{
key = "C";
action = "send-keys -X top-line";
}
{
key = "J";
action = "send-keys -X jump-to-backward";
}
{
key = "S";
action = "send-keys -X scroll-up";
}
{
key = "R";
action = "send-keys -X bottom-line";
}
{
key = "T";
action = "send-keys -X scroll-down";
}
{
key = "c";
action = "send-keys -X cursor-left";
}
{
key = "t";
action = "send-keys -X cursor-down";
}
{
key = "s";
action = "send-keys -X cursor-up";
}
{
key = "r";
action = "send-keys -X cursor-right";
}
];
};
};
}