cool i3 thing and some changes because i forgot to commit xd

This commit is contained in:
krizej 2024-06-17 16:36:50 +02:00
parent 4adc34f8c0
commit 370542a562
3 changed files with 157 additions and 76 deletions

View file

@ -1,21 +1,33 @@
{ pkgs, ...}: { { pkgs, ...}:
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
boot = { boot = {
loader.grub = { loader = {
timeout = 2;
grub = {
enable = true; enable = true;
device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S4CNNE0M700172J"; device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S4CNNE0M700172J";
gfxmodeBios = "auto"; # 1920x1080 did not work
splashImage = null;
font = null;
}; };
# kernelParams = [ };
# "video=DP-3:1920x1080@240" # doesn't even work, todo when fixed: remove xrandr from i3 autostart
# "video=HDMI-3:1920x1080@75" kernelParams = [
# ]; "video=DP-3:1920x1080@240"
"video=HDMI-3:1920x1080@75"
];
}; };
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.permittedInsecurePackages = [
"freeimage-unstable-2021-11-01"
];
networking.hostName = "krizej-pc"; networking.hostName = "krizej-pc";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
@ -31,6 +43,8 @@
}; };
}; };
# programs.sway.enable = true;
services.xserver = { services.xserver = {
enable = true; enable = true;
displayManager.gdm.enable = true; displayManager.gdm.enable = true;
@ -128,6 +142,35 @@
Defaults pwfeedback Defaults pwfeedback
''; '';
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
mesa
amdvlk
libdrm
libva
vaapiVdpau
libvdpau-va-gl
rocmPackages.clr.icd
];
extraPackages32 = with pkgs; [
driversi686Linux.mesa
driversi686Linux.amdvlk
driversi686Linux.vaapiVdpau
driversi686Linux.libvdpau-va-gl
];
};
};
boot.initrd.kernelModules = [ "amdgpu" ];
environment.sessionVariables = {
AMD_VULKAN_ICD = "RADV";
};
nixpkgs.overlays = import ./pkgs pkgs; nixpkgs.overlays = import ./pkgs pkgs;
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
system.stateVersion = "23.11"; system.stateVersion = "23.11";

View file

@ -28,6 +28,7 @@ in rec {
xfce.thunar-volman xfce.thunar-volman
xfce.thunar-archive-plugin xfce.thunar-archive-plugin
xfce.thunar-media-tags-plugin xfce.thunar-media-tags-plugin
gvfs # some more stuff for thunar
xarchiver xarchiver
fortune fortune
vim-full vim-full
@ -47,6 +48,13 @@ in rec {
pamixer pamixer
gimp gimp
xorg.xkill xorg.xkill
gamemode
gdb
trenchbroom
vkquake
ericw-tools
xdotool
yad
# # It is sometimes useful to fine-tune packages, for example, by applying # # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the # # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
@ -59,6 +67,26 @@ in rec {
# (pkgs.writeShellScriptBin "my-hello" '' # (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!" # echo "Hello, ${config.home.username}!"
# '') # '')
(pkgs.writeShellScriptBin "i3custom-center-mouse-on-focus" ''
eval $(xdotool getwindowfocus getwindowgeometry --shell)
MX=$(($X + $WIDTH / 2))
MY=$(($Y + $HEIGHT / 2))
xdotool mousemove $MX $MY
'')
(pkgs.writeShellScriptBin "i3custom-window-actions" ''
yad --splash --mouse --button float:0 --button kill:1 --title="window actions"
case $? in
0) i3custom-floating-toggle;;
1) i3-msg "kill";;
-1) ;;
esac
'')
(pkgs.writeShellScriptBin "i3custom-floating-toggle" ''
i3-msg "mark --add _; [con_mark=f] floating disable, border pixel 1, mark --add --toggle _; [con_mark=_] floating enable, border normal; mark --add --toggle f;"
'')
]; ];
home.file = { home.file = {

View file

@ -11,8 +11,18 @@
}; };
window = { window = {
titlebar = false;
border = 1; border = 1;
titlebar = false;
};
floating = {
border = 1;
titlebar = true;
criteria = [
{ class = "zenity"; }
{ class = "fceux"; }
{ title = "Friends List"; } # steam
];
}; };
gaps = { gaps = {
@ -20,12 +30,6 @@
outer = 0; outer = 0;
}; };
floating.criteria = [
{ class = "zenity"; }
{ class = "fceux"; }
{ title = "Friends List"; } # steam
];
fonts = { fonts = {
names = ["JetBrains Mono NL"]; names = ["JetBrains Mono NL"];
size = 10.0; size = 10.0;
@ -46,16 +50,7 @@
focus = { focus = {
followMouse = true; followMouse = true;
mouseWarping = true; mouseWarping = true;
}; newWindow = "urgent";
modes = {
resize = {
"Left" = "resize shrink width 10 px or 10 ppt";
"Right" = "resize grow width 10 px or 10 ppt";
"Up" = "resize shrink height 10 px or 10 ppt";
"Down" = "resize grow height 10 px or 10 ppt";
"Escape" = "mode default";
};
}; };
startup = [ startup = [
@ -76,25 +71,39 @@
{ command = "element-desktop &"; notification = false; } { command = "element-desktop &"; notification = false; }
{ command = "xrandr --output DP-3 --mode 1920x1080 --rate 239.76 --primary --output HDMI-3 --mode 1920x1080 --rate 74.97 --right-of DP-3 &"; notification = false; } { command = "xrandr --output DP-3 --mode 1920x1080 --rate 239.76 --primary --output HDMI-3 --mode 1920x1080 --rate 74.97 --right-of DP-3 &"; notification = false; }
{ command = "sleep 1 && i3-msg \"workspace 1\""; notification = false; }
]; ];
modes = let
cmd_and_center = (cmd: "exec --no-startup-id i3-msg '${cmd}' && i3-center-mouse-on-focus");
in {
resize = {
"Left" = cmd_and_center "resize shrink width 10 px or 10 ppt";
"Right" = cmd_and_center "resize grow width 10 px or 10 ppt";
"Up" = cmd_and_center "resize shrink height 10 px or 10 ppt";
"Down" = cmd_and_center "resize grow height 10 px or 10 ppt";
"Escape" = "mode default";
};
};
modifier = "Mod4"; modifier = "Mod4";
floating.modifier = "Mod4"; floating.modifier = "Mod4";
keybindings = keybindings = let
let
mod = modifier; mod = modifier;
execns = "exec --no-startup-id";
cmd_and_center = (cmd: "${execns} i3-msg '${cmd}' && i3custom-center-mouse-on-focus");
in { in {
# Program keybinds # Program keybinds
"${mod}+Return" = "exec --no-startup-id alacritty"; "${mod}+Return" = "${execns} alacritty";
"${mod}+Shift+s" = "exec --no-startup-id flameshot gui"; "${mod}+Shift+s" = "${execns} flameshot gui";
"${mod}+b" = "exec --no-startup-id firefox"; "${mod}+b" = "${execns} firefox";
"${mod}+d" = "exec --no-startup-id rofi -show drun"; "${mod}+d" = "${execns} rofi -show drun";
# hack, see i3 user doc for --release flag
"--release ${mod}+k" = "exec xkill";
# Volume control # Volume control
"Ctrl+F9" = "exec --no-startup-id pamixer --toggle-mute"; "Ctrl+F9" = "${execns} pamixer --toggle-mute";
"Ctrl+F10" = "exec --no-startup-id pamixer --decrease 5"; "Ctrl+F10" = "${execns} pamixer --decrease 5";
"Ctrl+F11" = "exec --no-startup-id pamixer --increase 5"; "Ctrl+F11" = "${execns} pamixer --increase 5";
# MPD controls # MPD controls
# "Ctrl+F5" = "exec ~/music/select_music.sh"; # "Ctrl+F5" = "exec ~/music/select_music.sh";
@ -108,50 +117,51 @@
# "Ctrl+Shift+F11" = ''exec mpc volume +5 && dunstify "mpc $(mpc volume)" -r 420''; # "Ctrl+Shift+F11" = ''exec mpc volume +5 && dunstify "mpc $(mpc volume)" -r 420'';
# General i3 keybindings # General i3 keybindings
"${mod}+f" = "fullscreen toggle"; "${mod}+f" = cmd_and_center "fullscreen toggle";
"${mod}+r" = "mode resize"; "${mod}+r" = "mode resize";
"${mod}+Shift+q" = "kill"; "${mod}+Shift+q" = cmd_and_center "kill";
"${mod}+k" = "exec xkill";
"${mod}+Shift+r" = "restart"; "${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exec --no-startup-id i3-nagbar -t warning -m 'exit?' -b 'yes' 'i3-msg exit'"; "${mod}+Shift+e" = "${execns} i3-nagbar -t warning -m 'exit?' -b 'yes' 'i3-msg exit'";
# Mouse bindings
"--border --whole-window button8" = "${execns} i3custom-window-actions";
"${mod}+Left" = "focus left"; "${mod}+Left" = cmd_and_center "focus left";
"${mod}+Right" = "focus right"; "${mod}+Right" = cmd_and_center "focus right";
"${mod}+Up" = "focus up"; "${mod}+Up" = cmd_and_center "focus up";
"${mod}+Down" = "focus down"; "${mod}+Down" = cmd_and_center "focus down";
"${mod}+Shift+Left" = "move left"; "${mod}+Shift+Left" = cmd_and_center "move left";
"${mod}+Shift+Right" = "move right"; "${mod}+Shift+Right" = cmd_and_center "move right";
"${mod}+Shift+Up" = "move up"; "${mod}+Shift+Up" = cmd_and_center "move up";
"${mod}+Shift+Down" = "move down"; "${mod}+Shift+Down" = cmd_and_center "move down";
"${mod}+q" = "layout stacking"; "${mod}+q" = cmd_and_center "layout stacking";
"${mod}+w" = "layout tabbed"; "${mod}+w" = cmd_and_center "layout tabbed";
"${mod}+e" = "layout toggle split"; "${mod}+e" = cmd_and_center "layout toggle split";
"${mod}+Shift+space" = "floating toggle"; "${mod}+Shift+space" = "${execns} i3custom-floating-toggle && i3custom-center-mouse-on-focus";
"${mod}+space" = "focus mode_toggle"; "${mod}+space" = cmd_and_center "focus mode_toggle";
"${mod}+1" = "workspace number 1"; "${mod}+1" = cmd_and_center "workspace number 1";
"${mod}+2" = "workspace number 2"; "${mod}+2" = cmd_and_center "workspace number 2";
"${mod}+3" = "workspace number 3"; "${mod}+3" = cmd_and_center "workspace number 3";
"${mod}+4" = "workspace number 4"; "${mod}+4" = cmd_and_center "workspace number 4";
"${mod}+5" = "workspace number 5"; "${mod}+5" = cmd_and_center "workspace number 5";
"${mod}+6" = "workspace number 6"; "${mod}+6" = cmd_and_center "workspace number 6";
"${mod}+7" = "workspace number 7"; "${mod}+7" = cmd_and_center "workspace number 7";
"${mod}+8" = "workspace number 8"; "${mod}+8" = cmd_and_center "workspace number 8";
"${mod}+9" = "workspace number 9"; "${mod}+9" = cmd_and_center "workspace number 9";
"${mod}+0" = "workspace number 10"; "${mod}+0" = cmd_and_center "workspace number 10";
"${mod}+Shift+1" = "move container to workspace number 1"; "${mod}+Shift+1" = cmd_and_center "move container to workspace number 1";
"${mod}+Shift+2" = "move container to workspace number 2"; "${mod}+Shift+2" = cmd_and_center "move container to workspace number 2";
"${mod}+Shift+3" = "move container to workspace number 3"; "${mod}+Shift+3" = cmd_and_center "move container to workspace number 3";
"${mod}+Shift+4" = "move container to workspace number 4"; "${mod}+Shift+4" = cmd_and_center "move container to workspace number 4";
"${mod}+Shift+5" = "move container to workspace number 5"; "${mod}+Shift+5" = cmd_and_center "move container to workspace number 5";
"${mod}+Shift+6" = "move container to workspace number 6"; "${mod}+Shift+6" = cmd_and_center "move container to workspace number 6";
"${mod}+Shift+7" = "move container to workspace number 7"; "${mod}+Shift+7" = cmd_and_center "move container to workspace number 7";
"${mod}+Shift+8" = "move container to workspace number 8"; "${mod}+Shift+8" = cmd_and_center "move container to workspace number 8";
"${mod}+Shift+9" = "move container to workspace number 9"; "${mod}+Shift+9" = cmd_and_center "move container to workspace number 9";
"${mod}+Shift+0" = "move container to workspace number 10"; "${mod}+Shift+0" = cmd_and_center "move container to workspace number 10";
}; };
}; };
} }