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

View file

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

View file

@ -28,16 +28,26 @@
udisks2.enable = true; udisks2.enable = true;
devmon.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; enable = true;
settings = { settings = {
default_session = let default_session = {
swaycmd = pkgs.writeShellScript "swaycmd" '' command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time -r --cmd ${sway-run}";
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}";
user = "greeter"; user = "greeter";
}; };
}; };
@ -50,7 +60,6 @@
kanata = { kanata = {
enable = true; enable = true;
package = pkgs.kanata;
keyboards.keychron-k6 = { keyboards.keychron-k6 = {
devices = ["/dev/input/by-id/usb-Keychron_Keychron_K6-event-kbd"]; devices = ["/dev/input/by-id/usb-Keychron_Keychron_K6-event-kbd"];
config = '' config = ''