Part : Remove unused parts.

This commit is contained in:
Dmitry Voronin 2024-06-23 04:55:57 +03:00
parent 254be5cce5
commit 6e934e6ab9
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
57 changed files with 252 additions and 413 deletions

View file

@ -193,7 +193,6 @@
const = self.const; # Constant values.
flake = self; # This Flake itself.
inputs = inputs; # Our dependencies.
key = import ./part/Key.nix {}; # Keyboard keys config.
secret = import ./part/Secret.nix {}; # Secrets (public keys).
setting = import ./part/Setting.nix {}; # My own global settings.
style = import ./part/Style.nix { inherit config; }; # Style abstraction.
@ -359,7 +358,6 @@
const = self.const; # Constant values.
flake = self; # This Flake itself.
inputs = inputs; # Our dependencies.
key = import ./part/Key.nix {}; # Keyboard keys config.
secret = import ./part/Secret.nix {}; # Secrets (public keys).
setting = import ./part/Setting.nix {}; # My own global settings.
style = import ./part/Style.nix { config = import ./part/style/Gruvbox.nix {}; }; # Style abstraction. Stylix is not available for Android so I provide static Gruvbox style.

View file

@ -5,6 +5,6 @@
NIXPKGS_ALLOW_UNFREE = "1";
NIX_CURRENT_SYSTEM = "${pkgs.stdenv.system}";
TERM = "xterm-256color";
TERMINAL = setting.terminal;
TERMINAL = setting.terminal.bin;
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, key, ... }: {
{ pkgs, setting, ... }: {
environment.systemPackages = with pkgs; [ keyd ];
services.keyd = {
@ -10,7 +10,7 @@
backspace = "delete"; # Delete key on backspace.
capslock = "overload(control, esc)"; # Ctrl/esc combo.
compose = "layer(layer_number)"; # Number input layer.
esc = "${key.sysctrl}"; # System controls.
esc = "${setting.sysctrl}"; # System controls.
leftcontrol = "overload(layer_alternative, leftcontrol)"; # Alternative layer for home, end etc.
rightcontrol = "layer(layer_control)"; # Media and other controls.
rightshift = "backspace"; # Backspace.

View file

@ -1,4 +1,4 @@
{ setting, lib, ... }: {
{ ... }: {
text = ''
-- TODO: Add comments and separate files.
vim.opt.clipboard = "unnamedplus"
@ -26,7 +26,7 @@
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:.")
-- Relative line numbers.
vim.wo.relativenumber = ${lib.boolToString(setting.nvim.editor.relativenumber)}
vim.wo.relativenumber = true
-- Disable swap files.
vim.opt.swapfile = false

View file

@ -1,11 +1,13 @@
{ setting, ... }: {
{ ... }: let
indentDefault = 2;
in {
text = ''
vim.opt.autoindent = true
vim.opt.expandtab = false
-- vim.opt.smartindent = true
vim.opt.shiftwidth = ${toString setting.nvim.editor.indent.default}
vim.opt.softtabstop = ${toString setting.nvim.editor.indent.default}
vim.opt.tabstop = ${toString setting.nvim.editor.indent.default}
vim.opt.shiftwidth = ${toString indentDefault}
vim.opt.softtabstop = ${toString indentDefault}
vim.opt.tabstop = ${toString indentDefault}
-- Disable Markdown forced formatting.
vim.g.markdown_recommended_style = 0

View file

@ -1,9 +1,9 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Autocomplete.
rekey_input("<C-${key.action.launch}>", "<C-n>")
rekey_input("<C-space>", "<C-n>")
-- LSP autocomplete.
rekey_normal("<C-${key.action.launch}>", "<cmd>lua vim.lsp.buf.code_action()<cr>")
rekey_normal("<C-space>", "<cmd>lua vim.lsp.buf.code_action()<cr>")
'';
}

View file

@ -1,16 +1,16 @@
{ key, ... }: {
{ ... }: {
text = ''
-- New empty buffer.
remap_normal("<Leader>${key.nvim.buffer.new}", "<cmd>enew<cr>")
remap_normal("<Leader>n", "<cmd>enew<cr>")
-- Close buffer.
function _buf_close()
pcall(vim.cmd, "w")
vim.cmd[[bp|sp|bn|bd!]]
end
rekey_normal("<Leader>${key.action.close}", "<cmd>lua _buf_close()<cr>")
rekey_normal("<Leader>x", "<cmd>lua _buf_close()<cr>")
-- Close all hidden buffers.
rekey_normal("<Leader>${key.action.kill}", "<cmd>BDelete hidden<cr><C-l>")
rekey_normal("<Leader>X", "<cmd>BDelete hidden<cr><C-l>")
'';
}

View file

@ -1,4 +1,4 @@
{ key, ... }: {
{ ... }: {
text = ''
function toggle_contrast()
if vim.g.gruvbox_material_background == "light" then
@ -20,7 +20,7 @@
-- require("lualine").setup()
end
rekey_normal("<Leader>${key.nvim.colorscheme.toggle.contrast}", "<cmd>lua toggle_contrast()<cr>")
rekey_normal("<Leader>${key.nvim.colorscheme.toggle.light}", "<cmd>lua toggle_light()<cr>")
rekey_normal("<Leader>[", "<cmd>lua toggle_contrast()<cr>")
rekey_normal("<Leader>]", "<cmd>lua toggle_light()<cr>")
'';
}

View file

@ -1,9 +1,9 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Toggle comment for the selected line.
vim.keymap.set("n", "<Leader>${key.nvim.text.comment}", require("SingleComment").SingleComment, { expr = true })
vim.keymap.set("n", "<Leader>/", require("SingleComment").SingleComment, { expr = true })
-- Toggle comments for multiple lines.
vim.keymap.set("v", "<Leader>${key.nvim.text.comment}", require("SingleComment").Comment, {})
vim.keymap.set("v", "<Leader>/", require("SingleComment").Comment, {})
'';
}

View file

@ -1,4 +1,4 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Write all we can and exit. Created this to drop non-writable stuff when piping to nvim.
function bye()
@ -22,17 +22,17 @@
end
end
rekey_normal("<Leader>${key.nvim.editor.indent.size}", "<cmd>lua toggle_tab_width()<cr>")
rekey_normal("<Leader><Tab>", "<cmd>lua toggle_tab_width()<cr>")
-- Repeat previous command.
rekey_normal("<Leader>${key.action.repeat}", "@:")
rekey_visual("<Leader>${key.action.repeat}", "@:")
rekey_normal("<Leader>.", "@:")
rekey_visual("<Leader>.", "@:")
-- Save everything.
rekey_normal("${key.action.wait}${key.action.wait}", "<cmd>wa<cr>")
rekey_normal("zz", "<cmd>wa<cr>")
-- Save all we can and leave.
rekey_normal("<Leader>${key.action.wait}", "<cmd>lua bye()<cr>")
rekey_normal("<Leader>z", "<cmd>lua bye()<cr>")
-- Remap ; to :.
rekey_normal(";", ":")

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Toggle file tree.
rekey_normal("<Leader>${key.nvim.window.filetree}", "<cmd>NvimTreeToggle<cr>")
rekey_normal("<Leader>1", "<cmd>NvimTreeToggle<cr>")
'';
}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Toggle Git inspection mode.
rekey_normal("<Leader>${key.nvim.editor.git.inspect}", "<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>")
rekey_normal("<Leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>")
'';
}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
leader = "${key.nvim.leader}"
leader = " "
vim.g.mapleader = leader
vim.g.maplocalleader = leader

View file

@ -1,33 +1,36 @@
{ key, setting, ... }: {
{ ... }: let
stepVertical = 2;
stepHorizontal = 4;
in {
text = ''
-- Switch windows.
rekey_normal("<Leader>${key.navigation.go.left}", "<C-w>h")
rekey_normal("<Leader>${key.navigation.go.right}", "<C-w>l")
rekey_normal("<Leader>${key.navigation.go.down}", "<C-w>j")
rekey_normal("<Leader>${key.navigation.go.up}", "<C-w>k")
rekey_normal("<Leader>a", "<C-w>h")
rekey_normal("<Leader>d", "<C-w>l")
rekey_normal("<Leader>s", "<C-w>j")
rekey_normal("<Leader>w", "<C-w>k")
-- Switch buffers.
rekey_normal("<Leader>${key.navigation.move.next}", "<cmd>BufferLineMoveNext<cr>")
rekey_normal("<Leader>${key.navigation.move.prev}", "<cmd>BufferLineMovePrev<cr>")
rekey_normal("<Leader>${key.navigation.go.next}", "<cmd>BufferLineCycleNext<cr>")
rekey_normal("<Leader>${key.navigation.go.prev}", "<cmd>BufferLineCyclePrev<cr>")
rekey_normal("<Leader>E", "<cmd>BufferLineMoveNext<cr>")
rekey_normal("<Leader>Q", "<cmd>BufferLineMovePrev<cr>")
rekey_normal("<Leader>e", "<cmd>BufferLineCycleNext<cr>")
rekey_normal("<Leader>q", "<cmd>BufferLineCyclePrev<cr>")
-- Splits.
rekey_normal("<Leader>${key.action.split.vertical}", "<cmd>vsplit<cr>")
rekey_normal("<Leader>${key.action.split.horizontal}", "<cmd>split<cr>")
rekey_normal("<Leader>${key.action.resize.equalize}", "<C-w>=") -- Equalize split sizes.
rekey_normal("<Leader>${key.action.hide}", "<C-w>q") -- Close split.
rekey_normal("<Leader>-", "<cmd>vsplit<cr>")
rekey_normal("<Leader>\\", "<cmd>split<cr>")
rekey_normal("<Leader>=", "<C-w>=") -- Equalize split sizes.
rekey_normal("<Leader>c", "<C-w>q") -- Close split.
-- Resize splits.
rekey_normal("<Leader>${key.action.resize.left}", "${toString setting.tmux.resize.step.horizontal}<C-w><")
rekey_normal("<Leader>${key.action.resize.right}", "${toString setting.tmux.resize.step.horizontal}<C-w>>")
rekey_normal("<Leader>${key.action.resize.down}", "${toString setting.tmux.resize.step.vertical}<C-w>+")
rekey_normal("<Leader>${key.action.resize.up}", "${toString setting.tmux.resize.step.vertical}<C-w>-")
rekey_normal("<Leader>h", "${toString stepHorizontal}<C-w><")
rekey_normal("<Leader>l", "${toString stepHorizontal}<C-w>>")
rekey_normal("<Leader>j", "${toString stepVertical}<C-w>+")
rekey_normal("<Leader>k", "${toString stepVertical}<C-w>-")
-- Move splits.
rekey_normal("<Leader>${key.navigation.move.left}", "<C-w>A")
rekey_normal("<Leader>${key.navigation.move.right}", "<C-w>D")
rekey_normal("<Leader>${key.navigation.move.down}", "<C-w>S")
rekey_normal("<Leader>${key.navigation.move.up}", "<C-w>W")
rekey_normal("<Leader>A", "<C-w>A")
rekey_normal("<Leader>D", "<C-w>D")
rekey_normal("<Leader>S", "<C-w>S")
rekey_normal("<Leader>W", "<C-w>W")
'';
}

View file

@ -1,8 +1,6 @@
{ key, ... }: let
prompt = key.nvim.text.prompt;
in {
{ ... }: {
text = ''
rekey_normal("<Leader>${prompt}", ":<c-u>lua require('ollama').prompt()<cr>")
rekey_visual("<Leader>${prompt}", ":<c-u>lua require('ollama').prompt()<cr>")
rekey_normal("<Leader>p", ":<c-u>lua require('ollama').prompt()<cr>")
rekey_visual("<Leader>p", ":<c-u>lua require('ollama').prompt()<cr>")
'';
}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Sort visual selection alphabetically.
rekey_visual("<Leader>${key.nvim.text.sort}", ":'<,'>sort<cr>")
rekey_visual("<Leader>A", ":'<,'>sort<cr>")
'';
}

View file

@ -1,12 +1,12 @@
{ key, ... }: let
mod = key.nvim.telescope.mod;
{ ... }: let
mod = "f";
in {
text = ''
rekey_normal("<Leader>${mod}${key.nvim.telescope.all}", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}${key.nvim.telescope.buffer}", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>${mod}${key.nvim.telescope.file}", "<cmd>lua require('telescope.builtin').find_files()<cr>")
rekey_normal("<Leader>${mod}${key.nvim.telescope.grep}", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
rekey_normal("<Leader>${mod}${key.nvim.telescope.help}", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
rekey_normal("<Leader>${mod}${key.nvim.telescope.treesitter}", "<cmd>Telescope treesitter<cr>")
rekey_normal("<Leader>${mod}a", "<cmd>Telescope<cr>")
rekey_normal("<Leader>${mod}b", "<cmd>lua require('telescope.builtin').buffers()<cr>")
rekey_normal("<Leader>${mod}f", "<cmd>lua require('telescope.builtin').find_files()<cr>")
rekey_normal("<Leader>${mod}g", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
rekey_normal("<Leader>${mod}h", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
rekey_normal("<Leader>${mod}t", "<cmd>Telescope treesitter<cr>")
'';
}

View file

@ -1,7 +1,7 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Open terminal window.
rekey_normal("<Leader>${key.nvim.window.terminal}", "<cmd>terminal<cr>")
rekey_normal("<Leader>4", "<cmd>terminal<cr>")
-- Detach from terminal with Esc key.
rekey_terminal("<Esc>", "<C-\\><C-n>")

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Toggle To-do window.
rekey_normal("<Leader>${key.nvim.window.todo}", "<cmd>TroubleToggle todo<cr>")
rekey_normal("<Leader>3", "<cmd>TroubleToggle todo<cr>")
'';
}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Toggle diagnostics window.
rekey_normal("<Leader>${key.nvim.window.trouble}", "<cmd>TroubleToggle document_diagnostics<cr>")
rekey_normal("<Leader>2", "<cmd>TroubleToggle document_diagnostics<cr>")
'';
}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
-- Show keymap help.
rekey_normal("${key.nvim.window.whichkey}", "<cmd>WhichKey<cr>")
rekey_normal("?", "<cmd>WhichKey<cr>")
'';
}

View file

@ -1,8 +1,8 @@
{ key, ... }: let
mod = key.tmux.mod;
{ ... }: let
mod = "M";
in {
text = ''
unbind-key C-b
bind -n ${mod}-${key.tmux.reload} source-file /etc/tmux.conf
bind -n ${mod}-r source-file /etc/tmux.conf
'';
}

View file

@ -1,15 +1,15 @@
{ key, style, ... }: let
mod = key.tmux.mod;
{ style, ... }: let
mod = "M";
fg = style.color.bg.dark;
selection = style.color.selection;
in {
text = ''
setw -g mode-keys vi
bind -n ${mod}-${key.tmux.copy.select} copy-mode
bind -n ${mod}-${key.tmux.copy.paste} choose-buffer;
bind -T copy-mode-vi ${key.tmux.copy.select} send -X begin-selection
bind -T copy-mode-vi ${key.tmux.copy.copy} send-keys -X copy-pipe-and-cancel "pbcopy"
bind -n ${mod}-v copy-mode
bind -n ${mod}-V choose-buffer;
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
set -g mode-style "fg=#${fg} bg=#${selection} bold"
'';

View file

@ -1,8 +1,8 @@
{ key, ... }: let
mod = key.tmux.mod;
{ ... }: let
mod = "M";
in {
text = ''
bind -n ${mod}-${key.tmux.scroll.up} copy-mode -u
bind -n ${mod}-${key.tmux.scroll.down} send-keys Pagedown
bind -n ${mod}-p copy-mode -u
bind -n ${mod}-n send-keys Pagedown
'';
}

View file

@ -1,13 +1,13 @@
{ key, ... }: let
mod = key.tmux.mod;
{ ... }: let
mod = "M";
in {
text = ''
bind -n ${mod}-${key.action.wait} detach-client
bind -n ${mod}-${key.action.exit} detach-client -a
bind -n ${mod}-z detach-client
bind -n ${mod}-Z detach-client -a
bind -n ${mod}-${key.tmux.session.prev} switch-client -p
bind -n ${mod}-${key.tmux.session.next} switch-client -n
bind -n ${mod}-${key.tmux.session.choose} choose-session
bind -n ${mod}-( switch-client -p
bind -n ${mod}-) switch-client -n
bind -n ${mod}-g choose-session
set -g window-size smallest
'';

View file

@ -1,30 +1,33 @@
{ key, setting, style, ... }: let
mod = key.tmux.mod;
{ style, ... }: let
mod = "M";
accent = style.color.accent;
bg = style.color.bg.regular;
fg = style.color.fg.light;
# fg = style.color.fg.light;
stepVertical = 1;
stepHorizontal = 1;
in {
text = ''
bind -n ${mod}-${key.action.split.vertical} split-window -h -c "#{pane_current_path}"
bind -n ${mod}-${key.action.split.horizontal} split-window -v -c "#{pane_current_path}"
bind -n ${mod}-${key.action.resize.equalize} select-layout tiled
bind -n ${mod}-${key.action.resize.up} resize-pane -U ${toString setting.tmux.resize.step.vertical}
bind -n ${mod}-${key.action.resize.down} resize-pane -D ${toString setting.tmux.resize.step.vertical}
bind -n ${mod}-${key.action.resize.left} resize-pane -L ${toString setting.tmux.resize.step.horizontal}
bind -n ${mod}-${key.action.resize.right} resize-pane -R ${toString setting.tmux.resize.step.horizontal}
bind -n ${mod}-${key.navigation.move.left} swap-pane -U
bind -n ${mod}-${key.navigation.move.right} swap-pane -D
bind -n ${mod}-- split-window -h -c "#{pane_current_path}"
bind -n ${mod}-\\ split-window -v -c "#{pane_current_path}"
bind -n ${mod}-= select-layout tiled
bind -n ${mod}-k resize-pane -U ${toString stepVertical}
bind -n ${mod}-j resize-pane -D ${toString stepVertical}
bind -n ${mod}-h resize-pane -L ${toString stepHorizontal}
bind -n ${mod}-l resize-pane -R ${toString stepHorizontal}
bind -n ${mod}-a swap-pane -U
bind -n ${mod}-d swap-pane -D
unbind '"'
unbind %
bind -n ${mod}-${key.navigation.go.left} select-pane -L
bind -n ${mod}-${key.navigation.go.right} select-pane -R
bind -n ${mod}-${key.navigation.go.up} select-pane -U
bind -n ${mod}-${key.navigation.go.down} select-pane -D
bind -n ${mod}-a select-pane -L
bind -n ${mod}-d select-pane -R
bind -n ${mod}-w select-pane -U
bind -n ${mod}-s select-pane -D
bind -n ${mod}-${key.action.hide} kill-pane
bind -n ${mod}-${key.action.seek} kill-pane -a
bind -n ${mod}-c kill-pane
bind -n ${mod}-C kill-pane -a
set -g pane-border-style "fg=#${bg}"
set -g pane-active-border-style "fg=#${accent}"

View file

@ -1,12 +1,12 @@
{ style, key, ... }: let
mod = key.tmux.mod;
{ style, ... }: let
mod = "M";
accent = style.color.accent;
bg = style.color.bg.dark;
# bg = style.color.bg.dark;
fg = style.color.fg.light;
in {
text = ''
bind-key -n ${mod}-${key.tmux.status.toggle} set-option -g status;
bind-key -n ${mod}-f set-option -g status;
set -g status-position bottom
set -g status-justify left
set -g status-style "fg=#${fg}"

View file

@ -1,17 +1,17 @@
{ key, ... }: let
mod = key.tmux.mod;
{ ... }: let
mod = "M";
in {
text = ''
bind -n ${mod}-${key.tmux.window.new} new-window -c "#{pane_current_path}"
bind -n ${mod}-${key.tmux.window.new_compat} new-window -c "#{pane_current_path}"
bind -n ${mod}-Escape new-window -c "#{pane_current_path}"
bind -n ${mod}-t new-window -c "#{pane_current_path}"
bind -n ${mod}-${key.action.close} kill-window
bind -n ${mod}-${key.action.kill} kill-window -a
bind -n ${mod}-x kill-window
bind -n ${mod}-X kill-window -a
bind -n ${mod}-${key.navigation.go.next} next-window
bind -n ${mod}-${key.navigation.go.prev} previous-window
bind -n ${mod}-e next-window
bind -n ${mod}-q previous-window
bind -n ${mod}-${key.navigation.move.next} swap-window -t +1\; select-window -t +1
bind -n ${mod}-${key.navigation.move.prev} swap-window -t -1\; select-window -t -1
bind -n ${mod}-E swap-window -t +1\; select-window -t +1
bind -n ${mod}-Q swap-window -t -1\; select-window -t -1
'';
}

View file

@ -1,11 +1,11 @@
{ key, ... }: let
mod = key.gnome.mod;
{ ... }: let
mod = "<Super>";
in {
"org/gnome/desktop/wm/keybindings" = {
activate-window-menu = [ "" ];
begin-move = [ "" ];
begin-resize = [ "${mod}${key.action.resize.begin}" ];
close = [ "${mod}${key.action.close}" ];
begin-resize = [ "${mod}r" ];
close = [ "${mod}x" ];
cycle-group = [ "" ];
cycle-group-backward = [ "" ];
cycle-panels = [ "" ];
@ -14,7 +14,7 @@ in {
cycle-windows-backward = [ "" ];
maximize = [ "" ];
maximize-horizontally = [ "" ];
minimize = [ "${mod}${key.navigation.go.down}" ];
minimize = [ "${mod}s" ];
move-to-monitor-down = [ "" ];
move-to-monitor-left = [ "" ];
move-to-monitor-right = [ "" ];
@ -24,14 +24,14 @@ in {
move-to-workspace-3 = [ "" ];
move-to-workspace-4 = [ "" ];
move-to-workspace-last = [ "" ];
move-to-workspace-left = [ "<Shift>${mod}${key.navigation.move.prev}" ];
move-to-workspace-right = [ "<Shift>${mod}${key.navigation.move.next}" ];
panel-run-dialog = [ "${mod}${key.action.launch}" ];
show-desktop = [ "${mod}${key.action.hide}" ];
switch-applications = [ "${mod}${key.gnome.window.switch}" ];
switch-applications-backward = [ "<Shift>${mod}${key.gnome.window.switch}" ];
switch-group = [ "<Alt>${key.gnome.window.switch}" ];
switch-group-backward = [ "<Shift><Alt>${key.gnome.window.switch}" ];
move-to-workspace-left = [ "<Shift>${mod}q" ];
move-to-workspace-right = [ "<Shift>${mod}e" ];
panel-run-dialog = [ "${mod}space" ];
show-desktop = [ "${mod}c" ];
switch-applications = [ "${mod}Tab" ];
switch-applications-backward = [ "<Shift>${mod}Tab" ];
switch-group = [ "<Alt>Tab" ];
switch-group-backward = [ "<Shift><Alt>Tab" ];
switch-input-source = [ "" ];
switch-input-source-backward = [ "" ];
switch-panels = [ "" ];
@ -41,18 +41,18 @@ in {
switch-to-workspace-3 = [ "" ];
switch-to-workspace-4 = [ "" ];
switch-to-workspace-last = [ "" ];
switch-to-workspace-left = [ "${mod}${key.navigation.go.prev}" ];
switch-to-workspace-right = [ "${mod}${key.navigation.go.next}" ];
switch-to-workspace-left = [ "${mod}q" ];
switch-to-workspace-right = [ "${mod}e" ];
switch-windows = [ "" ];
switch-windows-backward = [ "" ];
toggle-fullscreen = [ "${mod}${key.gnome.window.fullscreen}" ];
toggle-maximized = [ "${mod}${key.navigation.go.up}" ];
toggle-fullscreen = [ "${mod}f" ];
toggle-maximized = [ "${mod}w" ];
unmaximize = [ "" ];
};
"org/gnome/mutter/keybindings" = {
toggle-tiled-left = [ "${mod}${key.navigation.go.left}" ];
toggle-tiled-right = [ "${mod}${key.navigation.go.right}" ];
toggle-tiled-left = [ "${mod}a" ];
toggle-tiled-right = [ "${mod}d" ];
};
"org/gnome/mutter/wayland/keybindings" = {
@ -67,11 +67,11 @@ in {
magnifier-zoom-in = [ "" ];
magnifier-zoom-out = [ "" ];
screenreader = [ "" ];
screensaver = [ "${mod}${key.action.wait}" ];
screensaver = [ "${mod}z" ];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "${mod}${key.gnome.launch.terminal}";
binding = "${mod}Escape";
command = "kgx -e bash -c 'tmux new-session -A -s main; bash'";
name = "gnome-terminal";
};
@ -79,7 +79,7 @@ in {
"org/gnome/shell/keybindings" = {
focus-active-notification = [ "" ];
open-application-menu = [ "" ];
show-screenshot-ui = [ "${mod}${key.gnome.screenshot}" ];
show-screenshot-ui = [ "${mod}v" ];
switch-to-application-1 = [ "" ];
switch-to-application-2 = [ "" ];
switch-to-application-3 = [ "" ];

View file

@ -1,8 +1,8 @@
{ setting, ... }: let
step = toString setting.brightness.step;
step = setting.step.brightness;
in {
text = ''
bindsym XF86MonBrightnessDown exec light -U ${step}
bindsym XF86MonBrightnessUp exec light -A ${step}
bindsym XF86MonBrightnessDown exec light -U ${toString step}
bindsym XF86MonBrightnessUp exec light -A ${toString step}
'';
}

View file

@ -38,6 +38,6 @@
}
# Hide mouse cursor after a period of inactivity.
seat seat0 hide_cursor ${toString setting.popup.timeout.ms}
seat seat0 hide_cursor ${toString setting.timeout.popup}
'';
}

View file

@ -1,4 +1,4 @@
{ style, key, ... }: let
{ style, ... }: let
fontName = style.font.serif.name;
fontSize = toString style.font.size.desktop;
@ -13,6 +13,6 @@ in {
# set $menu _dmenu_path_wrapped | wmenu -b -p 'Run:' -i -f "${fontName} ${fontSize}" -M ${bg}D9 -S ${bg}D9 -N ${bg}D9 -m ${accent} -s ${accent} -n ${fg} | xargs swaymsg exec --
set $menu fuzzel
bindsym $mod+${key.action.launch} exec $menu
bindsym $mod+space exec $menu
'';
}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
# Meta key. Use Mod1 for Alt.
set $mod ${key.sway.mod}
set $mod Mod4
'';
}

View file

@ -1,10 +1,10 @@
{ key, ... }: {
{ ... }: {
text = ''
# Navigation keys.
set $down ${key.navigation.go.down}
set $left ${key.navigation.go.left}
set $right ${key.navigation.go.right}
set $up ${key.navigation.go.up}
set $down s
set $left a
set $right d
set $up w
# Move focus.
bindsym $mod+$down focus down

View file

@ -1,9 +1,9 @@
{ key, ... }: {
{ ... }: {
text = ''
# Show last notification.
bindsym $mod+${key.sway.notification.restore} exec makoctl restore
bindsym $mod+n exec makoctl restore
# Hide all notifications.
bindsym $mod+${key.sway.notification.dismiss} exec makoctl dismiss --all
bindsym $mod+shift+N exec makoctl dismiss --all
'';
}

View file

@ -1,8 +1,11 @@
{ key, setting, ... }: {
{ ... }: let
stepVertical = 10;
stepHorizontal = 10;
in {
text = ''
bindsym $mod+${key.action.resize.down} resize grow height ${toString setting.sway.resize.step.vertical}px
bindsym $mod+${key.action.resize.up} resize shrink height ${toString setting.sway.resize.step.vertical}px
bindsym $mod+${key.action.resize.left} resize shrink width ${toString setting.sway.resize.step.horizontal}px
bindsym $mod+${key.action.resize.right} resize grow width ${toString setting.sway.resize.step.horizontal}px
bindsym $mod+j resize grow height ${toString stepVertical}px
bindsym $mod+k resize shrink height ${toString stepVertical}px
bindsym $mod+h resize shrink width ${toString stepHorizontal}px
bindsym $mod+l resize grow width ${toString stepHorizontal}px
'';
}

View file

@ -1,15 +1,15 @@
{ key, ... }: {
{ ... }: {
text = ''
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# NOTE: Get id with `swaymsg -t get_tree`.
# Move the currently focused window to the scratchpad
bindsym $mod+shift+${key.action.seek} move scratchpad
bindsym $mod+shift+C move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+${key.action.hide} scratchpad show
bindsym $mod+c scratchpad show
# Fix for a goddamn Firefox WebRTC indicator.
for_window [app_id="firefox" title="Firefox Sharing Indicator"] {

View file

@ -1,9 +1,9 @@
{ key, ... }: {
{ ... }: {
text = ''
# Fullscreen screenshot.
bindsym $mod+${key.sway.screenshot.screen} exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
bindsym $mod+shift+v exec grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') - | wl-copy -t image/png
# Select screenshot.
bindsym $mod+${key.sway.screenshot.selection} exec grim -g "$(slurp -d)" - | wl-copy
bindsym $mod+v exec grim -g "$(slurp -d)" - | wl-copy
'';
}

View file

@ -1,8 +1,8 @@
{ key, style, ... }: let
{ style, ... }: let
lock = "swaylock -f -F -c 000000 -k --font \"${style.font.serif.name}\" --font-size ${toString style.font.size.desktop}";
in {
text = ''
bindsym $mod+${key.action.wait} exec '_twice 1 ${lock}'
bindsym $mod+Shift+${key.action.exit} exec _twice 1 bash -c '${lock}; systemctl suspend -i'
bindsym $mod+z exec '_twice 1 ${lock}'
bindsym $mod+Shift+Z exec _twice 1 bash -c '${lock}; systemctl suspend -i'
'';
}

View file

@ -1,10 +1,10 @@
{ setting, ... }: let
step_volume = toString setting.volume.step;
step_music = toString setting.media.step;
step_volume = setting.step.volume;
step_music = setting.step.media;
in {
text = ''
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${step_volume}%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${step_volume}%'
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${toString step_volume}%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -${toString step_volume}%'
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
bindsym XF86AudioPlay exec 'playerctl play-pause'
@ -12,8 +12,8 @@ in {
bindsym XF86AudioStop exec 'playerctl stop'
bindsym XF86AudioNext exec 'playerctl next'
bindsym XF86AudioPrev exec 'playerctl previous'
bindsym XF86Forward exec 'playerctl position ${step_music}+'
bindsym XF86Back exec 'playerctl position ${step_music}-'
bindsym XF86Forward exec 'playerctl position ${toString step_music}+'
bindsym XF86Back exec 'playerctl position ${toString step_music}-'
bindsym XF86Eject exec 'swayscript sound_output_cycle'
'';
}

View file

@ -1,5 +1,5 @@
{ key, ... }: let
mod = key.sysctrl;
{ setting, ... }: let
mod = setting.sysctrl;
in {
text = ''
bindsym ${mod}+c exec 'systemctl reboot -i'

View file

@ -1,8 +1,7 @@
{ key, ... }: {
{ setting, ... }: {
text = ''
# Terminal emulator.
set $term foot
set $term ${setting.terminal.bin}
bindsym $mod+${key.sway.launch.terminal} exec $term -e bash -c "tmux new-session -A -s $USER; bash"
bindsym $mod+Escape exec $term -e bash -c "tmux new-session -A -s $USER; bash"
'';
}

View file

@ -1,23 +1,23 @@
{ key, style, ... }: {
{ style, ... }: {
text = ''
# Toggle tiling.
bindsym $mod+${key.sway.window.floating.toggle} floating toggle
bindsym $mod+shift+f floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+${key.sway.window.floating.cycle} focus mode_toggle
bindsym $mod+shift+r focus mode_toggle
# Move focus to the parent container
# bindsym $mod+a focus parent
# Split directions.
bindsym $mod+${key.sway.window.split.horizontal} splith
bindsym $mod+${key.sway.window.split.vertical} splitv
bindsym $mod+backslash splith
bindsym $mod+minus splitv
# Switch the current container between different layout styles.
bindsym $mod+${key.sway.window.layout.toggle} layout toggle split tabbed
bindsym $mod+Tab layout toggle split tabbed
# Fullscreen.
bindsym $mod+${key.sway.window.fullscreen} fullscreen
bindsym $mod+f fullscreen
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
@ -27,7 +27,7 @@
floating_modifier $mod normal
# Kill focused window.
bindsym $mod+${key.action.close} kill
bindsym $mod+x kill
# Add gaps.
gaps inner ${toString style.window.gap}

View file

@ -1,6 +1,6 @@
{ key, ... }: {
{ ... }: {
text = ''
bindsym $mod+${key.sway.bar} exec pkill -SIGUSR1 waybar
bindsym $mod+r exec pkill -SIGUSR1 waybar
exec waybar -c ''${WAYBAR_CONFIG} -s ''${WAYBAR_STYLE}
exec nm-applet
'';

View file

@ -1,4 +1,4 @@
{ key, ... }: {
{ ... }: {
text = ''
# Switch to workspace.
bindsym $mod+1 workspace number 1
@ -27,11 +27,11 @@
# We just use 1-10 as the default.
# Switch left-right.
bindsym $mod+${key.navigation.go.next} workspace next
bindsym $mod+${key.navigation.go.prev} workspace prev
bindsym $mod+e workspace next
bindsym $mod+q workspace prev
# Move left-right.
bindsym $mod+Shift+${key.navigation.move.next} move container to workspace next
bindsym $mod+Shift+${key.navigation.move.prev} move container to workspace prev
bindsym $mod+Shift+e move container to workspace next
bindsym $mod+Shift+q move container to workspace prev
'';
}

View file

@ -73,7 +73,7 @@ in {
on-click-right = "powerlimit toggle";
};
pulseaudio = {
scroll-step = setting.volume.step;
scroll-step = setting.step.volume;
format = "{volume}% {icon}";
format-muted = "󰸈";
format-icons = {
@ -100,26 +100,26 @@ in {
cpu = {
format = "{usage}% ({load})";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click = "${setting.terminal.bin} -e bash -c btop";
on-click-right = "powersave toggle";
tooltip = false;
};
memory = {
format = "{percentage}%";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click = "${setting.terminal.bin} -e bash -c btop";
on-click-right = "powersave toggle";
};
temperature = {
format = "{temperatureC}°C";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click = "${setting.terminal.bin} -e bash -c btop";
on-click-right = "powersave toggle";
};
"custom/powersave" = {
exec = "powersave waybar";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click = "${setting.terminal.bin} -e bash -c btop";
on-click-right = "powersave toggle";
};
"custom/display" = {

View file

@ -1,142 +0,0 @@
# Keyboard keys configuration.
{ ... }: {
navigation = {
go = {
down = "s";
left = "a";
right = "d";
up = "w";
next = "e";
prev = "q";
};
move = {
down = "S";
left = "A";
right = "D";
up = "W";
next = "E";
prev = "Q";
};
};
action = {
resize = {
down = "j";
left = "h";
right = "l";
up = "k";
begin = "r";
equalize = "=";
};
split = {
horizontal = "-";
vertical = "\\\\";
};
close = "x";
kill = "X";
hide = "c";
seek = "C";
wait = "z";
exit = "Z";
launch = "space";
repeat = ".";
};
nvim = {
buffer.new = "n";
leader = " ";
colorscheme.toggle = {
contrast = "[";
light = "]";
};
editor = {
indent.size = "<Tab>";
git.inspect = "g";
};
telescope = {
mod = "f";
all = "a";
buffer = "b";
file = "f";
grep = "g";
help = "h";
treesitter = "t";
};
text = {
comment = "/";
prompt = "p";
sort = "A";
};
window = {
filetree = "1";
trouble = "2";
todo = "3";
terminal = "4";
whichkey = "?";
};
};
tmux = {
mod = "M";
reload = "r";
scroll = {
down = "n";
up = "p";
};
copy = {
copy = "y";
paste = "V";
select = "v";
};
session = {
choose = "g";
next = "0";
prev = "9";
};
status = {
toggle = "f";
};
window = {
new = "Escape";
new_compat = "t";
};
};
sway = {
launch.terminal = "Escape";
mod = "Mod4";
bar = "r";
notification = {
dismiss = "shift+N";
restore = "n";
};
screenshot = {
selection = "v";
screen = "shift+V";
};
window = {
layout.toggle = "Tab";
fullscreen = "f";
floating = {
toggle = "shift+f";
cycle = "shift+r";
};
split = {
horizontal = "backslash";
vertical = "minus";
};
};
};
gnome = {
launch.terminal = "Escape";
mod = "<Super>";
screenshot = "v";
window = {
switch = "Tab";
fullscreen = "f";
};
};
sysctrl = "print";
}

View file

@ -1,6 +1,6 @@
{ ... }: {
# Password used for root user.
hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`.
hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd -s`.
ssh = {
# Keys that are allowed to connect via SSH.
@ -16,7 +16,6 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSWdbkYsRiDlKu8iT/k+JN4KY08iX9qh4VyqxlpEZcE root@home"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFgiYKFkMfiGOZCZIk+O7LtaoF6A3cHEFCqaPwXOM4rR root@work"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBA+KKCkFOshUznJlXW/LDie0vZLd4b+KWodSm8N8vM+ root@laptop"
(builtins.readFile ./secret/public/Ssh.key)
];
};

View file

@ -1,54 +1,29 @@
# Global settings.
# Just like I can configure each package, here I configure my config! :O)
{ ... }: {
tmux = {
resize.step = {
vertical = 1;
horizontal = 1;
};
};
nvim = {
editor = {
relativenumber = true;
indent.default = 2;
};
resize.step = {
vertical = 2;
horizontal = 4;
};
};
sway = {
resize.step = {
vertical = 10;
horizontal = 10;
};
};
foot = {
font = {
step = 1;
};
};
top.refresh.ms = 2000;
popup.timeout.ms = 5000;
keyd.timeout.ms = 150;
brightness.step = 5;
volume.step = 5;
media.step = 10;
ollama.primaryModel = "llama3";
browser.bin = "firefox-esr";
terminal.bin = "foot";
dpiAware = true;
sysctrl = "print";
keyboard = {
layouts = "us,ru";
options = "grp:toggle";
};
ollama.primaryModel = "llama3";
refresh = {
top = 2000;
};
browser = "firefox-esr";
terminal = "foot";
step = {
brightness = 5;
volume = 5;
media = 10;
};
dpiAware = true;
timeout = {
popup = 5000;
keyd = 150;
};
}

View file

@ -43,14 +43,14 @@
bg-g = config.lib.stylix.colors.base00-rgb-g;
bg-r = config.lib.stylix.colors.base00-rgb-r;
fg-b = config.lib.stylix.colors.base06-rgb-b;
fg-g = config.lib.stylix.colors.base06-rgb-g;
fg-r = config.lib.stylix.colors.base06-rgb-r;
border = config.lib.stylix.colors.base01;
border-b = config.lib.stylix.colors.base01-rgb-b;
border-g = config.lib.stylix.colors.base01-rgb-g;
border-r = config.lib.stylix.colors.base01-rgb-r;
fg-b = config.lib.stylix.colors.base06-rgb-b;
fg-g = config.lib.stylix.colors.base06-rgb-g;
fg-r = config.lib.stylix.colors.base06-rgb-r;
};
font = {

View file

@ -1,5 +1,6 @@
{ style, setting, pkgs, ... }: let
dpiAware = if setting.dpiAware then "yes" else "no";
fontStep = 1;
in {
file = (pkgs.formats.iniWithGlobalSection {}).generate "FootConfig" {
globalSection = {
@ -8,7 +9,7 @@ in {
font-italic = "${style.font.monospace.name}:size=${toString style.font.size.terminal}";
font-bold-italic = "${style.font.monospace.name}:size=${toString style.font.size.terminal}";
dpi-aware = dpiAware;
font-size-adjustment = setting.foot.font.step;
font-size-adjustment = fontStep;
};
sections = {

View file

@ -8,7 +8,7 @@ in {
lines = 20;
prompt = "\"$ \"";
show-actions = "yes";
terminal = setting.terminal;
terminal = setting.terminal.bin;
width = 40;
# list-executables-in-path = "no";
};

View file

@ -26,7 +26,7 @@
"alt.w" = "macro(enter 10ms r enter)";
"alt.x" = "macro(enter 10ms > space H e r e space < enter)";
"alt.z" = "macro(enter 10ms < space L e f t enter)";
leftshift = "timeout(leftcontrol, ${toString setting.keyd.timeout.ms}, leftshift)";
leftshift = "timeout(leftcontrol, ${toString setting.timeout.keyd}, leftshift)";
};
};
}

View file

@ -16,7 +16,7 @@
"alt.q" = "A-left";
"alt.r" = "S-f10";
"alt.s" = "C-A-s";
"alt.tab" = "timeout(f8, ${toString setting.keyd.timeout.ms}, macro2(0, 0, f7))";
"alt.tab" = "timeout(f8, ${toString setting.timeout.keyd}, macro2(0, 0, f7))";
"alt.v" = "C-q";
"alt.w" = "C-S-A-t";
"alt.x" = "C-f4";

View file

@ -6,7 +6,7 @@ in {
anchor = "top-center";
background-color = "#${style.color.bg.dark}${alpha}";
border-color = "#${style.color.border}${alpha}";
default-timeout = setting.popup.timeout.ms;
default-timeout = setting.timeout.popup;
font = "${style.font.serif.name} ${toString style.font.size.popup}";
height = 120;
icons = 0;

View file

@ -55,7 +55,7 @@
shown_boxes = "cpu mem net proc"
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
update_ms = ${toString setting.top.refresh.ms}
update_ms = ${toString setting.refresh.top}
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.

View file

@ -28,7 +28,7 @@
}];
browser = [{
orphan = true;
run = openWith setting.browser;
run = openWith setting.browser.bin;
}];
text = [{
block = true;