declare GDK_SCALE in host cfg

This commit is contained in:
Aly Raffauf 2024-07-07 22:23:19 -04:00
parent d2c45940d3
commit 0840f43ffd
8 changed files with 106 additions and 109 deletions

View file

@ -3,107 +3,106 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = let cfg = config.ar.home.defaultApps;
cfg = config.ar.home.defaultApps; inherit
inherit (import ./mimetypes.nix)
(import ./mimetypes.nix) audioFiles
audioFiles browserFiles
browserFiles documentFiles
documentFiles editorFiles
editorFiles imageFiles
imageFiles videoFiles
videoFiles ;
; in {
in config = lib.mkIf cfg.enable {
lib.mkIf cfg.enable { dconf = {
dconf = { enable = true;
enable = true; settings = {
settings = { "org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe cfg.terminal}";
"org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe cfg.terminal}"; "org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe cfg.terminal}";
"org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe cfg.terminal}";
};
};
home = {
packages = with cfg; [
audioPlayer
editor
fileManager
imageViewer
pdfViewer
terminal
terminalEditor
videoPlayer
webBrowser
];
sessionVariables = {
BROWSER = "${lib.getExe cfg.webBrowser}";
EDITOR = "${lib.getExe cfg.terminalEditor}";
TERMINAL = "${lib.getExe cfg.terminal}";
};
};
xdg = {
mimeApps = {
enable = true;
defaultApplications = let
mkDefaults = files: desktopFile: lib.genAttrs files (_: [desktopFile]);
audioTypes =
mkDefaults audioFiles
"defaultAudioPlayer.desktop";
browserTypes =
mkDefaults browserFiles
"defaultWebBrowser.desktop";
documentTypes =
mkDefaults documentFiles
"defaultPdfViewer.desktop";
editorTypes =
mkDefaults editorFiles
"defaultEditor.desktop";
folderTypes = {"inode/directory" = "defaultFileManager.desktop";};
imageTypes =
mkDefaults imageFiles
"defaultImageViewer.desktop";
videoTypes =
mkDefaults videoFiles
"defaultVideoPlayer.desktop";
in
audioTypes
// browserTypes
// documentTypes
// editorTypes
// folderTypes
// imageTypes
// videoTypes;
};
desktopEntries = let
mkDefaultEntry = name: package: {
name = "Default ${name}";
exec = "${lib.getExe package} %U";
terminal = false;
settings = {
NoDisplay = "true";
};
};
in {
defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer;
defaultEditor = mkDefaultEntry "Editor" cfg.editor;
defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager;
defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer;
defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer;
defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer;
defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser;
};
}; };
}; };
home = {
packages = with cfg; [
audioPlayer
editor
fileManager
imageViewer
pdfViewer
terminal
terminalEditor
videoPlayer
webBrowser
];
sessionVariables = {
BROWSER = "${lib.getExe cfg.webBrowser}";
EDITOR = "${lib.getExe cfg.terminalEditor}";
TERMINAL = "${lib.getExe cfg.terminal}";
};
};
xdg = {
mimeApps = {
enable = true;
defaultApplications = let
mkDefaults = files: desktopFile: lib.genAttrs files (_: [desktopFile]);
audioTypes =
mkDefaults audioFiles
"defaultAudioPlayer.desktop";
browserTypes =
mkDefaults browserFiles
"defaultWebBrowser.desktop";
documentTypes =
mkDefaults documentFiles
"defaultPdfViewer.desktop";
editorTypes =
mkDefaults editorFiles
"defaultEditor.desktop";
folderTypes = {"inode/directory" = "defaultFileManager.desktop";};
imageTypes =
mkDefaults imageFiles
"defaultImageViewer.desktop";
videoTypes =
mkDefaults videoFiles
"defaultVideoPlayer.desktop";
in
audioTypes
// browserTypes
// documentTypes
// editorTypes
// folderTypes
// imageTypes
// videoTypes;
};
desktopEntries = let
mkDefaultEntry = name: package: {
name = "Default ${name}";
exec = "${lib.getExe package} %U";
terminal = false;
settings = {
NoDisplay = "true";
};
};
in {
defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer;
defaultEditor = mkDefaultEntry "Editor" cfg.editor;
defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager;
defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer;
defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer;
defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer;
defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser;
};
};
};
} }

View file

@ -102,8 +102,6 @@
region = "${bin} -m region -o ${folder}"; region = "${bin} -m region -o ${folder}";
}; };
gdk_scale = "1.5";
clamshell = pkgs.writeShellScript "hyprland-clamshell" '' clamshell = pkgs.writeShellScript "hyprland-clamshell" ''
NUM_MONITORS=$(${hyprctl} monitors all | grep Monitor | wc --lines) NUM_MONITORS=$(${hyprctl} monitors all | grep Monitor | wc --lines)
if [ "$1" == "on" ]; then if [ "$1" == "on" ]; then
@ -194,9 +192,6 @@
force_zero_scaling = true force_zero_scaling = true
} }
# toolkit-specific scale
env = GDK_SCALE,${gdk_scale}
# Some default env vars. # Some default env vars.
env = XCURSOR_SIZE,${toString config.home.pointerCursor.size} env = XCURSOR_SIZE,${toString config.home.pointerCursor.size}
env = QT_QPA_PLATFORMTHEME,qt6ct env = QT_QPA_PLATFORMTHEME,qt6ct

View file

@ -18,6 +18,7 @@
systemd-boot.enable = true; systemd-boot.enable = true;
}; };
environment.variables.GDK_SCALE = "1.5";
networking.hostName = "fallarbor"; networking.hostName = "fallarbor";
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View file

@ -19,8 +19,8 @@
systemd-boot.enable = true; systemd-boot.enable = true;
}; };
environment.variables.GDK_SCALE = "1.5";
networking.hostName = "lavaridge"; networking.hostName = "lavaridge";
system.stateVersion = "24.05"; system.stateVersion = "24.05";
ar = { ar = {

View file

@ -26,6 +26,7 @@
}; };
}; };
environment.variables.GDK_SCALE = "1.25";
hardware.enableAllFirmware = true; hardware.enableAllFirmware = true;
networking.hostName = "mandarin"; networking.hostName = "mandarin";

View file

@ -91,8 +91,8 @@ in {
}; };
}; };
environment.variables.GDK_SCALE = "1.25";
system.stateVersion = "23.11"; system.stateVersion = "23.11";
zramSwap.memoryPercent = 100; zramSwap.memoryPercent = 100;
ar = { ar = {

View file

@ -18,8 +18,8 @@
systemd-boot.enable = true; systemd-boot.enable = true;
}; };
environment.variables.GDK_SCALE = "2";
networking.hostName = "petalburg"; networking.hostName = "petalburg";
system.stateVersion = "24.05"; system.stateVersion = "24.05";
ar = { ar = {

View file

@ -19,6 +19,7 @@
systemd-boot.enable = true; systemd-boot.enable = true;
}; };
environment.variables.GDK_SCALE = "1.25";
networking.hostName = "rustboro"; networking.hostName = "rustboro";
system.stateVersion = "24.05"; system.stateVersion = "24.05";
zramSwap.memoryPercent = 100; zramSwap.memoryPercent = 100;