feat: big refactor

This commit is contained in:
Jacob Bachmann 2024-09-07 15:10:22 +02:00
parent 2c09c21833
commit ebedec9768
No known key found for this signature in database
GPG key ID: 7753026D577922A6
159 changed files with 1927 additions and 2222 deletions

View file

@ -0,0 +1,55 @@
{ ... }:
{
programs.autorandr = {
enable = true;
profiles = {
nomad = {
config = {
"LVDS-1" = {
enable = false;
};
};
};
samsung = {
fingerprint = {
"HDMI-0" = "00ffffffffffff004c2d830e000e0001011c0103806b3c780a23ada4544d99260f474abdef80714f81c0810081809500a9c0b300010104740030f2705a80b0588a00501d7400001e023a801871382d40582c4500501d7400001e000000fd00184b0f511e000a202020202020000000fc0053414d53554e470a202020202001b902034cf0535f101f041305142021225d5e626364071603122909070715075057070183010000e2004fe30503016e030c001000b83c20008001020304e3060d01e50e60616566e5018b849001011d80d0721c1620102c2580501d7400009e662156aa51001e30468f3300501d7400001e000000000000000000000000000000a3";
};
config = {
"HDMI-0" = {
enable = true;
primary = true;
mode = "3840x2160";
rate = "59.94";
position = "0x0";
};
};
};
station = {
config = {
"LVDS-1" = {
enable = false;
};
"DP-1-3" = {
enable = false;
mode = "1920x1080";
position = "0x0";
};
"DP-1-2" = {
enable = false;
mode = "1920x1080";
position = "1920x0";
};
"VGA-1-2" = {
enable = false;
mode = "1920x1080";
position = "3840x0";
};
};
};
};
};
}

View file

@ -0,0 +1,257 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.xsession.windowManager.i3.config;
# common = (import ../common.nix) { pkgs = pkgs; lib = lib; };
common = (import ../common.nix) {
inherit pkgs;
inherit lib;
};
start-polybar = pkgs.writeShellScript "start-polybar" ''
${pkgs.polybarFull}/bin/polybar-msg cmd quit
echo "---" | tee -a /tmp/polybar.log
${pkgs.polybarFull}/bin/polybar 2>&1 | tee -a /tmp/polybar.log & disown
'';
in
{
imports = [
./autorandr.nix
./polybar.nix
./rofi.nix
];
home.packages = with pkgs; [
dmenu
xclip # tool to access the x clipboard from a console application
wireplumber
feh # lightweight image viewer (also sets wallpaper)
brightnessctl # control screen brightness
pavucontrol # control audio
playerctl # control player
networkmanagerapplet # control network
udiskie # automount usb
blueman # control bluetooth
nextcloud-client # nextcloud client to connect to any instance
libsForQt5.kdeconnect-kde # sync phone and pc
system-config-printer # printer manager
gnome3.adwaita-icon-theme
maim
];
xsession = {
initExtra = "xset s off";
windowManager.i3 = {
enable = true;
config = {
modifier = "Mod4";
bars = [ ];
terminal = "${config.programs.kitty.package}/bin/kitty";
menu = "${config.programs.rofi.package}/bin/rofi -show drun";
startup = with pkgs; [
{ command = "${start-polybar}"; }
{
command = "${gnome.gnome-keyring}/bin/gnome-keyring-daemon --start --components=ssh,secrets,pkcs11";
}
{ command = "${autorandr}/bin/autorandr -c"; }
{ command = "${feh}/bin/feh --bg-fill ${common.wallpaper.default}"; }
{ command = "${networkmanagerapplet}/bin/nm-applet"; }
{ command = "${blueman}/bin/blueman-applet"; }
{ command = "${udiskie}/bin/udiskie --tray"; }
{ command = "${nextcloud-client}/bin/nextcloud"; }
{ command = "${plasma5Packages.kdeconnect-kde}/bin/kdeconnect-indicator"; }
{ command = "${system-config-printer}/bin/system-config-printer-applet"; }
{
command = "${config.programs.kitty.package}/bin/kitty --class dropdown --title dropdown";
always = true;
}
];
fonts = {
names = [ common.font ];
style = "Bold";
size = 12.0;
};
window = {
titlebar = false;
border = 4;
commands = [
{
command = "floating enable";
criteria = {
instance = "dropdown";
};
}
{
command = "resize set 1400 800";
criteria = {
instance = "dropdown";
};
}
{
command = "move scratchpad";
criteria = {
instance = "dropdown";
};
}
];
};
gaps = {
inner = 5;
};
colors = {
focused = {
border = common.colorschemes.default.active;
background = common.colorschemes.default.active;
text = common.colorschemes.default.black;
indicator = common.colorschemes.default.activeDark;
childBorder = common.colorschemes.default.active;
};
focusedInactive = {
border = common.colorschemes.default.inactive;
background = common.colorschemes.default.inactive;
text = common.colorschemes.default.white;
indicator = common.colorschemes.default.inactive;
childBorder = common.colorschemes.default.inactive;
};
unfocused = {
border = common.colorschemes.default.inactiveDark;
background = common.colorschemes.default.inactiveDark;
text = common.colorschemes.default.white;
indicator = common.colorschemes.default.inactiveDark;
childBorder = common.colorschemes.default.inactiveDark;
};
urgent = {
border = common.colorschemes.default.alert;
background = common.colorschemes.default.alert;
text = common.colorschemes.default.white;
indicator = common.colorschemes.default.black;
childBorder = common.colorschemes.default.alert;
};
placeholder = {
border = common.colorschemes.default.active;
background = common.colorschemes.default.active;
text = common.colorschemes.default.black;
indicator = common.colorschemes.default.activeDark;
childBorder = common.colorschemes.default.active;
};
};
keybindings = {
# Basics
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+q" = "kill";
"${cfg.modifier}+i" = "exec ${cfg.menu}";
"${cfg.modifier}+space" = "exec ${cfg.menu}";
"${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+Shift+q" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${cfg.modifier}+Shift+r" = "restart";
# Focus
"${cfg.modifier}+h" = "focus left";
"${cfg.modifier}+j" = "focus down";
"${cfg.modifier}+k" = "focus up";
"${cfg.modifier}+l" = "focus right";
"${cfg.modifier}+p" = "focus output left";
"${cfg.modifier}+n" = "focus output right";
# Moving
"${cfg.modifier}+Shift+h" = "move left";
"${cfg.modifier}+Shift+j" = "move down";
"${cfg.modifier}+Shift+k" = "move up";
"${cfg.modifier}+Shift+l" = "move right";
# Workspaces
"${cfg.modifier}+1" = "workspace number 1";
"${cfg.modifier}+2" = "workspace number 2";
"${cfg.modifier}+3" = "workspace number 3";
"${cfg.modifier}+4" = "workspace number 4";
"${cfg.modifier}+5" = "workspace number 5";
"${cfg.modifier}+6" = "workspace number 6";
"${cfg.modifier}+7" = "workspace number 7";
"${cfg.modifier}+8" = "workspace number 8";
"${cfg.modifier}+9" = "workspace number 9";
"${cfg.modifier}+0" = "workspace number 10";
"${cfg.modifier}+Shift+1" = "move container to workspace number 1";
"${cfg.modifier}+Shift+2" = "move container to workspace number 2";
"${cfg.modifier}+Shift+3" = "move container to workspace number 3";
"${cfg.modifier}+Shift+4" = "move container to workspace number 4";
"${cfg.modifier}+Shift+5" = "move container to workspace number 5";
"${cfg.modifier}+Shift+6" = "move container to workspace number 6";
"${cfg.modifier}+Shift+7" = "move container to workspace number 7";
"${cfg.modifier}+Shift+8" = "move container to workspace number 8";
"${cfg.modifier}+Shift+9" = "move container to workspace number 9";
"${cfg.modifier}+Shift+0" = "move container to workspace number 10";
"${cfg.modifier}+Control+j" = "workspace prev";
"${cfg.modifier}+Control+k" = "workspace next";
"${cfg.modifier}+Control+Shift+j" = "move workspace to output left";
"${cfg.modifier}+Control+Shift+k" = "move workspace to output right";
# Splits
"${cfg.modifier}+b" = "split h";
"${cfg.modifier}+v" = "split v";
# Layouts
"${cfg.modifier}+s" = "layout stacking";
"${cfg.modifier}+w" = "layout tabbed";
"${cfg.modifier}+e" = "layout toggle split";
"${cfg.modifier}+f" = "fullscreen toggle";
"${cfg.modifier}+a" = "focus parent";
"${cfg.modifier}+d" = "floating toggle";
"${cfg.modifier}+Shift+d" = "focus mode_toggle";
# Scratchpad
# "${cfg.modifier}+Shift+minus" = "move scratchpad";
# "${cfg.modifier}+minus" = "scratchpad show";
# Resize mode
"${cfg.modifier}+r" = "mode resize";
# Outer gaps
"${cfg.modifier}+equal" = "gaps horizontal current minus 200; gaps vertical current minus 100";
"${cfg.modifier}+minus" = "gaps horizontal current plus 200; gaps vertical current plus 100";
"${cfg.modifier}+bracketright" = "gaps outer current set 5";
"${cfg.modifier}+bracketleft" = "gaps horizontal current set 800; gaps vertical current set 400";
# Dropdown term
"${cfg.modifier}+grave" = "[instance=\"dropdown\"] scratchpad show; [instance=\"dropdown\"] move position center";
"${cfg.modifier}+Escape" = "[instance=\"dropdown\"] scratchpad show; [instance=\"dropdown\"] move position center";
# Multimedia Keys
"XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%-";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl -q set 5%+";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
# Screenshot
"Print" = "exec ${pkgs.maim}/bin/maim --select | xclip -selection clipboard -t image/png";
# Programs
"${cfg.modifier}+Shift+v" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${cfg.modifier}+Shift+b" = "exec ${pkgs.blueman}/bin/blueman-manager";
"${cfg.modifier}+Shift+n" = "exec ${pkgs.networkmanagerapplet}/bin/nm-connection-editor";
"${cfg.modifier}+Shift+a" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw";
};
};
extraConfig = ''
exec --no-startup-id ${pkgs.i3}/bin/i3-msg 'workspace 1'
'';
};
};
}

View file

@ -0,0 +1,176 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
polybarFull
];
xdg.configFile."polybar/config.ini" = {
text = ''
[colors]
background = #FFFFFF
background-alt = #D3D3D3
foreground = #000000
primary = #F0C674
secondary = #8ABEB7
blue = #4276b9
alert = #A54242
disabled = #707880
[bar/main]
width = 100%
height = 24pt
radius = 10
background = ''${colors.background}
foreground = ''${colors.foreground}
line-size = 3pt
border-size = 4pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator =
separator-foreground = ''${colors.disabled}
font-0 = DejaVuSansM Nerd Font:pixelsize=12;3
modules-left = xworkspaces xwindow
modules-right = systray wlan eth pulseaudio filesystem cpu temperature memory date
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 4pt
tray-size = 55%
tray-background = ''${colors.blue}
format-background = ''${colors.blue}
format-padding = 10px
format-radius = 5.0
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ''${colors.background-alt}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ''${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ''${colors.disabled}
label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /home
label-mounted = %free%
format-mounted = <label-mounted>
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <label-volume> <ramp-volume>
label-volume = %percentage%%
label-muted = 󰖁
ramp-volume-0 = 󰕿
ramp-volume-1 = 󰖀
ramp-volume-2 = 󰕾
click-right = pavucontrol
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
label-layout = %layout%
label-layout-foreground = ''${colors.primary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-foreground = ''${colors.background}
label-indicator-background = ''${colors.secondary}
[module/memory]
type = internal/memory
interval = 2
label = %gb_used:2%
format = <label>
format-margin = 5px
[module/temperature]
type = internal/temperature
internal = 1
warn-temperature = 80
format-warn-padding = 10px
format = <label> <ramp>
format-warn = <label-warn> <ramp>
format-warn-background = #eb4d4b
format-warn-foreground = #ffffff
ramp-0 =
ramp-1 =
ramp-2 =
[module/cpu]
type = internal/cpu
interval = 2
label = %percentage:2%%
format = <label>
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %signal%
label-disconnected = 󰖪
[module/eth]
inherit = network-base
interface-type = wired
label-connected = eth 󰈁
label-disconnected = 󰈂
[module/date]
type = internal/date
interval = 1
date = %a %b %d %H:%M
label = %date%
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini
'';
};
}

View file

@ -0,0 +1,50 @@
{ config, pkgs, lib, ... }:
let
common = (import ../common.nix) { pkgs = pkgs; lib = lib; };
inherit (config.lib.formats.rasi) mkLiteral;
in
{
programs.rofi = {
enable = true;
font = common.font + " " + common.font-size;
location = "center";
extraConfig = {
show-icons = mkLiteral "true";
};
theme = {
"prompt" = {
"text-color" = mkLiteral common.colorschemes.default.inactive;
};
"textbox-prompt-colon" = {
expand = false;
str = ":";
margin = mkLiteral "0px 0.3em 0em 0em";
"text-color" = mkLiteral common.colorschemes.default.inactive;
};
"inputbar" = {
"padding" = mkLiteral "10px 20px 10px 20px";
"border" = mkLiteral "0px 0px 1px dash 0px";
"border-color" = mkLiteral common.colorschemes.default.activeDark;
"children" = map mkLiteral [ "prompt" "textbox-prompt-colon" "entry" ];
};
"listview" = {
"padding" = mkLiteral "10px";
};
"element" = {
"padding" = mkLiteral "10px";
};
"element-text" = {
"margin" = mkLiteral "0px 0px 0px 20px";
};
} // lib.foldl'
(acc: elem: acc // {
${elem} = { "background-color" = mkLiteral common.colorschemes.default.activeDark; };
})
{ }
(lib.mapCartesianProduct ({ a, b, c }: lib.concatStringsSep "." [ a b c ]) {
a = [ "element" "element-text" "element-icon" ];
b = [ "selected" ];
c = [ "normal" "urgent" "active" ];
});
};
}