Keyd : Add DRG shift key overload.

This commit is contained in:
Dmitry Voronin 2024-04-29 02:03:44 +03:00
parent 4e693f2301
commit dcc8942535
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
16 changed files with 81 additions and 78 deletions

View file

@ -26,6 +26,6 @@
vim.cmd("set list listchars=tab:>\\ ,trail:-,lead:.")
-- Relative line numbers.
vim.wo.relativenumber = ${setting.nvim.editor.relativenumber}
vim.wo.relativenumber = ${toString(setting.nvim.editor.relativenumber)}
'';
}

View file

@ -3,9 +3,9 @@
vim.opt.autoindent = true
vim.opt.expandtab = false
-- vim.opt.smartindent = true
vim.opt.shiftwidth = ${setting.nvim.editor.indent.default}
vim.opt.softtabstop = ${setting.nvim.editor.indent.default}
vim.opt.tabstop = ${setting.nvim.editor.indent.default}
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)}
-- Disable Markdown forced formatting.
vim.g.markdown_recommended_style = 0

View file

@ -1,33 +1,33 @@
{ key, setting, ... }: {
text = ''
-- Switch windows.
rekey_normal("<Leader>${key.navigation.go.left}", "<C-w>h")
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>${key.navigation.go.down}", "<C-w>j")
rekey_normal("<Leader>${key.navigation.go.up}", "<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>${key.navigation.go.next}", "<cmd>BufferLineCycleNext<cr>")
rekey_normal("<Leader>${key.navigation.go.prev}", "<cmd>BufferLineCyclePrev<cr>")
-- Splits.
rekey_normal("<Leader>${key.action.split.vertical}", "<cmd>vsplit<cr>")
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>${key.action.resize.equalize}", "<C-w>=") -- Equalize split sizes.
rekey_normal("<Leader>${key.action.hide}", "<C-w>q") -- Close split.
-- Resize splits.
rekey_normal("<Leader>${key.action.resize.left}", "${setting.tmux.resize.step.horizontal}<C-w><")
rekey_normal("<Leader>${key.action.resize.right}", "${setting.tmux.resize.step.horizontal}<C-w>>")
rekey_normal("<Leader>${key.action.resize.down}", "${setting.tmux.resize.step.vertical}<C-w>+")
rekey_normal("<Leader>${key.action.resize.up}", "${setting.tmux.resize.step.vertical}<C-w>-")
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>-")
-- Move splits.
rekey_normal("<Leader>${key.navigation.move.left}", "<C-w>A")
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>${key.navigation.move.down}", "<C-w>S")
rekey_normal("<Leader>${key.navigation.move.up}", "<C-w>W")
'';
}

View file

@ -32,10 +32,10 @@ in {
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 ${setting.tmux.resize.step.vertical}
bind -n ${mod}-${key.action.resize.down} resize-pane -D ${setting.tmux.resize.step.vertical}
bind -n ${mod}-${key.action.resize.left} resize-pane -L ${setting.tmux.resize.step.horizontal}
bind -n ${mod}-${key.action.resize.right} resize-pane -R ${setting.tmux.resize.step.horizontal}
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
unbind '"'
@ -73,14 +73,14 @@ in {
# Statusbar.
bind-key -n ${mod}-${key.tmux.status.toggle} set-option -g status;
bind-key -n ${mod}-${key.tmux.status.uber} run-shell 'tmux_script togglestatusbar'
set -g status-interval ${setting.tmux.status.interval}
set -g status-interval ${toString(setting.tmux.status.interval)}
set -g status-position bottom
set -g status-justify left
set -g status-style "fg=#${fg}"
set -g status-left "#[bold] #H-#S #(tmux_script client_count #S)"
set -g status-left-length ${setting.tmux.status.length}
set -g status-right-length ${setting.tmux.status.length}
set -g status-left-length ${toString(setting.tmux.status.length)}
set -g status-right-length ${toString(setting.tmux.status.length)}
set -g status-right "#(tmux_script statusbar) %d %a #[bold] %H:%M "
set-window-option -g window-status-separator ""
@ -133,13 +133,13 @@ in {
[[ "''${status}" = "Charging" ]] && is_charging=true
local icon
if ((level>=${setting.tmux.status.battery.threshold.high}))
if ((level>=${toString(setting.tmux.status.battery.threshold.high)}))
then
icon="󱊣"
elif ((level>=${setting.tmux.status.battery.threshold.medium}))
elif ((level>=${toString(setting.tmux.status.battery.threshold.medium)}))
then
icon="󱊢"
elif ((level>=${setting.tmux.status.battery.threshold.low}))
elif ((level>=${toString(setting.tmux.status.battery.threshold.low)}))
then
icon="󱊡"
else
@ -159,13 +159,13 @@ in {
[[ "''${level}" = "00" ]] && level="0"
local icon
if ((level>=${setting.tmux.status.volume.threshold.high}))
if ((level>=${toString(setting.tmux.status.volume.threshold.high)}))
then
icon="󰕾"
elif ((level>=${setting.tmux.status.volume.threshold.medium}))
elif ((level>=${toString(setting.tmux.status.volume.threshold.medium)}))
then
icon="󰖀"
elif ((level>=${setting.tmux.status.volume.threshold.low}))
elif ((level>=${toString(setting.tmux.status.volume.threshold.low)}))
then
icon=""
else
@ -184,8 +184,8 @@ in {
function _tmux_statusbar() {
local IFS=$'\n'
local sep=""
local thr_volume=${setting.tmux.status.volume.threshold.show}
local thr_battery=${setting.tmux.status.battery.threshold.show}
local thr_volume=${toString(setting.tmux.status.volume.threshold.show)}
local thr_battery=${toString(setting.tmux.status.battery.threshold.show)}
local is_uber=$(cat "/tmp/.tmux_uber" || echo -n false)
# Get data.

View file

@ -1,4 +1,4 @@
{ pkgs, wallpaper, style, util, ... } @args: let
{ pkgs, wallpaper, style, util, setting, ... } @args: let
mkConfig = { modules }: builtins.foldl' (acc: mod:
acc + (import mod args).text
) "" modules;

View file

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

View file

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

View file

@ -1,8 +1,8 @@
{ key, setting, ... }: {
text = ''
bindsym $mod+${key.action.resize.down} resize grow height ${setting.sway.resize.step.vertical}
bindsym $mod+${key.action.resize.up} resize shrink height ${setting.sway.resize.step.vertical}
bindsym $mod+${key.action.resize.left} resize shrink width ${setting.sway.resize.step.horizontal}
bindsym $mod+${key.action.resize.right} resize grow width ${setting.sway.resize.step.horizontal}
bindsym $mod+${key.action.resize.down} resize grow height ${toString(setting.sway.resize.step.vertical)}
bindsym $mod+${key.action.resize.up} resize shrink height ${toString(setting.sway.resize.step.vertical)}
bindsym $mod+${key.action.resize.left} resize shrink width ${toString(setting.sway.resize.step.horizontal)}
bindsym $mod+${key.action.resize.right} resize grow width ${toString(setting.sway.resize.step.horizontal)}
'';
}

View file

@ -1,6 +1,6 @@
{ setting, ... }: let
step_volume = setting.volume.step;
step_music = setting.music.step;
step_volume = toString(setting.volume.step);
step_music = toString(setting.music.step);
in {
text = ''
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +${step_volume}%'

View file

@ -20,7 +20,7 @@
bindsym $mod+${key.sway.window.fullscreen} fullscreen
# Dim inactive windows.
exec $SWAY_IWT_PATH --opacity ${setting.sway.window.opacity.inactive}
exec $SWAY_IWT_PATH --opacity ${toString(setting.sway.window.opacity.inactive)}
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
@ -33,7 +33,7 @@
bindsym $mod+${key.action.close} kill
# Add gaps.
gaps inner ${setting.sway.window.gap}
gaps inner ${toString(setting.sway.window.gap)}
# Launch everything tiled.
# for_window [all] floating disable

View file

@ -1,61 +1,62 @@
{ ... }: {
tmux = {
resize.step = {
vertical = "1";
horizontal = "1";
vertical = 1;
horizontal = 1;
};
status = {
interval = "2";
length = "50";
interval = 2;
length = 50;
battery.threshold = {
high = "60";
medium = "40";
low = "20";
show = "40";
high = 60;
medium = 40;
low = 20;
show = 40;
};
volume.threshold = {
high = "80";
medium = "40";
low = "10";
show = "100";
high = 80;
medium = 40;
low = 10;
show = 100;
};
};
};
nvim = {
editor = {
relativenumber = "true";
indent.default = "2";
relativenumber = true;
indent.default = 2;
};
resize.step = {
vertical = "2";
horizontal = "4";
vertical = 2;
horizontal = 4;
};
};
sway = {
resize.step = {
vertical = "10px";
horizontal = "10px";
vertical = 10;
horizontal = 10;
};
window = {
gap = "10";
opacity.inactive = "0.85";
gap = 10;
opacity.inactive = 0.85;
};
};
foot = {
font = {
step = "1";
dpi = "yes";
step = 1;
dpi = true;
forceWhite = false;
};
};
top.refresh.ms = "2000";
popup.timeout.ms = "5000";
top.refresh.ms = 2000;
popup.timeout.ms = 5000;
brightness.step = "5";
volume.step = "5";
music.step = "10";
brightness.step = 5;
volume.step = 5;
music.step = 10;
keyd.timeout = 200;
}

View file

@ -4,14 +4,15 @@
'' else ''
foreground=${style.color.fg.light}
'';
dpiaware = if setting.foot.font.dpi then "yes" else "no";
in {
config = util.trimTabs ''
font=${style.font.monospace.name}:size=${toString(style.font.size.terminal)}
# font-bold=${style.font.monospace.name}:size=${toString(style.font.size.terminal)}
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=${setting.foot.font.dpi}
font-size-adjustment=${setting.foot.font.step}
dpi-aware=${dpiaware}
font-size-adjustment=${toString(setting.foot.font.step)}
[colors]
alpha=${toString(style.opacity.terminal)}

View file

@ -1,3 +1,3 @@
{ util, ... } @args: {
{ util, setting, ... } @args: {
config = util.catAllText ./module args;
}

View file

@ -1,6 +1,7 @@
{ ... }: {
{ setting, ... }: {
text = ''
[steam-app-548430]
leftshift = timeout(leftcontrol, ${toString(setting.keyd.timeout)}, leftshift)
alt.w = macro(enter 10ms r enter)
alt.a = macro(enter 10ms N o enter)
alt.s = macro(enter 10ms W a i t enter)

View file

@ -1,7 +1,7 @@
{ style, util, setting, ... }: {
config = util.trimTabs ''
anchor=top-center
default-timeout=${setting.popup.timeout.ms}
default-timeout=${toString(setting.popup.timeout.ms)}
font=${style.font.serif.name} ${toString(style.font.size.popup)}
background-color=#${style.color.bg.dark}
border-color=#${style.color.bg.regular}

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 = ${setting.top.refresh.ms}
update_ms = ${toString(setting.top.refresh.ms)}
#* 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.