feat: handle wayland sessions better

This commit is contained in:
winston 2023-05-17 13:25:59 +02:00
parent 564d5ed810
commit 430319efea
Signed by: winston
GPG key ID: 3786770EDBC2B481
3 changed files with 30 additions and 25 deletions

View file

@ -1,5 +1,5 @@
{pkgs, ...}: let
inherit (pkgs.stdenv.hostPlatform) isLinux;
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
in {
programs.chromium = {
enable = isLinux;
@ -15,10 +15,7 @@ in {
enable = true;
# since I'm using firefox from brew on darwin, I need to build a dummy package
# to still manage it via home-manager
package =
if isLinux
then pkgs.firefox-wayland
else (pkgs.writeScriptBin "__dummy-firefox" "");
package = pkgs.lib.mkIf isDarwin (pkgs.writeScriptBin "__dummy-firefox" "");
profiles.default = {
search.default = "DuckDuckGo";
search.force = true;

View file

@ -28,8 +28,8 @@
}
];
workspaceAutoBackAndForth = true;
terminal = "wezterm start --always-new-process";
menu = "";
terminal = "${lib.getExe config.programs.wezterm.package}";
menu = "${lib.getExe config.programs.rofi.package}";
defaultWorkspace = "$ws1";
keybindings = let
mod = modifier;
@ -38,7 +38,6 @@
hyper = "Mod4+Mod1+Shift+Ctrl";
gopass = lib.getExe pkgs.gopass;
rofi = lib.getExe config.programs.rofi.package;
thunar = lib.getExe pkgs.xfce.thunar;
xargs = "${lib.getExe pkgs.findutils}/bin/xargs";
xdotool = lib.getExe pkgs.xdotool;
@ -51,7 +50,7 @@
# TODO: replace xdotool with wayland equivalent
gopassRofi = pkgs.writeShellScript "gopass-rofi" ''
${gopass} ls --flat | \
${rofi} -dmenu -dpi $dpi | \
${menu} -dmenu -dpi $dpi | \
${xargs} --no-run-if-empty ${gopass} show -o | \
${xdotool} type --clearmodifiers --file -
'';
@ -142,7 +141,7 @@
"${modMove}+9" = "move container to workspace $ws9; workspace $ws9";
"${modMove}+0" = "move container to workspace $ws10; workspace $ws10";
# rofi instead of drun
"${mod}+space" = "exec --no-startup-id ${rofi} -show drun -dpi $dpi";
"${mod}+space" = "exec --no-startup-id ${menu} -show drun -dpi $dpi";
# 1password
"${mod}+Shift+space" = "exec ${lib.getExe pkgs._1password-gui} --quick-access";
@ -374,7 +373,7 @@ in {
components = ["secrets"];
};
picom = {
enable = false;
enable = true;
package = pkgs.nur.repos.nekowinston.picom-ft-labs;
fade = false;
backend = "glx";
@ -427,7 +426,6 @@ in {
scriptPath = "${config.xdg.cacheHome}/X11/xsession";
windowManager.i3 = {
enable = true;
package = pkgs.i3;
config =
commonConfig {wayland = false;}
// {
@ -435,12 +433,13 @@ in {
{
command = "${lib.getExe pkgs.flameshot}";
}
{
command = "${lib.getExe pkgs.feh} --bg-fill ${flakePath}/home/wallpapers/dhm_1610.png";
always = true;
}
];
};
extraConfig = ''
set_from_resource $dpi Xft.dpi 140
${commonExtraConfig}
'';
extraConfig = commonExtraConfig;
};
};

View file

@ -28,16 +28,26 @@
udisks2.enable = true;
devmon.enable = true;
greetd = {
greetd = let
sway-run = pkgs.writeShellScript "sway-run" ''
# session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
# wayland
export NIXOS_OZONE_WL=1
export MOZ_ENABLE_WAYLAND=1
export QT_QPA_PLATFORM=wayland
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
exec systemd-cat --identifier=sway sway $@
'';
in {
enable = true;
settings = {
default_session = let
swaycmd = pkgs.writeShellScript "swaycmd" ''
export NIXOS_OZONE_WL=1 XDG_CURRENT_DESKTOP=sway
${pkgs.sway}/bin/sway > /tmp/sway.log 2>&1
'';
in {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time -r --cmd ${swaycmd}";
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time -r --cmd ${sway-run}";
user = "greeter";
};
};
@ -50,7 +60,6 @@
kanata = {
enable = true;
package = pkgs.kanata;
keyboards.keychron-k6 = {
devices = ["/dev/input/by-id/usb-Keychron_Keychron_K6-event-kbd"];
config = ''