mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
flatpak: patch electrons under wayland
This commit is contained in:
parent
1e55d81961
commit
735935627d
9 changed files with 103 additions and 30 deletions
24
nixcfgs/modules/home/darwin.nix
Normal file
24
nixcfgs/modules/home/darwin.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.sessionPath = ["/opt/homebrew/bin"];
|
||||||
|
|
||||||
|
programs.nh = {
|
||||||
|
enable = true;
|
||||||
|
flake = "/Users/js0ny/.dotfiles/nixcfgs";
|
||||||
|
clean = {
|
||||||
|
enable = true;
|
||||||
|
dates = "weekly";
|
||||||
|
extraArgs = "--keep 5 --keep-since 3d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.desktopEntries = lib.mkForce {};
|
||||||
|
|
||||||
|
i18n.inputMethod.enable = false;
|
||||||
|
|
||||||
|
programs.ghostty.systemd.enable = false;
|
||||||
|
programs.ghostty.package = pkgs.ghostty-bin;
|
||||||
|
}
|
||||||
|
|
@ -6,5 +6,6 @@
|
||||||
zsh-autoenv.enable = true;
|
zsh-autoenv.enable = true;
|
||||||
autosuggestions.enable = true;
|
autosuggestions.enable = true;
|
||||||
};
|
};
|
||||||
|
catppuccin.zsh-syntax-highlighting.enable = false;
|
||||||
environment.pathsToLink = ["/share/zsh"];
|
environment.pathsToLink = ["/share/zsh"];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,30 @@
|
||||||
# https://github.com/gmodena/nix-flatpak
|
# https://github.com/gmodena/nix-flatpak
|
||||||
{...}: {
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
electronApps = [
|
||||||
|
"com.getpostman.Postman"
|
||||||
|
# "com.ticktick.TickTick"
|
||||||
|
];
|
||||||
|
|
||||||
|
waylandFlags = "\${NIXOS_OZONE_WL:+\${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}";
|
||||||
|
|
||||||
|
appWrappers = lib.listToAttrs (map (appid: {
|
||||||
|
name = "flatpak/exports/bin/${appid}";
|
||||||
|
value = {
|
||||||
|
text = ''
|
||||||
|
#!/bin/sh
|
||||||
|
exec flatpak run ${appid} ${waylandFlags} "$@"
|
||||||
|
'';
|
||||||
|
executable = true;
|
||||||
|
force = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
electronApps);
|
||||||
|
in {
|
||||||
services.flatpak.enable = true;
|
services.flatpak.enable = true;
|
||||||
services.flatpak.remotes = [
|
services.flatpak.remotes = [
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +48,7 @@
|
||||||
# "com.vivaldi.Vivaldi"
|
# "com.vivaldi.Vivaldi"
|
||||||
"com.getpostman.Postman"
|
"com.getpostman.Postman"
|
||||||
"us.zoom.Zoom"
|
"us.zoom.Zoom"
|
||||||
"com.ticktick.TickTick"
|
# "com.ticktick.TickTick" # cannot run on wayland under flatpak
|
||||||
];
|
];
|
||||||
services.flatpak.overrides = {
|
services.flatpak.overrides = {
|
||||||
global = {
|
global = {
|
||||||
|
|
@ -50,8 +75,18 @@
|
||||||
"md.obsidian.Obsidian".Context.sockets = ["wayland"];
|
"md.obsidian.Obsidian".Context.sockets = ["wayland"];
|
||||||
"com.ticktick.Ticktick".Context.sockets = ["wayland"];
|
"com.ticktick.Ticktick".Context.sockets = ["wayland"];
|
||||||
"com.getpostman.Postman".Context = {
|
"com.getpostman.Postman".Context = {
|
||||||
persistent = ["Postman"];
|
persistent = ["Postman"]; # Don't create `~/Postman` folder under home
|
||||||
sockets = ["wayland"];
|
sockets = ["wayland"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
xdg.dataFile = appWrappers;
|
||||||
|
home.activation.patchFlatpakDesktopFiles = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
|
${lib.concatMapStringsSep "\n" (appid: ''
|
||||||
|
DESKTOP_FILE="${config.xdg.dataHome}/flatpak/exports/share/applications/${appid}.desktop"
|
||||||
|
if [ -f "$DESKTOP_FILE" ]; then
|
||||||
|
$DRY_RUN_CMD ${pkgs.gnused}/bin/sed -i "s|^\(Exec=.*${appid}\)|\\1 ${waylandFlags}|g" "$DESKTOP_FILE"
|
||||||
|
fi
|
||||||
|
'')
|
||||||
|
electronApps}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
# FIXME: This will block the desktop files
|
||||||
mkFcitxIM = builtins.map (
|
mkFcitxIM = builtins.map (
|
||||||
p:
|
p:
|
||||||
lib.hiPrio (
|
lib.hiPrio (
|
||||||
|
|
@ -16,6 +17,30 @@
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
# Wrap Electron apps to use Wayland when NIXOS_OZONE_WL is set
|
||||||
|
# This only works for apps that does not patched by upstream
|
||||||
|
mkElectronWayland = builtins.map (
|
||||||
|
p:
|
||||||
|
lib.hiPrio (
|
||||||
|
pkgs.runCommand "${p.name}-wrapped"
|
||||||
|
{
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
meta = p.meta;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
# ln -s ${p}/share $out/share
|
||||||
|
makeWrapper ${lib.getExe p} $out/bin/${p.meta.mainProgram or p.pname} \
|
||||||
|
--inherit-argv0 \
|
||||||
|
--run '
|
||||||
|
if [ -n "$NIXOS_OZONE_WL" ] && [ -n "$WAYLAND_DISPLAY" ]; then
|
||||||
|
NIX_WAYLAND_FLAGS="--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true"
|
||||||
|
fi
|
||||||
|
' \
|
||||||
|
--add-flags "\$NIX_WAYLAND_FLAGS"
|
||||||
|
''
|
||||||
|
)
|
||||||
|
);
|
||||||
in {
|
in {
|
||||||
home.packages = with pkgs;
|
home.packages = with pkgs;
|
||||||
[
|
[
|
||||||
|
|
@ -81,12 +106,15 @@ in {
|
||||||
cider-2
|
cider-2
|
||||||
kicad
|
kicad
|
||||||
blender
|
blender
|
||||||
qmk
|
|
||||||
logisim-evolution
|
logisim-evolution
|
||||||
|
onlyoffice-desktopeditors
|
||||||
]
|
]
|
||||||
++ (mkFcitxIM [
|
++ (mkFcitxIM [
|
||||||
pkgs.neovim-qt
|
pkgs.neovim-qt
|
||||||
pkgs.anki
|
pkgs.anki
|
||||||
|
])
|
||||||
|
++ (mkElectronWayland [
|
||||||
|
pkgs.ticktick
|
||||||
]);
|
]);
|
||||||
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,16 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
style = ''
|
style = ''
|
||||||
* {
|
* {
|
||||||
/* `otf-font-awesome` is required to be installed for icons */
|
|
||||||
font-family: "Font Awesome 7 Free", "JetBrainsMono Nerd Font";
|
font-family: "Font Awesome 7 Free", "JetBrainsMono Nerd Font";
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-feature-settings: "tnum";
|
font-feature-settings: "tnum";
|
||||||
}
|
}
|
||||||
#workspaces button:hover {
|
#workspaces button:hover {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: @pink;
|
||||||
}
|
|
||||||
|
|
||||||
#workspaces button.focused {
|
|
||||||
background-color: #64727D;
|
|
||||||
box-shadow: inset 0 -3px #ffffff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button.urgent {
|
#workspaces button.urgent {
|
||||||
background-color: #eb4d4b;
|
background-color: @red;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,11 @@
|
||||||
dirvish
|
dirvish
|
||||||
nix-ts-mode
|
nix-ts-mode
|
||||||
flycheck
|
flycheck
|
||||||
|
highlight-indent-guides
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
# TODO: tdlib version is too high
|
||||||
|
# See: https://github.com/zevlg/telega.el/issues/374
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
tdlib
|
tdlib
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ in {
|
||||||
patterns = {
|
patterns = {
|
||||||
"rm -rf *" = "fg=blue,bold,bg=red";
|
"rm -rf *" = "fg=blue,bold,bg=red";
|
||||||
};
|
};
|
||||||
styles = {
|
|
||||||
path = "fg=cyan,underline";
|
|
||||||
};
|
|
||||||
highlighters = [
|
highlighters = [
|
||||||
"main"
|
"main"
|
||||||
"pattern"
|
"pattern"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{lib, ...}: {
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./default.nix
|
./default.nix
|
||||||
|
|
||||||
|
|
@ -26,6 +26,9 @@
|
||||||
./programs/neovide.nix
|
./programs/neovide.nix
|
||||||
./programs/ghostty.nix
|
./programs/ghostty.nix
|
||||||
|
|
||||||
|
../../modules/home/do-not-track.nix
|
||||||
|
../../modules/home/darwin.nix
|
||||||
|
|
||||||
../../modules/home/programs/lsd.nix
|
../../modules/home/programs/lsd.nix
|
||||||
../../modules/home/programs/starship.nix
|
../../modules/home/programs/starship.nix
|
||||||
../../modules/home/programs/zoxide.nix
|
../../modules/home/programs/zoxide.nix
|
||||||
|
|
@ -33,19 +36,5 @@
|
||||||
../../modules/home/dev/nix.nix
|
../../modules/home/dev/nix.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.sessionPath = ["/opt/homebrew/bin"];
|
|
||||||
|
|
||||||
programs.nh = {
|
|
||||||
enable = true;
|
|
||||||
flake = "/Users/js0ny/.dotfiles/nixcfgs";
|
|
||||||
clean = {
|
|
||||||
enable = true;
|
|
||||||
dates = "weekly";
|
|
||||||
extraArgs = "--keep 5 --keep-since 3d";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.desktopEntries = lib.mkForce {};
|
|
||||||
|
|
||||||
home.stateVersion = "25.05";
|
home.stateVersion = "25.05";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@
|
||||||
./programs/desktop/wayland-wm/niri
|
./programs/desktop/wayland-wm/niri
|
||||||
./programs/desktop/wayland-wm/hyprland.nix
|
./programs/desktop/wayland-wm/hyprland.nix
|
||||||
|
|
||||||
|
../../modules/home/do-not-track.nix
|
||||||
|
|
||||||
# General Program config
|
# General Program config
|
||||||
../../modules/home/programs/eza.nix
|
../../modules/home/programs/eza.nix
|
||||||
# ../../modules/home/programs/winboat.nix
|
# ../../modules/home/programs/winboat.nix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue