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,20 +1,32 @@
{ pkgs, ...}: {
{ pkgs, ...}:
{
imports = [
./hardware-configuration.nix
];
boot = {
loader.grub = {
enable = true;
device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S4CNNE0M700172J";
loader = {
timeout = 2;
grub = {
enable = true;
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"
# "video=HDMI-3:1920x1080@75"
# ];
# doesn't even work, todo when fixed: remove xrandr from i3 autostart
kernelParams = [
"video=DP-3:1920x1080@240"
"video=HDMI-3:1920x1080@75"
];
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.config.permittedInsecurePackages = [
"freeimage-unstable-2021-11-01"
];
networking.hostName = "krizej-pc";
networking.networkmanager.enable = true;
@ -31,6 +43,8 @@
};
};
# programs.sway.enable = true;
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
@ -128,6 +142,35 @@
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.config.allowUnfree = true;
system.stateVersion = "23.11";

View file

@ -21,13 +21,14 @@ in rec {
programs = lib.genAttrs (import ./programs)
(cfg_name: importCfg { prefix = "programs"; name = cfg_name; });
home.packages = with pkgs; [
home.packages = with pkgs; [
xfce.thunar
xfce.tumbler # image previews in thunar
xfce.thunar-volman
xfce.thunar-archive-plugin
xfce.thunar-media-tags-plugin
gvfs # some more stuff for thunar
xarchiver
fortune
vim-full
@ -47,6 +48,13 @@ in rec {
pamixer
gimp
xorg.xkill
gamemode
gdb
trenchbroom
vkquake
ericw-tools
xdotool
yad
# # It is sometimes useful to fine-tune packages, for example, by applying
# # 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
@ -59,6 +67,26 @@ in rec {
# (pkgs.writeShellScriptBin "my-hello" ''
# 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 = {

View file

@ -11,21 +11,25 @@
};
window = {
titlebar = false;
border = 1;
titlebar = false;
};
floating = {
border = 1;
titlebar = true;
criteria = [
{ class = "zenity"; }
{ class = "fceux"; }
{ title = "Friends List"; } # steam
];
};
gaps = {
inner = 0;
outer = 0;
};
floating.criteria = [
{ class = "zenity"; }
{ class = "fceux"; }
{ title = "Friends List"; } # steam
];
fonts = {
names = ["JetBrains Mono NL"];
size = 10.0;
@ -46,18 +50,9 @@
focus = {
followMouse = 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 = [
{ command = "picom &"; notification = false; }
{ command = "mpd &"; notification = false; }
@ -76,25 +71,39 @@
{ 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 = "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";
floating.modifier = "Mod4";
keybindings =
let
keybindings = let
mod = modifier;
execns = "exec --no-startup-id";
cmd_and_center = (cmd: "${execns} i3-msg '${cmd}' && i3custom-center-mouse-on-focus");
in {
# Program keybinds
"${mod}+Return" = "exec --no-startup-id alacritty";
"${mod}+Shift+s" = "exec --no-startup-id flameshot gui";
"${mod}+b" = "exec --no-startup-id firefox";
"${mod}+d" = "exec --no-startup-id rofi -show drun";
"${mod}+Return" = "${execns} alacritty";
"${mod}+Shift+s" = "${execns} flameshot gui";
"${mod}+b" = "${execns} firefox";
"${mod}+d" = "${execns} rofi -show drun";
# hack, see i3 user doc for --release flag
"--release ${mod}+k" = "exec xkill";
# Volume control
"Ctrl+F9" = "exec --no-startup-id pamixer --toggle-mute";
"Ctrl+F10" = "exec --no-startup-id pamixer --decrease 5";
"Ctrl+F11" = "exec --no-startup-id pamixer --increase 5";
"Ctrl+F9" = "${execns} pamixer --toggle-mute";
"Ctrl+F10" = "${execns} pamixer --decrease 5";
"Ctrl+F11" = "${execns} pamixer --increase 5";
# MPD controls
# "Ctrl+F5" = "exec ~/music/select_music.sh";
@ -108,50 +117,51 @@
# "Ctrl+Shift+F11" = ''exec mpc volume +5 && dunstify "mpc $(mpc volume)" -r 420'';
# General i3 keybindings
"${mod}+f" = "fullscreen toggle";
"${mod}+f" = cmd_and_center "fullscreen toggle";
"${mod}+r" = "mode resize";
"${mod}+Shift+q" = "kill";
"${mod}+k" = "exec xkill";
"${mod}+Shift+q" = cmd_and_center "kill";
"${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}+Right" = "focus right";
"${mod}+Up" = "focus up";
"${mod}+Down" = "focus down";
"${mod}+Shift+Left" = "move left";
"${mod}+Shift+Right" = "move right";
"${mod}+Shift+Up" = "move up";
"${mod}+Shift+Down" = "move down";
"${mod}+Left" = cmd_and_center "focus left";
"${mod}+Right" = cmd_and_center "focus right";
"${mod}+Up" = cmd_and_center "focus up";
"${mod}+Down" = cmd_and_center "focus down";
"${mod}+Shift+Left" = cmd_and_center "move left";
"${mod}+Shift+Right" = cmd_and_center "move right";
"${mod}+Shift+Up" = cmd_and_center "move up";
"${mod}+Shift+Down" = cmd_and_center "move down";
"${mod}+q" = "layout stacking";
"${mod}+w" = "layout tabbed";
"${mod}+e" = "layout toggle split";
"${mod}+q" = cmd_and_center "layout stacking";
"${mod}+w" = cmd_and_center "layout tabbed";
"${mod}+e" = cmd_and_center "layout toggle split";
"${mod}+Shift+space" = "floating toggle";
"${mod}+space" = "focus mode_toggle";
"${mod}+Shift+space" = "${execns} i3custom-floating-toggle && i3custom-center-mouse-on-focus";
"${mod}+space" = cmd_and_center "focus mode_toggle";
"${mod}+1" = "workspace number 1";
"${mod}+2" = "workspace number 2";
"${mod}+3" = "workspace number 3";
"${mod}+4" = "workspace number 4";
"${mod}+5" = "workspace number 5";
"${mod}+6" = "workspace number 6";
"${mod}+7" = "workspace number 7";
"${mod}+8" = "workspace number 8";
"${mod}+9" = "workspace number 9";
"${mod}+0" = "workspace number 10";
"${mod}+1" = cmd_and_center "workspace number 1";
"${mod}+2" = cmd_and_center "workspace number 2";
"${mod}+3" = cmd_and_center "workspace number 3";
"${mod}+4" = cmd_and_center "workspace number 4";
"${mod}+5" = cmd_and_center "workspace number 5";
"${mod}+6" = cmd_and_center "workspace number 6";
"${mod}+7" = cmd_and_center "workspace number 7";
"${mod}+8" = cmd_and_center "workspace number 8";
"${mod}+9" = cmd_and_center "workspace number 9";
"${mod}+0" = cmd_and_center "workspace number 10";
"${mod}+Shift+1" = "move container to workspace number 1";
"${mod}+Shift+2" = "move container to workspace number 2";
"${mod}+Shift+3" = "move container to workspace number 3";
"${mod}+Shift+4" = "move container to workspace number 4";
"${mod}+Shift+5" = "move container to workspace number 5";
"${mod}+Shift+6" = "move container to workspace number 6";
"${mod}+Shift+7" = "move container to workspace number 7";
"${mod}+Shift+8" = "move container to workspace number 8";
"${mod}+Shift+9" = "move container to workspace number 9";
"${mod}+Shift+0" = "move container to workspace number 10";
"${mod}+Shift+1" = cmd_and_center "move container to workspace number 1";
"${mod}+Shift+2" = cmd_and_center "move container to workspace number 2";
"${mod}+Shift+3" = cmd_and_center "move container to workspace number 3";
"${mod}+Shift+4" = cmd_and_center "move container to workspace number 4";
"${mod}+Shift+5" = cmd_and_center "move container to workspace number 5";
"${mod}+Shift+6" = cmd_and_center "move container to workspace number 6";
"${mod}+Shift+7" = cmd_and_center "move container to workspace number 7";
"${mod}+Shift+8" = cmd_and_center "move container to workspace number 8";
"${mod}+Shift+9" = cmd_and_center "move container to workspace number 9";
"${mod}+Shift+0" = cmd_and_center "move container to workspace number 10";
};
};
}