add inital sway

This commit is contained in:
Kabbone 2022-10-31 10:05:30 +01:00
parent f78ab0cd54
commit 636fd1257e
3 changed files with 206 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,65 @@
#
# Sway configuration
#
# flake.nix
# ├─ ./hosts
# │ └─ ./laptop
# │ └─ default.nix
# └─ ./modules
# └─ ./desktop
# └─ ./hyprland
# └─ hyprland.nix *
#
{ config, lib, user, pkgs, ... }:
{
imports = [ ../../programs/waybar.nix ];
hardware.opengl = {
enable = true;
};
environment = {
loginShellInit = ''
if [ -z $DISPLAY ] && [ $UID != 0 ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway
fi
''; # Will automatically open sway when logged into tty1
systemPackages = with pkgs; [
xdg-desktop-portal-wlr
swaylock
swayidle
slurp
grim
bemenu
];
};
programs = {
sway.enable = true;
extraSessionCommands = ''
export MOZ_ENABLE_WAYLAND = "1";
export MOZ_WEBRENDER = "1";
export MOZ_USE_XINPUT2 = "2";
export MOZ_DBUS_REMOTE = "1";
#export GDK_BACKEND = "wayland";
export LIBVA_DRIVER_NAME = "iHD";
export VDPAU_DRIVER = "iHD";
export XDG_SESSION_TYPE = "wayland";
export XDG_CURRENT_DESKTOP = "Unity";
#export QT_QPA_PLATFORMTHEME = "wayland-egl";
export GST_VAAPI_ALL_DRIVERS = "1";
export GTK_THEME = "Arc";
export _JAVA_AWT_WM_NONREPARENTING = "1";
#export LIBCL_ALWAYS_SOFTWARE = "1"; # For applications in VM like alacritty to work
#export WLR_NO_HARDWARE_CURSORS = "1"; # For cursor in VM
'';
security.pam.services.swaylock = {};
xdg.portal = { # Required for flatpak with windowmanagers
#enable = true;
wlr.enable = true;
};
}

View File

@ -0,0 +1,141 @@
#
# Hyprland NixOS & Home manager configuration
#
# flake.nix
# ├─ ./hosts
# │ └─ ./laptop
# │ └─ home.nix
# └─ ./modules
# └─ ./desktop
# └─ ./hyprland
# └─ home.nix *
#
{ config, lib, pkgs, ... }:
{
home.file = { ".config/sway/2in1screen".source = ../modules/desktop/scripts/2in1screen };
wayland.windowManager.sway = {
config = {
menu = 'bemenu-run --no-exec -m -1 --hf "#ffff00" --tf "#888888" --nf "#00ff40" --hb "#424242" | xargs swaymsg exec --';
left = h;
down = n;
up = e;
right = i;
modifier = Mod4;
input = {
* = {
xkb_layout = "us";
xkb_variant = "altgr-intl";
};
"2321:21128:HTIX5288:00_0911:5288_Touchpad" {
tap enabled
natural_scroll disabled
drag enabled
dwt enabled
middle_emulation enabled
scroll_method two_finger
tap_button_map lmr
drag enabled
};
};
output = {
* = { bg = "$HOME/.config/wall"; };
eDP-1 = {
resolution = 1920x1080 position 4480,0;
subpixel = none;
scale = 1.3;
};
DP-1 = {
resolution = 1920x1080 position 0,0;
};
HDMI-A-1 = {
resolution = 2560x1080 position 1920,0;
};
};
terminal = "alacritty";
startup = [
{ command = "${HOME}/.config/sway/scripts/2in1screen"; }
{ command = "xrdb -load ~/.Xresources"
{ command = "gsettings set org.gnome.desktop.interface gtk-theme Arc"
{ command = "gsettings set org.gnome.desktop.interface icon-theme ePapirus"
{ command = "gsettings set org.gnome.desktop.interface cursor-theme Adwaita"
{ command = "${pkgs.thunderbird}/bin/thunderbird";
{ command = "${pkgs.firefox}/bin/firefox";
{ command = "${pkgs.element}/bin/element";
];
workspaceAutoBackAndForth = true;
extraSessionCommands = ''
export MOZ_ENABLE_WAYLAND = "1";
export MOZ_WEBRENDER = "1";
export MOZ_USE_XINPUT2 = "2";
export MOZ_DBUS_REMOTE = "1";
#export GDK_BACKEND = "wayland";
export LIBVA_DRIVER_NAME = "iHD";
export VDPAU_DRIVER = "iHD";
export XDG_SESSION_TYPE = "wayland";
export XDG_CURRENT_DESKTOP = "Unity";
#export QT_QPA_PLATFORMTHEME = "wayland-egl";
export GST_VAAPI_ALL_DRIVERS = "1";
export GTK_THEME = "Arc";
export _JAVA_AWT_WM_NONREPARENTING = "1";
#export LIBCL_ALWAYS_SOFTWARE = "1"; # For applications in VM like alacritty to work
#export WLR_NO_HARDWARE_CURSORS = "1"; # For cursor in VM
'';
gaps.inner = 8;
gaps.outer = 4;
assigns = {
"3: web" = [{ class = "^Firefox$"; }];
"2: mail" = [{ class = "^Thunderbird$"; }];
"4: im" = [{ class = "^Element$"; }];
};
window.commands = [
{ command = "floating enable"; criteria = { class = "Pavucontrol" }; }
{ command = "floating enable"; criteria = { class = "Galculator" }; }
{ command = "floating enable"; criteria = { class = "yubioath-desktop" }; }
{ command = "floating enable"; criteria = { window_role = "pop-up" }; }
];
bars.*.command = "${pkgs.waybar}/bin/waybar";
defaultWorkspace = "workspace number 3";
keybindings = {
XF86AudioMute = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
};
};
systemdIntegration = true;
wrapperFeatures.gtk = true;
};
programs.swaylock.settings = {
color = "000000";
image = "$HOME/.config/lockwall";
indicator-caps-lock = true;
show-keyboard-layout = true;
};
services.swayidle = {
enable = false;
events = [
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; }
{ event = "lock"; command = "${pkgs.swaylock}/bin/swaylock -fF"; }
{ event = "after-resume"; command = "${pkgs.sway}/bin/swaymsg output * dpms on"; }
];
timeouts = [
{ timeout = 300; command = "${pkgs.swaylock}/bin/swaylock -fF"; }
{ timeout = 600; command = "${pkgs.sway}/bin/swaymsg output * dpms off"; }
];
};
}