restructure terminal stuff

This commit is contained in:
Ingolf Wagner 2024-06-15 20:10:06 +02:00
parent 366c10a2fd
commit a11957d85a
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
4 changed files with 138 additions and 162 deletions

View file

@ -13,6 +13,9 @@
''; '';
}; };
# to prevent strange errors
programs.kitty.enable = true;
programs.thefuck.enable = true; programs.thefuck.enable = true;
# a better cat # a better cat

View file

@ -0,0 +1,18 @@
{ pkgs, lib, config, ... }:
with lib;
{
options.gui.alacritty.enable = mkOption {
type = lib.types.bool;
default = config.gui.enable;
};
config = lib.mkIf config.gui.alacritty.enable {
programs.alacritty = {
enable = true;
settings = {
font.size = mkForce 6.5;
};
};
};
}

View file

@ -1,3 +1,6 @@
{ {
imports = [ ./kitty.nix ]; imports = [
./alacritty.nix
./kitty.nix
];
} }

View file

@ -1,8 +1,6 @@
{ config, lib, pkgs, osConfig, ... }: { config, lib, pkgs, osConfig, ... }:
let let
cfg = config.xsession.windowManager.i3;
rofi = pkgs.rofi.override { plugins = [ pkgs.rofi-emoji pkgs.rofi-calc pkgs.xdotool ]; }; rofi = pkgs.rofi.override { plugins = [ pkgs.rofi-emoji pkgs.rofi-calc pkgs.xdotool ]; };
backgroundCommand = pkgs.writers.writeDash "background" '' backgroundCommand = pkgs.writers.writeDash "background" ''
@ -26,8 +24,12 @@ let
in in
{ {
options.gui.i3.enable = mkOption {
type = lib.types.bool;
default = config.gui.enable;
};
config = lib.mkIf config.gui.enable { config = lib.mkIf config.gui.i3.enable {
home.packages = home.packages =
let let
@ -42,8 +44,6 @@ in
pkgs.xdotool # needed for rofi-emoji pkgs.xdotool # needed for rofi-emoji
]; ];
programs.i3status-rust = { programs.i3status-rust = {
enable = true; enable = true;
bars = { bars = {
@ -118,12 +118,6 @@ in
}; };
}; };
programs.alacritty = {
enable = true;
settings = {
font.size = lib.mkForce 6.5;
};
};
services.copyq = { services.copyq = {
enable = true; enable = true;
@ -188,127 +182,131 @@ in
]; ];
keybindings = { keybindings =
"Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/"; let
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; cfg = config.xsession.windowManager.i3;
"${cfg.config.modifier}+Shift+q" = "exit"; modifier = config.xsession.windowManager.i3.config.modifier;
"${cfg.config.modifier}+q" = "kill"; in
{
"Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/";
"${modifier}+Return" = "exec ${cfg.config.terminal}";
"${modifier}+Shift+q" = "exit";
"${modifier}+q" = "kill";
"${cfg.config.modifier}+Left" = "focus left"; "${modifier}+Left" = "focus left";
"${cfg.config.modifier}+Down" = "focus down"; "${modifier}+Down" = "focus down";
"${cfg.config.modifier}+Up" = "focus up"; "${modifier}+Up" = "focus up";
"${cfg.config.modifier}+Right" = "focus right"; "${modifier}+Right" = "focus right";
"${cfg.config.modifier}+j" = "focus next"; "${modifier}+j" = "focus next";
"${cfg.config.modifier}+k" = "focus prev"; "${modifier}+k" = "focus prev";
"${cfg.config.modifier}+Shift+Left" = "move left"; "${modifier}+Shift+Left" = "move left";
"${cfg.config.modifier}+Shift+Down" = "move down"; "${modifier}+Shift+Down" = "move down";
"${cfg.config.modifier}+Shift+Up" = "move up"; "${modifier}+Shift+Up" = "move up";
"${cfg.config.modifier}+Shift+Right" = "move right"; "${modifier}+Shift+Right" = "move right";
"${cfg.config.modifier}+h" = "split h"; "${modifier}+h" = "split h";
"${cfg.config.modifier}+v" = "split v"; "${modifier}+v" = "split v";
"${cfg.config.modifier}+f" = "fullscreen toggle"; "${modifier}+f" = "fullscreen toggle";
"${cfg.config.modifier}+s" = "layout stacking"; "${modifier}+s" = "layout stacking";
"${cfg.config.modifier}+w" = "layout tabbed"; "${modifier}+w" = "layout tabbed";
"${cfg.config.modifier}+e" = "layout toggle split"; "${modifier}+e" = "layout toggle split";
"${cfg.config.modifier}+t" = "floating toggle"; "${modifier}+t" = "floating toggle";
#"${cfg.config.modifier}+space" = "focus mode_toggle";
"${cfg.config.modifier}+b" = "exec ${backgroundCommand}"; "${modifier}+b" = "exec ${backgroundCommand}";
"${cfg.config.modifier}+p" = "focus parent"; "${modifier}+p" = "focus parent";
"${cfg.config.modifier}+Shift+minus" = "move scratchpad"; "${modifier}+Shift+minus" = "move scratchpad";
"${cfg.config.modifier}+minus" = "scratchpad show"; "${modifier}+minus" = "scratchpad show";
"${cfg.config.modifier}+1" = "workspace 1"; "${modifier}+1" = "workspace 1";
"${cfg.config.modifier}+2" = "workspace 2"; "${modifier}+2" = "workspace 2";
"${cfg.config.modifier}+3" = "workspace 3"; "${modifier}+3" = "workspace 3";
"${cfg.config.modifier}+4" = "workspace 4"; "${modifier}+4" = "workspace 4";
"${cfg.config.modifier}+5" = "workspace 5"; "${modifier}+5" = "workspace 5";
"${cfg.config.modifier}+6" = "workspace 6"; "${modifier}+6" = "workspace 6";
"${cfg.config.modifier}+7" = "workspace 7"; "${modifier}+7" = "workspace 7";
"${cfg.config.modifier}+8" = "workspace 8"; "${modifier}+8" = "workspace 8";
"${cfg.config.modifier}+9" = "workspace 9"; "${modifier}+9" = "workspace 9";
"${cfg.config.modifier}+0" = "workspace 10"; "${modifier}+0" = "workspace 10";
"${cfg.config.modifier}+Shift+1" = "move container to workspace number 1"; "${modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.config.modifier}+Shift+2" = "move container to workspace number 2"; "${modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.config.modifier}+Shift+3" = "move container to workspace number 3"; "${modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.config.modifier}+Shift+4" = "move container to workspace number 4"; "${modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.config.modifier}+Shift+5" = "move container to workspace number 5"; "${modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.config.modifier}+Shift+6" = "move container to workspace number 6"; "${modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.config.modifier}+Shift+7" = "move container to workspace number 7"; "${modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.config.modifier}+Shift+8" = "move container to workspace number 8"; "${modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.config.modifier}+Shift+9" = "move container to workspace number 9"; "${modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.config.modifier}+Shift+0" = "move container to workspace number 10"; "${modifier}+Shift+0" = "move container to workspace number 10";
"${cfg.config.modifier}+Escape" = "workspace back_and_forth"; "${modifier}+Escape" = "workspace back_and_forth";
# rename workspace # rename workspace
"${cfg.config.modifier}+n" = '' "${modifier}+n" = ''
exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: ' exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: '
''; '';
# change to named workspace # change to named workspace
"${cfg.config.modifier}+grave" = "${modifier}+grave" =
let let
script = pkgs.writers.writeBash "select-workspace" '' script = pkgs.writers.writeBash "select-workspace" ''
set -e set -e
set -o pipefail set -o pipefail
${pkgs.i3}/bin/i3-msg -t get_workspaces | \ ${pkgs.i3}/bin/i3-msg -t get_workspaces | \
${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \
${rofi}/bin/rofi -dmenu -p 'Select Workspace ' | \ ${rofi}/bin/rofi -dmenu -p 'Select Workspace ' | \
while read line while read line
do do
${pkgs.i3}/bin/i3-msg workspace "$line" ${pkgs.i3}/bin/i3-msg workspace "$line"
done done
''; '';
in in
"exec ${script}"; "exec ${script}";
"${cfg.config.modifier}+Shift+grave" = "${modifier}+Shift+grave" =
let let
script = pkgs.writers.writeBash "move-workspace" '' script = pkgs.writers.writeBash "move-workspace" ''
set -e set -e
set -o pipefail set -o pipefail
${pkgs.i3}/bin/i3-msg -t get_workspaces | \ ${pkgs.i3}/bin/i3-msg -t get_workspaces | \
${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \ ${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \
${rofi}/bin/rofi -dmenu -p 'Move to Workspace ' | \ ${rofi}/bin/rofi -dmenu -p 'Move to Workspace ' | \
while read line while read line
do do
${pkgs.i3}/bin/i3-msg move container to workspace "$line" ${pkgs.i3}/bin/i3-msg move container to workspace "$line"
done done
''; '';
in in
"exec ${script}"; "exec ${script}";
"${cfg.config.modifier}+space" = "exec ${rofi}/bin/rofi -show drun -display-drun ''"; "${modifier}+space" = "exec ${rofi}/bin/rofi -show drun -display-drun ''";
"${cfg.config.modifier}+Shift+c" = "reload"; "${modifier}+Shift+c" = "reload";
"${cfg.config.modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";
"${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'"; "${modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${cfg.config.modifier}+r" = "mode resize"; "${modifier}+r" = "mode resize";
# multiple monitors # multiple monitors
# autorandr --save docked # to save setup # autorandr --save docked # to save setup
# autorandr --save undocked # to save setup # autorandr --save undocked # to save setup
# autorandr --change # automatically detects the setup # autorandr --change # automatically detects the setup
"${cfg.config.modifier}+BackSpace" = "${modifier}+BackSpace" =
let let
script = pkgs.writers.writeBash "autorandr" '' script = pkgs.writers.writeBash "autorandr" ''
${pkgs.autorandr}/bin/autorandr --change ${pkgs.autorandr}/bin/autorandr --change
${backgroundCommand} ${backgroundCommand}
''; '';
in in
"exec ${toString script}"; "exec ${toString script}";
# like vimperator # like vimperator
"${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus"; "${modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus";
}; };
}; };
}; };
}; };
@ -494,52 +492,6 @@ in
}; };
}; };
xdg.configFile."albert/albert.conf".text = ''
[General]
hotkey=Meta+Space
showTray=false
telemetry=false
terminal=urxvt -e
[org.albert.extension.applications]
enabled=true
fuzzy=true
use_generic_name=true
use_keywords=true
[org.albert.extension.calculator]
enabled=true
[org.albert.extension.hashgenerator]
enabled=true
[org.albert.frontend.widgetboxmodel]
alwaysOnTop=true
clearOnHide=false
displayIcons=true
displayScrollbar=false
displayShadow=false
hideOnClose=false
hideOnFocusLoss=true
itemCount=5
showCentered=true
theme=SolarizedBrightViolet
'';
xdg.configFile."Code/User/settings.json".text = builtins.toJSON {
"keyboard.dispatch" = "keyCode";
"explorer.confirmDragAndDrop" = false;
"editor.tabSize" = 2;
"window.zoomLevel" = -1;
"git.enableSmartCommit" = true;
"files.autoSave" = "onFocusChange";
"terminal.integrated.setLocaleVariables" = true;
"terminal.external.linuxExec" = "xterm";
"explorer.confirmDelete" = false;
"todo-tree.tags" = [ "todo" "TODO" "fixme" "FIXME" ];
"workbench.colorTheme" = "Solarized Light";
};
}; };
} }