Put sway in home-manager

This commit is contained in:
Artemis Tosini 2021-08-26 17:12:58 +00:00
parent 0f03e82c6d
commit fa2011b8ae
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
7 changed files with 136 additions and 16 deletions

3
.gitmodules vendored
View file

@ -7,3 +7,6 @@
[submodule "externals/home-manager"]
path = externals/home-manager
url = https://github.com/nix-community/home-manager
[submodule "externals/packages/rustybar"]
path = externals/packages/rustybar
url = https://github.com/mildlyfunctionalgays/rustybar

1
externals/packages/rustybar vendored Submodule

@ -0,0 +1 @@
Subproject commit 3f69c3d2eb046be51dd4021bf730779500b8d330

BIN
home/files/sicily.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 KiB

103
home/sway.nix Normal file
View file

@ -0,0 +1,103 @@
{ pkgs, lib, config, ... }:
let
rustybar = pkgs.callPackage ../externals/packages/rustybar { };
cfg = config.wayland.windowManager.sway;
mod = cfg.config.modifier;
extraWorkspaces = {
F1 = "11 Firefox";
F2 = "12 Music";
F3 = "13";
F4 = "14";
F5 = "15";
F6 = "16 Telegram";
F7 = "17 Chat";
F8 = "18 Signal";
F9 = "19";
F10 = "20 IRC";
F11 = "21";
F12 = "22";
};
extraGotoBindings = lib.mapAttrs'
(name: value: {
name = "${mod}+${name}";
value = "workspace ${value}";
})
extraWorkspaces;
extraMoveBindings = lib.mapAttrs'
(name: value: {
name = "${mod}+Shift+${name}";
value = "move container to workspace ${value}";
})
extraWorkspaces;
in
{
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true;
extraSessionCommands = ''
export MOZ_USE_XINPUT2=1
export _JAVA_AWT_WM_NONREPARENTING=1
export GTK_THEME=Adwaita-dark
'';
config = {
modifier = "Mod4";
terminal = "alacritty";
menu = "wofi -i -S run";
fonts = {
names = [ "Fira Code" ];
size = 8.0;
};
gaps.inner = 4;
input."*" = {
natural_scroll = "yes";
xkb_options = "compose:caps";
};
output."*".bg = "${./files/sicily.jpg} fill";
startup = [
{ command = "mako"; }
{ command = "dbus-update-activation-environment --systemd --all"; always = true; }
{ command = "swayidle -w before-sleep 'swaylock -f' timeout 600 'swaylock -f' timeout 1200 'swaymsg \"output * dpms off\"' resume 'swaymsg \"output * dpms on\"'"; }
];
# I have to set these to something and can't set them to existing uses
left = "Mod1+Left";
down = "Mod1+Down";
up = "Mod1+Up";
right = "Mod1+Right";
keybindings = lib.mkOptionDefault
({
"${mod}+Shift+d" = "exec wofi -I -i -S drun";
"${mod}+j" = "move workspace to left";
"${mod}+k" = "move workspace to right";
"${mod}+l" = "exec swaylock";
# Sink 0 means the default AIUI
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume 0 +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume 0 -5%";
"XF86AudioMute" = "exec pactl set-sink-mute 0 toggle";
"XF86MonBrightnessUp" = "exec light -A 5";
"XF86MonBrightnessDown" = "exec light -U 5";
"Print" = "exec grim \"$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')\"";
"Shift+Print" = "exec grim -g \"$(slurp)\" \"$(xdg-user-dir PICTURES)/Screenshot/$(date +'%F %H-%M-%S-%N_screenshot.png')\"";
} // extraGotoBindings // extraMoveBindings);
floating.titlebar = true;
window.titlebar = true;
bars = [{
statusCommand = "${rustybar}/bin/rustybar";
position = "top";
fonts = cfg.config.fonts;
colors = {
background = "#000000d0";
statusline = "#ffffff";
separator = "#aaaaaa";
inactiveWorkspace = { border = "#000000d0"; background = "#323232d0"; text = "#ffffffd0"; };
};
}];
};
};
}

View file

@ -148,7 +148,7 @@ in
efibootmgr
efitools
sbsigntool
# Wine and tools
cabextract
samba

View file

@ -15,15 +15,6 @@
];
};
sound.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
extraSessionCommands = ''
export MOZ_USE_XINPUT2=1
export _JAVA_AWT_WM_NONREPARENTING=1
export GTK_THEME=Adwaita-dark
'';
};
environment.systemPackages = with pkgs; [
dex
glib
@ -40,5 +31,13 @@
xdg-user-dirs
xdg_utils
xsettingsd
swaylock
swayidle
];
hardware.opengl.enable = true;
security.pam.services.swaylock = { };
programs.dconf.enable = true;
programs.xwayland.enable = true;
home-manager.users.artemis.imports = [ ../home/sway.nix ];
}

View file

@ -62,10 +62,6 @@
};
# Packages
services.tor = {
enable = true;
client.enable = true;
};
boot.binfmt.emulatedSystems = [ "aarch64-linux" "riscv64-linux" ];
environment.systemPackages = with pkgs; [
(weechat.override {
@ -81,8 +77,26 @@
hardware.opengl.extraPackages = with pkgs; [ vulkan-validation-layers ];
# Home
home-manager.users.artemis.programs.mpv.defaultProfiles = [ "gpu-hq" ];
home-manager.users.artemis = {
programs.mpv.defaultProfiles = [ "gpu-hq" ];
wayland.windowManager.sway.config.output = {
"DP-1" = {pos = "0 0"; mode = "3840x2160@59.997Hz"; scale = "2"; };
"DP-2" = {pos = "1920 0"; mode = "3840x2160@59.997Hz"; scale = "2"; };
"HDMI-A-1" = {pos = "3840 0"; mode = "3840x2160@60Hz"; scale = "2"; };
};
# no toTOML generator so I guess we have to do this
xdg.configFile."rustybar/config.toml".text = ''
[[tile]]
type = "load"
[[tile]]
type = "memory"
[[tile]]
type = "hostname"
[[tile]]
type = "time"
format = "%Y-%m-%dT%H:%M:%S"
'';
};
# NixOS
system.stateVersion = "19.09";
}