diff --git a/home/modules/base/gui/linux/programs/rofi/default.nix b/home/modules/base/gui/linux/programs/rofi/default.nix index ad2ef243..30171cc7 100644 --- a/home/modules/base/gui/linux/programs/rofi/default.nix +++ b/home/modules/base/gui/linux/programs/rofi/default.nix @@ -12,6 +12,19 @@ in { enable = true; + extraConfig = { + # DESIGN: unset bindings with Control+j/k, otherwise a conflict + dpi = 0; + kb-accept-entry = "Control+m,Return,KP_Enter"; + kb-remove-to-eol = ""; + kb-row-down = "Down,Control+j"; + kb-row-up = "Up,Control+k"; + }; + font = "${config.theme.fonts.monospaced.code.name} 12"; + plugins = [ + pkgs.rofi-calc + pkgs.rofi-emoji + ]; theme = import ./theme.nix { inherit (config.lib.formats.rasi) mkLiteral; theme_background = colors.semantic.background; @@ -23,13 +36,4 @@ in theme_highlight = colors.semantic.highlight; theme_urgent = colors.semantic.urgent; }; - font = "${config.theme.fonts.monospaced.code.name} 12"; - extraConfig = { - # DESIGN: unset bindings with Control+j/k, otherwise a conflict - dpi = 0; - kb-accept-entry = "Control+m,Return,KP_Enter"; - kb-remove-to-eol = ""; - kb-row-down = "Down,Control+j"; - kb-row-up = "Up,Control+k"; - }; } diff --git a/home/modules/base/gui/linux/xsession/windowManager/i3/keybindings.nix b/home/modules/base/gui/linux/xsession/windowManager/i3/keybindings.nix index 7fba0978..22600468 100644 --- a/home/modules/base/gui/linux/xsession/windowManager/i3/keybindings.nix +++ b/home/modules/base/gui/linux/xsession/windowManager/i3/keybindings.nix @@ -1,6 +1,7 @@ config: pkgs: mod: modAlt: kitty: let + autorandr = "${pkgs.autorandr}/bin/autorandr"; awk = "${pkgs.gawk}/bin/awk"; browser = "${pkgs.microsoft-edge-beta}/bin/microsoft-edge-beta"; @@ -10,6 +11,7 @@ let fish = "${config.programs.fish.package}/bin/fish"; flameshot = "${config.services.flameshot.package}/bin/flameshot"; i3-workspace-name = "${pkgs.i3-workspace-name}/bin/i3-workspace-name"; + i3-scratchpad = "${pkgs.i3-scratchpad}/bin/i3-scratchpad"; pkill = "${pkgs.procps}/bin/pkill"; rofi = "${config.programs.rofi.package}/bin/rofi"; user = config.home.username; @@ -18,90 +20,51 @@ let exec "${rofi}" -dmenu -p 'clip' "$@" ''; - maim-select = pkgs.writers.writeDash "maim-select" '' - TARGET=~/tmp/screenshots - mkdir --parents "$TARGET" - exec "${pkgs.maim}/bin/maim" --select \ - "$TARGET/screenshot.$(${pkgs.coreutils}/bin/date +%s).png" - ''; - in { - # split in horizontal orientation - "${mod}+bracketright" = "split h"; - - # split in vertical orientation - "${mod}+bracketleft" = "split v"; - - # toggle split - "${mod}+backslash" = "layout toggle all"; - - # fullscreen - "${mod}+f" = "fullscreen"; - - # global fullscreen - "${mod}+Shift+f" = "fullscreen"; - - # tabbed - "${mod}+t" = "layout tabbed"; - - # stacking - "${mod}+Shift+t" = "layout stacking"; - - # default - "${mod}+d" = "layout default"; - - # toggle tiling/floating of the current window - "${mod}+Shift+space" = "floating toggle"; - - # toggle focus between tiling and floating layers - "${mod}+space" = "focus mode_toggle"; - - # Make the currently focused window a scratchpad - "${mod}+Shift+minus" = "move scratchpad"; - - # Show the first scratchpad window - "${mod}+minus" = "scratchpad show"; + # resize mode + "${mod}+s" = "mode \"resize\""; - # Stick toggle - "${mod}+Shift+s" = "sticky toggle"; + # passthrough mode + "${mod}+Escape" = "mode \"passthrough\""; # focus with Vim-style keys or cursor keys - "${mod}+h" = "focus left"; - "${mod}+j" = "focus down"; - "${mod}+k" = "focus up"; - "${mod}+l" = "focus right"; - "${mod}+Left" = "focus left"; - "${mod}+Down" = "focus down"; - "${mod}+Up" = "focus up"; + "${mod}+h" = "focus left"; + "${mod}+j" = "focus down"; + "${mod}+k" = "focus up"; + "${mod}+l" = "focus right"; + "${mod}+Left" = "focus left"; + "${mod}+Down" = "focus down"; + "${mod}+Up" = "focus up"; "${mod}+Right" = "focus right"; # move with Vim-style keys or cursor keys - "${mod}+Shift+h" = "move left"; - "${mod}+Shift+j" = "move down"; - "${mod}+Shift+k" = "move up"; - "${mod}+Shift+l" = "move right"; - "${mod}+Shift+Left" = "move left"; - "${mod}+Shift+Down" = "move down"; - "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+h" = "move left"; + "${mod}+Shift+j" = "move down"; + "${mod}+Shift+k" = "move up"; + "${mod}+Shift+l" = "move right"; + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Down" = "move down"; + "${mod}+Shift+Up" = "move up"; "${mod}+Shift+Right" = "move right"; # move workspace with Vim-style keys or cursor keys - "${mod}+Control+h" = "move workspace to output left"; - "${mod}+Control+j" = "move workspace to output down"; - "${mod}+Control+k" = "move workspace to output up"; - "${mod}+Control+l" = "move workspace to output right"; - "${mod}+Control+Left" = "move workspace to output left"; - "${mod}+Control+Down" = "move workspace to output down"; - "${mod}+Control+Up" = "move workspace to output up"; + "${mod}+Control+h" = "move workspace to output left"; + "${mod}+Control+j" = "move workspace to output down"; + "${mod}+Control+k" = "move workspace to output up"; + "${mod}+Control+l" = "move workspace to output right"; + "${mod}+Control+Left" = "move workspace to output left"; + "${mod}+Control+Down" = "move workspace to output down"; + "${mod}+Control+Up" = "move workspace to output up"; "${mod}+Control+Right" = "move workspace to output right"; - # focus on the parent container - "${mod}+a" = "focus parent"; - - # focus on the child container - "${mod}+Shift+a" = "focus child"; + # insertion orientation + "${mod}+${modAlt}+l" = "split v"; + "${mod}+${modAlt}+j" = "split h"; + # REVISIT: Keep these? + "${mod}+bracketright" = "split h"; + "${mod}+bracketleft" = "split v"; # focus workspace "${mod}+1" = "workspace number 1"; @@ -114,29 +77,99 @@ in "${mod}+8" = "workspace number 8"; "${mod}+9" = "workspace number 9"; "${mod}+0" = "workspace number 10"; - - # move to workspace - "${mod}+Shift+1" = "move workspace number 1"; - "${mod}+Shift+2" = "move workspace number 2"; - "${mod}+Shift+3" = "move workspace number 3"; - "${mod}+Shift+4" = "move workspace number 4"; - "${mod}+Shift+5" = "move workspace number 5"; - "${mod}+Shift+6" = "move workspace number 6"; - "${mod}+Shift+7" = "move workspace number 7"; - "${mod}+Shift+8" = "move workspace number 8"; - "${mod}+Shift+9" = "move workspace number 9"; - "${mod}+Shift+0" = "move workspace number 10"; - - # cycle through workspaces - "${mod}+comma" = "workspace prev"; + "${mod}+comma" = "workspace prev"; "--whole-window ${mod}+button8" = "workspace prev"; - "${mod}+period" = "workspace next"; + "${mod}+period" = "workspace next"; "--whole-window ${mod}+button9" = "workspace next"; - "${mod}+slash" = "workspace back_and_forth"; + "${mod}+slash" = "workspace back_and_forth"; + + # move window to workspace + "${mod}+Shift+1" = "move workspace number 1"; + "${mod}+Shift+2" = "move workspace number 2"; + "${mod}+Shift+3" = "move workspace number 3"; + "${mod}+Shift+4" = "move workspace number 4"; + "${mod}+Shift+5" = "move workspace number 5"; + "${mod}+Shift+6" = "move workspace number 6"; + "${mod}+Shift+7" = "move workspace number 7"; + "${mod}+Shift+8" = "move workspace number 8"; + "${mod}+Shift+9" = "move workspace number 9"; + "${mod}+Shift+0" = "move workspace number 10"; + "${mod}+Shift+comma" = "move workspace prev"; + "${mod}+Shift+period" = "move workspace next"; + + # move workspace + "${mod}+${modAlt}+Shift+1" = "exec ${i3-workspace-name} 1"; + "${mod}+${modAlt}+Shift+2" = "exec ${i3-workspace-name} 2"; + "${mod}+${modAlt}+Shift+3" = "exec ${i3-workspace-name} 3"; + "${mod}+${modAlt}+Shift+4" = "exec ${i3-workspace-name} 4"; + "${mod}+${modAlt}+Shift+5" = "exec ${i3-workspace-name} 5"; + "${mod}+${modAlt}+Shift+6" = "exec ${i3-workspace-name} 6"; + "${mod}+${modAlt}+Shift+7" = "exec ${i3-workspace-name} 7"; + "${mod}+${modAlt}+Shift+8" = "exec ${i3-workspace-name} 8"; + "${mod}+${modAlt}+Shift+9" = "exec ${i3-workspace-name} 9"; + "${mod}+${modAlt}+Shift+0" = "exec ${i3-workspace-name} 10"; + "${mod}+${modAlt}+Shift+comma" = "exec ${i3-workspace-name} prev"; + "${mod}+${modAlt}+Shift+period" = "exec ${i3-workspace-name} next"; + + # focus on the parent container (up) + "${mod}+u" = "focus parent"; + + # focus on the child container (shift+up ≈ down) + "${mod}+Shift+u" = "focus child"; + + # open general launcher + "${mod}+space" = ''exec ${rofi}'' + ++ '' -show combi'' + ++ '' -modes combi'' + ++ '' -combi-modes "drun,run,window,ssh,emoji"'' + ++ '' -terminal "${kitty} --single-instance"''; + + # open terminal + "${mod}+Return" = ''exec ${kitty} --single-instance''; + + # kill the current client + "${mod}+q" = "kill"; + + # kill frame with mouse click on titlebar + "button2" = ''--release kill''; + + # toggle tabbed + "${mod}+t" = "layout toggle tabbed split"; + + # cycle through all layouts + "${mod}+Shift+t" = "layout toggle all"; + + # rotate split + "${mod}+r" = "layout toggle split"; + + # fullscreen + "${mod}+f" = "fullscreen"; + + # toggle focus between tiling and floating layers + "${mod}+minus" = "focus mode_toggle"; + + # toggle tiling/floating of the current window + "${mod}+Shift+minus" = "floating toggle"; + + # Show scratchpad + "${mod}+equal" = "scratchpad show"; + + # Make the currently focused window a scratchpad + "${mod}+Shift+equal" = "${i3-scratchpad} move"; + + # Cycle through scratchpad (or all windows) + "${mod}+Tab" = "${i3-scratchpad} cycle"; + + # toggle sticky + "${mod}+Shift+s" = "sticky toggle"; # rename workspace "${mod}+w" = ''exec ${i3-workspace-name}''; + # marks + "${mod}+m" = "mark --toggle *"; + "${mod}+Shift+m" = "move window to mark *; unmark *"; + # notification center "${mod}+n" = '' exec test "$(${dunstctl} is-paused)" = false \ @@ -148,53 +181,13 @@ in && ${dunstctl} history-pop \ && ${pkill} -u ${user} -SIGRTMIN+0 i3status-rs ''; - "${mod}+Control+n" = ''exec ${dunstctl} action''; - "${mod}+Control+Shift+n" = ''exec ${dunstctl} context''; - "${mod}+${modAlt}+n" = ''exec ${dunstctl} set-paused toggle''; - - # start a new terminal - "${mod}+Return" = ''exec ${kitty} --single-instance''; - - # run dmenu run launcher - "${mod}+F2" = ''exec ${rofi} -show window''; - "${mod}+Tab" = ''exec ${rofi} -show window''; - - # run dmenu run launcher - "${mod}+F3" = ''exec ${rofi} -show run''; - "${mod}+r" = ''exec ${rofi} -show run''; - - # run dmenu ssh launcher - "${mod}+F4" = ''exec ${rofi} -show ssh -terminal "${kitty} --single-instance"''; - "${mod}+g" = ''exec ${rofi} -show ssh -terminal "${kitty} --single-instance"''; + "${mod}+${modAlt}+n" = ''exec ${dunstctl} action''; + "${mod}+${modAlt}+Shift+n" = ''exec ${dunstctl} context''; + "${mod}+Control+n" = ''exec ${dunstctl} set-paused toggle''; # clipboard management "${mod}+c" = ''exec CM_LAUNCHER=${rofi-clip} ${clipmenu}''; - # kill the current client - "${mod}+q" = "kill"; - - # quit i3 - "${mod}+Control+Shift+q" = "exit"; - - # reload i3 configuration - "${mod}+Shift+r" = "reload"; - - # reload i3 configuration - "${mod}+Control+r" = ''exec ${autorandr} --change --default home''; - - # restart i3 inplace - "${mod}+Control+Shift+r" = "restart"; - - # resize mode - "${mod}+s" = "mode \"resize\""; - - # passthrough mode - "${mod}+Escape" = "mode \"passthrough\""; - - # marks - "${mod}+Shift+m" = "move window to mark *; unmark *"; - "${mod}+m" = "mark --toggle *"; - # PulseAudio controls "XF86AudioRaiseVolume" = ''exec --no-startup-id ${dunst-osd} volume up''; "XF86AudioLowerVolume" = ''exec --no-startup-id ${dunst-osd} volume down''; @@ -205,16 +198,20 @@ in "XF86MonBrightnessDown" = ''exec --no-startup-id ${dunst-osd} brightness down''; # media - #"XF86AudioNext" = ''exec --no-startup-id ${mpc} next''; - #"XF86AudioPlay" = ''exec --no-startup-id ${mpc} toggle''; - #"XF86AudioPrev" = ''exec --no-startup-id ${mpc} prev''; "XF86Search" = ''exec ${browser}''; # screen capture - # DESIGN; trying out flameshot - #"${mod}+Control+s" = ''exec ${maim-select}''; - "${mod}+Control+s" = ''exec ${flameshot} gui''; + "${mod}+${modAlt}+s" = ''exec ${flameshot} gui''; - # kill frame with mouse click on titlebar - "button2" = ''--release kill''; + # reload i3 configuration + "${mod}+Shift+r" = "reload"; + + # reload i3 configuration via autorand + "${mod}+Control+r" = ''exec ${autorandr} --change --default home''; + + # restart i3 inplace + "${mod}+Control+Shift+r" = "restart"; + + # quit i3 + "${mod}+Control+Shift+q" = "exit"; } diff --git a/home/modules/base/gui/linux/xsession/windowManager/i3/modes.nix b/home/modules/base/gui/linux/xsession/windowManager/i3/modes.nix index 9afe42de..450466bc 100644 --- a/home/modules/base/gui/linux/xsession/windowManager/i3/modes.nix +++ b/home/modules/base/gui/linux/xsession/windowManager/i3/modes.nix @@ -15,10 +15,10 @@ let # DESIGN: Sometimes it's easier to keep the mod-key depressed. bindingsForDirection = key: dir: { - "${key}" = "resize grow ${dir} 1 px or 1 ppt"; - "${mod}+${key}" = "resize grow ${dir} 1 px or 1 ppt"; - "Shift+${key}" = "resize shrink ${dir} 1 px or 1 ppt"; - "${mod}+Shift+${key}" = "resize shrink ${dir} 1 px or 1 ppt"; + "${key}" = "resize grow ${dir} 5 px or 5 ppt"; + "${mod}+${key}" = "resize grow ${dir} 5 px or 5 ppt"; + "Shift+${key}" = "resize shrink ${dir} 5 px or 5 ppt"; + "${mod}+Shift+${key}" = "resize shrink ${dir} 5 px or 5 ppt"; }; directionBindings = @@ -35,7 +35,7 @@ in { "${mod}+Escape" = "mode \"default\""; "${mod}+Shift+Escape" = "mode \"default\""; - "${mod}+r" = "mode \"default\""; + "${mod}+s" = "mode \"default\""; "Escape" = "mode \"default\""; "Return" = "mode \"default\""; };