feat: i3/sway rework

This commit is contained in:
winston 2023-05-18 19:10:41 +02:00
parent d56f98b568
commit fc7c791b41
Signed by: winston
GPG key ID: 3786770EDBC2B481
4 changed files with 160 additions and 53 deletions

View file

@ -214,11 +214,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1684363872, "lastModified": 1684393889,
"narHash": "sha256-jkvhzrICFSmj+NBHksKTWzs8Q3+D7RsVK0wLKacbu8s=", "narHash": "sha256-X4EP3TdpskELgOKGfm7UcLLGheqxYJZuNEEc0HkmrO0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1d77f3b72756ca36f16440c59e6b89a957908647", "rev": "9f7d9a55cc9960c029b006444e64e8dfa54a578e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -262,11 +262,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1684393705, "lastModified": 1684416496,
"narHash": "sha256-w5xLzA7UKW9zaJSQ8s3eSV72AQwBrODJcHcdwM2curI=", "narHash": "sha256-t1vPAJqbHaelwKBNEVNIYp434eLCtkBEXIR8s4ggl8I=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "369d7cbaccdc84b26bd40b33050c5d56ab1cfcff", "rev": "2c8cb59b2703bd68c177c1085221eda9e2fe7db9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -338,16 +338,17 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1684366788, "lastModified": 1684127469,
"narHash": "sha256-qAP0v8DaDTGRdLjWPd1IReE6lwmZ2aqYOjnQdP1n6hg=", "narHash": "sha256-vkAXmf+3ZpTRS8zzgSjQyeYvoVK7E+3yiWUnIw2GDT8=",
"owner": "willpower3309", "owner": "willpower3309",
"repo": "swayfx", "repo": "swayfx",
"rev": "acafb20b114ea93f971e118da0233c07157286c0", "rev": "479cc4e7456a93aed1a89bef8d83c1f8c43bd291",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "willpower3309", "owner": "willpower3309",
"repo": "swayfx", "repo": "swayfx",
"rev": "479cc4e7456a93aed1a89bef8d83c1f8c43bd291",
"type": "github" "type": "github"
} }
}, },

View file

@ -18,8 +18,8 @@
nix-index-database.url = "github:Mic92/nix-index-database"; nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
# dev # TODO: commit remove once fixed
swayfx.url = "github:willpower3309/swayfx"; swayfx.url = "github:willpower3309/swayfx/479cc4e7456a93aed1a89bef8d83c1f8c43bd291";
swayfx.inputs.nixpkgs.follows = "nixpkgs"; swayfx.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";

View file

@ -8,9 +8,42 @@
inherit (pkgs.stdenv.hostPlatform) isLinux; inherit (pkgs.stdenv.hostPlatform) isLinux;
fonts = { fonts = {
names = ["IBM Plex Sans" "Symbols Nerd Font"]; names = ["IBM Plex Sans" "Symbols Nerd Font"];
size = 16.0; size = 12.0;
}; };
recursiveMerge = with lib;
attrList: let
f = attrPath:
zipAttrsWith (
n: values:
if tail values == []
then head values
else if all isList values
then unique (concatLists values)
else if all isAttrs values
then f (attrPath ++ [n]) values
else last values
);
in
f [] attrList;
swaylocker = pkgs.writeShellScript "swaylocker" ''
swaylock \
--screenshots \
--clock \
--indicator \
--indicator-radius 100 \
--indicator-thickness 7 \
--effect-blur 7x5 \
--effect-vignette 0.5:0.5 \
--ring-color f5c2e7 \
--key-hl-color 1e1e2e \
--line-color 00000000 \
--inside-color 00000088 \
--separator-color 00000000 \
--text-color cdd6f4
'';
commonConfig = {wayland ? false}: rec { commonConfig = {wayland ? false}: rec {
modifier = "Mod4"; modifier = "Mod4";
focus.wrapping = "no"; focus.wrapping = "no";
@ -20,11 +53,15 @@
else true; else true;
startup = [ startup = [
{ {
command = "${lib.getExe pkgs.autotiling} -l2"; command = "autotiling -l2";
always = true; always = true;
} }
{ {
command = "${lib.getExe pkgs._1password-gui} --silent"; command = "1password --silent";
}
{
command = "swaync";
always = true;
} }
]; ];
workspaceAutoBackAndForth = true; workspaceAutoBackAndForth = true;
@ -161,7 +198,7 @@
"power: (l)ock, (e)xit, (r)eboot, (s)uspend, (h)ibernate, (S)hut off" = let "power: (l)ock, (e)xit, (r)eboot, (s)uspend, (h)ibernate, (S)hut off" = let
lock = lock =
if wayland if wayland
then "swaylock" then swaylocker
else "i3lock"; else "i3lock";
msg = msg =
if wayland if wayland
@ -190,47 +227,48 @@
inherit fonts; inherit fonts;
bars = [ bars = [
{ {
mode = "hide";
position = "top"; position = "top";
trayOutput = "none";
statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs ~/.config/i3status-rust/config-top.toml";
workspaceNumbers = false; workspaceNumbers = false;
inherit fonts; inherit fonts;
colors = { colors = {
background = "#000000"; background = "#1e1e2e";
focusedWorkspace = { focusedWorkspace = {
background = "#F5C2E7"; background = "#F5C2E7";
text = "#000000"; text = "#11111b";
border = "#F5C2E7"; border = "#F5C2E7";
}; };
activeWorkspace = { activeWorkspace = {
background = "#CBA6F7"; background = "#CBA6F7";
text = "#000000"; text = "#11111b";
border = "#CBA6F7"; border = "#CBA6F7";
}; };
inactiveWorkspace = { inactiveWorkspace = {
background = "#000000"; background = "#11111b";
text = "#CDD6F4"; text = "#CDD6F4";
border = "#000000"; border = "#11111b";
}; };
}; };
} }
]; ];
colors = rec { colors = rec {
focused = { focused = {
background = "#000000"; background = "#1e1e2e";
border = "#F5C2E7"; border = "#F5C2E7";
childBorder = "#F5C2E7"; childBorder = "#F5C2E7";
text = "#CDD6F4"; text = "#CDD6F4";
indicator = "#F5C2E7"; indicator = "#F5C2E7";
}; };
urgent = { urgent = {
background = "#000000"; background = "#1e1e2e";
border = "#F38BA8"; border = "#F38BA8";
childBorder = "#F38BA8"; childBorder = "#F38BA8";
text = "#CDD6F4"; text = "#CDD6F4";
indicator = "#F38BA8"; indicator = "#F38BA8";
}; };
unfocused = { unfocused = {
background = "#000000"; background = "#1e1e2e";
border = "#CBA6F7"; border = "#CBA6F7";
childBorder = "#CBA6F7"; childBorder = "#CBA6F7";
text = "#CDD6F4"; text = "#CDD6F4";
@ -331,10 +369,13 @@ in {
home = lib.mkIf isLinux { home = lib.mkIf isLinux {
packages = with pkgs; [ packages = with pkgs; [
arandr arandr
autotiling
blueberry blueberry
flameshot flameshot
libnotify
pavucontrol pavucontrol
sway-contrib.grimshot sway-contrib.grimshot
swaynotificationcenter
xclip xclip
]; ];
pointerCursor = { pointerCursor = {
@ -346,6 +387,64 @@ in {
}; };
}; };
programs.i3status-rust = lib.mkIf isLinux {
enable = true;
bars.top = {
blocks = [
{
block = "vpn";
driver = "mullvad";
format_connected = "󰍁 ";
format_disconnected = "󰍀 ";
state_connected = "good";
state_disconnected = "critical";
}
{
block = "tea_timer";
done_cmd = "notify-send 'Timer Finished'";
}
{
block = "time";
interval = 60;
format = " $timestamp.datetime(f:'%d/%m %R') ";
}
{
block = "notify";
format = " $icon {($notification_count.eng(w:1)) |}";
driver = "swaync";
click = [
{
button = "left";
action = "show";
}
{
button = "right";
action = "toggle_paused";
}
];
}
];
settings = {
icons.icons = "material-nf";
theme.overrides = {
idle_fg = "#cdd6f4";
idle_bg = "#00000000";
info_fg = "#89b4fa";
info_bg = "#00000000";
good_fg = "#a6e3a1";
good_bg = "#00000000";
warning_fg = "#fab387";
warning_bg = "#00000000";
critical_fg = "#f38ba8";
critical_bg = "#00000000";
separator = " ";
separator_bg = "auto";
separator_fg = "auto";
};
};
};
};
xresources = lib.mkIf isLinux { xresources = lib.mkIf isLinux {
properties = { properties = {
"Xft.dpi" = 192; "Xft.dpi" = 192;
@ -367,7 +466,6 @@ in {
useGeoclue = false; useGeoclue = false;
}; };
}; };
dunst.enable = true;
gnome-keyring = { gnome-keyring = {
enable = true; enable = true;
components = ["secrets"]; components = ["secrets"];
@ -404,11 +502,6 @@ in {
]; ];
}; };
}; };
screen-locker = {
enable = false;
inactiveInterval = 5;
lockCmd = "${lib.getExe pkgs.i3lock} -n -c 000000";
};
udiskie.enable = true; udiskie.enable = true;
}; };
@ -426,43 +519,53 @@ in {
scriptPath = "${config.xdg.cacheHome}/X11/xsession"; scriptPath = "${config.xdg.cacheHome}/X11/xsession";
windowManager.i3 = { windowManager.i3 = {
enable = true; enable = true;
config = config = recursiveMerge [
commonConfig {wayland = false;} (commonConfig {wayland = false;})
// { {
startup = [ startup = [
{ {
command = "${lib.getExe pkgs.flameshot}"; command = "${lib.getExe pkgs.flameshot}";
} }
{ {
command = "${lib.getExe pkgs.feh} --bg-fill ${flakePath}/home/wallpapers/dhm_1610.png"; command = "${lib.getExe pkgs.feh} --bg-fill ${flakePath}/home/wallpapers/dhm_1610.png --no-fehbg";
always = true; always = true;
} }
]; ];
}; }
extraConfig = commonExtraConfig; ];
extraConfig = ''
set_from_resource $dpi Xft.dpi 192
${commonExtraConfig}
'';
}; };
}; };
wayland.windowManager.sway = lib.mkIf isLinux { wayland.windowManager.sway = lib.mkIf isLinux {
enable = true; enable = true;
config = config = recursiveMerge [
commonConfig {wayland = true;} (commonConfig {wayland = true;})
// { {
input."type:keyboard" = { input."type:keyboard".xkb_options = "ctrl:nocaps";
xkb_options = "ctrl:nocaps"; output."*" = {
}; scale = "2";
output = { bg = "${flakePath}/home/wallpapers/dhm_1610.png fill #171320";
"*" = {
scale = "2";
bg = "${flakePath}/home/wallpapers/dhm_1610.png fill #171320";
};
}; };
startup = [ startup = [
{ {
command = "wl-paste -t text --watch clipman store"; command = "wl-paste -t text --watch clipman store";
} }
{
command = ''
swayidle -w \
timeout 180 ${swaylocker} \
timeout 240 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep ${swaylocker}
'';
}
]; ];
}; }
];
extraConfig = '' extraConfig = ''
${commonExtraConfig} ${commonExtraConfig}
shadows enable shadows enable

View file

@ -29,7 +29,15 @@
swaylock-effects swaylock-effects
swayidle swayidle
]; ];
wrapperFeatures = {
base = true;
gtk = true;
};
}; };
# needed for gnome3 pinentry
services.dbus.packages = [pkgs.gcr];
xdg.portal.enable = true;
xdg.portal.wlr.enable = true;
services = { services = {
# mounting # mounting
@ -80,11 +88,6 @@
}; };
}; };
# needed for gnome3 pinentry
services.dbus.packages = [pkgs.gcr];
xdg.portal.enable = true;
xdg.portal.wlr.enable = true;
security.polkit.enable = true; security.polkit.enable = true;
systemd = { systemd = {
packages = [pkgs.polkit_gnome]; packages = [pkgs.polkit_gnome];