fix multi DPI scaling in x11 using xsession

This commit is contained in:
Ray Andrew 2024-11-16 23:58:28 -06:00
parent 074117be1e
commit ed15864d22
9 changed files with 66 additions and 19 deletions

View file

@ -2,6 +2,7 @@
lib,
pkgs,
config,
wallpaper,
...
}:
{
@ -117,7 +118,7 @@
toggle-stacking-global = [ "<Super>s" ];
};
"org/gnome/desktop/background" = {
picture-uri-dark = "file://${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.src}";
picture-uri-dark = "file://${wallpaper}";
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";

View file

@ -7,9 +7,9 @@
{
programs.bash.enable = true;
programs.bash.enableVteIntegration = true;
programs.bash.initExtra = lib.mkAfter ''
export NIX_LD=$(nix eval --impure --raw --expr 'let pkgs = import <nixpkgs> {}; NIX_LD = pkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; in NIX_LD')
'';
# programs.bash.initExtra = lib.mkAfter ''
# export NIX_LD=$(nix eval --impure --raw --expr 'let pkgs = import <nixpkgs> {}; NIX_LD = pkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; in NIX_LD')
# '';
programs.bash.bashrcExtra = lib.mkAfter ''
if [ "$term" != "dumb" ] || [ -n "$inside_emacs" ]; then
prompt_color="1;32m"

View file

@ -943,6 +943,19 @@ require("lazy").setup({
},
},
},
{
"ojroques/nvim-osc52",
event = "VimEnter",
config = function()
local copy = function()
if vim.v.event.operator == "y" and vim.v.event.regname == "+" then
require("osc52").copy_register("+")
end
end
vim.api.nvim_create_autocmd("TextYankPost", { callback = copy })
end,
},
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the

View file

@ -19,6 +19,7 @@
"multicursor.nvim": { "branch": "1.0", "commit": "b715cc5bf69cf6e338899510eb2b60b1dd7ccce0" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-lspconfig": { "branch": "master", "commit": "87c7c83ce62971e0bdb29bb32b8ad2b19c8f95d0" },
"nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" },
"nvim-treesitter": { "branch": "master", "commit": "20e10ca6914f65cf1410232433fb58de70ab6b39" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"oil.nvim": { "branch": "master", "commit": "8ea40b5506115b6d355e304dd9ee5089f7d78601" },

View file

@ -6,6 +6,9 @@ _: {
];
config = {
xsession.enable = true;
xsession = {
enable = true;
scriptPath = ".xsession-hm";
};
};
}

View file

@ -2,6 +2,7 @@
pkgs,
lib,
config,
wallpaper,
...
}:
let
@ -30,9 +31,11 @@ in
};
config = lib.mkIf config.custom.wm.i3.enable {
home.packages = with pkgs; [
arandr
feh
xfce.xfce4-volumed-pulse
autorandr
];
services.picom = {
enable = true;
@ -40,15 +43,15 @@ in
services.dunst = {
enable = true;
};
# xsession.profileExtra = ''
# export GDK_SCALE=2
# export GDK_DPI_SCALE=0.5
# export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2"
# export QT_AUTO_SCREEN_SCALE_FACTOR=1
# export QT_DEVICE_PIXEL_RATIO=2
# echo "Xft.dpi: 192" | xrdb -merge
# export XCURSOR_SIZE=64
# '';
xsession.initExtra = ''
export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2"
export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_DEVICE_PIXEL_RATIO=2
echo "Xft.dpi: 192" | xrdb -merge
export XCURSOR_SIZE=64
'';
xsession.windowManager.i3 = {
enable = true;
extraConfig = commonOptions.extraConfig;
@ -69,6 +72,23 @@ in
"${commonOptions.modifier}+Shift+o" = "exec --no-startup-id ${maim} -s | ${clipboard-copy} -selection clipboard -t image/png";
"PRINT" = "exec --no-startup-id ${maim} -s | ${clipboard-copy} -selection clipboard -t image/png";
};
startup = [
{
command = "autorandr -c";
always = false; # Important, run only on first start (will loop otherwise)!
notification = false;
}
{
command = "feh --bg-fill ${wallpaper}";
always = true;
notification = false;
}
{
command = "xfce4-volumed-pulse &";
always = false;
notification = false;
}
];
}
];
};

View file

@ -40,6 +40,7 @@ let
extraSpecialArgs = specialArgs // {
inherit host user;
dots = "/home/${user}/code/nix-config";
wallpaper = pkgs.nixos-artwork.wallpapers.nineish-dark-gray.src;
};
users.${user} = {

View file

@ -47,7 +47,7 @@
bluetooth.enable = true;
wm = {
i3.enable = true;
sway.enable = true;
sway.enable = false;
};
gnome = {
enable = true;

View file

@ -14,10 +14,18 @@
# '';
session = [
{
manage = "desktop";
name = "xsession";
manage = "window";
name = "hm";
start = ''
exec $HOME/.xsession
# export GDK_SCALE=2
# export GDK_DPI_SCALE=0.5
# export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2"
# export QT_AUTO_SCREEN_SCALE_FACTOR=1
# export QT_DEVICE_PIXEL_RATIO=2
# echo "Xft.dpi: 192" | xrdb -merge
# export XCURSOR_SIZE=64
${pkgs.stdenv.shell} $HOME/.xsession-hm &
waitPID=$!
'';
}
];