From 636fd1257ed4ef66ab6c03c73a4ac1235dfd5a23 Mon Sep 17 00:00:00 2001 From: Kabbone Date: Mon, 31 Oct 2022 10:05:30 +0100 Subject: [PATCH] add inital sway --- modules/desktop/scripts/2in1screen | Bin 0 -> 17912 bytes modules/desktop/sway/default.nix | 65 +++++++++++++ modules/desktop/sway/home.nix | 141 +++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100755 modules/desktop/scripts/2in1screen create mode 100644 modules/desktop/sway/default.nix create mode 100644 modules/desktop/sway/home.nix diff --git a/modules/desktop/scripts/2in1screen b/modules/desktop/scripts/2in1screen new file mode 100755 index 0000000000000000000000000000000000000000..cbc5046549f332776bd8b40565cec13e89b34b60 GIT binary patch literal 17912 zcmeHPe{fvYb-vPCw(yUY>|m@Kh+iGt3W`@+*>WTig}1h3uNoP-w(O9^@VwexN!v)f z%I=dbc{+`WZN^(8Vn{+}U^;OUrg)k_nP!G@-P9E}b={Iljho4sGARlruu2Fh20RJ{ zw%@t;p4EF#yZqD4w14c?>^t{-_ndRjJNMpq-;aCs<<9P{l@%3&lTUnF5I40#A*L=k z{b`*6F-415g5%BNCb1Cw0*R?|QxTM^G+61T)f)GKlHMs@?xi=dQ7LtAta_8Pl^fsp40L4(hgEWVoI`{sZZR9T)xDVrD2F9}$)n9gA4~iDYCbaS)1edw<_(KVb62%Gi;#Z4E~fNwKZF zYx5SXDbN&X7FJj9b_+Gc2NI|t-Mf9uP%0Vkjr0x0p*b*|N@`6@i53;4^RArt=f;?; zz(}fqJdgX))d^hbD#c@D1c|SQ9LGx^Q}~R&-Z6ei4rMpYq^GwVj*?e@Npq9{i-nXFd3n8W*1a^gWGNd+;+Ful3+(HD2ez&uRS1okAwM zrd6n{JWe@qjwu!795`LOIL$b4=eU`5;B*b<#N&kKT)KX8sxwt?5s19F>H@=o({-6s zy{U2}&vOqUjV2w1AY9Jtk`toER2jmZ^ONbosf<(DR5`+UDkfxyNk?UWvC7Kh-KJtl zeyPgJ<33X{gfCN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q5#*RqU*rb(+~&51xmDzDG&iI)sbR=>wKYs^ z>FL?Yd(qtD-W_CCER(VZaW1sGtg8q5F?`b+g=g#w#hKb!ZGv-KOQ#SH`q&nQi2`e@sich-5IcK%dE=g2KyATuW0r;ebGkQ5 zXXE(nDZd`dZFWWX&Z&rw3Au;QYtFf$&t0ar1-da2$czu$kv>p#I!OmPhnXHWAZMXmi(kJ2D_-*JZ9>MW zpVNkz8Z4-(SHA=JHM~RM`uX{gDc8^Um4)lRws#jO?n(>(^K&HAT5XtKS5TZ-pWlD% z0fwoipwG{nO!>VHL}Vfx&U7yrdPlOTmKs?e{4=;lc!P5J$rM)`J` zS&>D~sc&dKrrr+gF)zOE)z|lDe4nVV=+L`A*5~&QGgxO&iRBbG$1{Ef1=M#~pPyg(|3*w{|G9s$9>?+L&?OPp z=l2*_^aDUW%AASynZAZXr@kUmwQEn$o(>l;oGdGeK#lNS1}Dw0Q2*MC}{D2-!kQa*3K me$xA7_FXFK!)&X{{Jp1;>t$IQt{xFt^n-RK;qxeXSn)rwO?X5A literal 0 HcmV?d00001 diff --git a/modules/desktop/sway/default.nix b/modules/desktop/sway/default.nix new file mode 100644 index 0000000..d9e3dca --- /dev/null +++ b/modules/desktop/sway/default.nix @@ -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; + }; +} diff --git a/modules/desktop/sway/home.nix b/modules/desktop/sway/home.nix new file mode 100644 index 0000000..0fdc0aa --- /dev/null +++ b/modules/desktop/sway/home.nix @@ -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"; } + ]; + }; +}