From 037b50d6087faf294c657cae944c4a10b6d5250c Mon Sep 17 00:00:00 2001 From: sefidel Date: Thu, 14 Sep 2023 22:48:51 +0900 Subject: feat(home): basic HiDPI support --- home/configs/haruka/sefidel.nix | 7 +++++ home/profiles/browsing/default.nix | 11 +++++++ home/profiles/gui/config/dunst.nix | 8 +++-- home/profiles/gui/config/foot.nix | 9 ++++-- home/profiles/gui/config/sway.nix | 12 +++++--- home/profiles/gui/config/waybar/style.nix | 9 ++++-- home/profiles/gui/default.nix | 50 ++++++++++++++++++++++++++----- 7 files changed, 87 insertions(+), 19 deletions(-) (limited to 'home') diff --git a/home/configs/haruka/sefidel.nix b/home/configs/haruka/sefidel.nix index 5e4f561..69b6b1a 100644 --- a/home/configs/haruka/sefidel.nix +++ b/home/configs/haruka/sefidel.nix @@ -4,6 +4,13 @@ config = { activeProfiles = [ "base" "gui" "browsing" "development" "communication" "multimedia" "research" ]; + profiles.gui.font = { + name = "JetBrainsMono"; + pixelSize = 14; + }; + + profiles.browsing.hiDpi = true; + programs.htop.settings.detailed_cpu_time = true; sops.defaultSopsFile = ../../secrets/secrets.yaml; diff --git a/home/profiles/browsing/default.nix b/home/profiles/browsing/default.nix index 396cc70..42e85f0 100644 --- a/home/profiles/browsing/default.nix +++ b/home/profiles/browsing/default.nix @@ -5,6 +5,14 @@ in options.profiles.browsing = { enable = lib.mkEnableOption "A profile that enables a browser for the GUI and the terminal"; + + hiDpi = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Tweak the browsers for better readability on HiDPI screens + ''; + }; }; config = lib.mkIf cfg.enable { @@ -36,6 +44,9 @@ in settings = import ./qutebrowser-settings.nix // { url.default_page = "https://searx.be"; url.start_pages = "https://searx.be"; + } // lib.optionalAttrs (cfg.hiDpi) { + qt.highdpi = true; + fonts.default_size = "12pt"; }; }; diff --git a/home/profiles/gui/config/dunst.nix b/home/profiles/gui/config/dunst.nix index 60ed15f..b614de5 100644 --- a/home/profiles/gui/config/dunst.nix +++ b/home/profiles/gui/config/dunst.nix @@ -1,6 +1,10 @@ -{ neotheme }: +{ config, neotheme }: with neotheme.colors; + +let + guiCfg = config.profiles.gui; +in { global = { padding = 8; @@ -19,7 +23,7 @@ with neotheme.colors; word_wrap = true; show_indicators = false; format = "%s\\n\\n%b"; - font = "Dina 10"; + font = "${guiCfg.font.name} ${toString guiCfg.font.size}"; frame_color = "#${color3}"; separator_color = "auto"; max_icon_size = 80; diff --git a/home/profiles/gui/config/foot.nix b/home/profiles/gui/config/foot.nix index 9296b48..61fecf7 100644 --- a/home/profiles/gui/config/foot.nix +++ b/home/profiles/gui/config/foot.nix @@ -1,13 +1,16 @@ -{ neotheme }: +{ config, neotheme }: with neotheme.colors; +let + guiCfg = config.profiles.gui; +in { main = { term = "foot"; - font = "Dina:pixelsize=13,JetBrainsMono Nerd Font:pixelsize=12"; + font = "${guiCfg.font.name}:pixelsize=${toString guiCfg.font.pixelSize},JetBrainsMono Nerd Font:pixelsize=12"; letter-spacing = 0; - dpi-aware = "yes"; + # dpi-aware = "yes"; pad = "16x16 center"; }; diff --git a/home/profiles/gui/config/sway.nix b/home/profiles/gui/config/sway.nix index 174b47e..dddf9d9 100644 --- a/home/profiles/gui/config/sway.nix +++ b/home/profiles/gui/config/sway.nix @@ -2,6 +2,9 @@ with neotheme.colors; +let + guiCfg = config.profiles.gui; +in '' # disable power key exec systemd-inhibit --what=handle-power-key --who="sway" --why="Sway manages power key behaviour" sleep infinity @@ -25,7 +28,7 @@ with neotheme.colors; bindsym $mod+Return exec $term # set menu - set $menu "${pkgs.bemenu}/bin/bemenu-run -H 18 -l 5 --fn 'Dina 13px' -p 'run::' --tb '$primary' --tf '$color0' --hb '$primary' --hf '$color0'" + set $menu "${pkgs.bemenu}/bin/bemenu-run -H 18 -l 5 --fn '${guiCfg.font.name} ${toString guiCfg.font.pixelSize}px' -p 'run::' --tb '$primary' --tf '$color0' --hb '$primary' --hf '$color0'" bindsym $mod+d exec $menu # set screenshot util @@ -68,7 +71,7 @@ with neotheme.colors; # kill focused bindsym $mod+w kill - font "pango:Dina 10" + font "pango:${guiCfg.font.name} ${toString guiCfg.font.size}" # window rules for_window [window_role="pop-up"] floating enable @@ -199,8 +202,9 @@ with neotheme.colors; client.unfocused $muted $muted $color7 $muted client.urgent $color10 $color10 $color0 $color10 output "*" bg ${../../../../assets/annie-spratt-arctic.jpg} fill - output "*" scale 1 - output "*" scale_filter nearest + output eDP-1 scale 1.25 + # output "*" scale 1 + # output "*" scale_filter smart input type:touchpad { tap enabled diff --git a/home/profiles/gui/config/waybar/style.nix b/home/profiles/gui/config/waybar/style.nix index d8714ed..5009ccb 100644 --- a/home/profiles/gui/config/waybar/style.nix +++ b/home/profiles/gui/config/waybar/style.nix @@ -1,13 +1,16 @@ -{ neotheme }: +{ config, neotheme }: with neotheme.colors; +let + guiCfg = config.profiles.gui; +in '' * { border: none; border-radius: 0; - font-family: "Dina, JetBrainsMono Nerd Font"; - font-size: 12px; + font-family: "${guiCfg.font.name}, JetBrainsMono Nerd Font"; + font-size: ${toString guiCfg.font.pixelSize}px; min-height: 0; } diff --git a/home/profiles/gui/default.nix b/home/profiles/gui/default.nix index 8ed2409..65d2c4a 100644 --- a/home/profiles/gui/default.nix +++ b/home/profiles/gui/default.nix @@ -9,8 +9,30 @@ in ../../modules/misc/neotheme ]; - options.profiles.gui.enable = lib.mkEnableOption - "The gui profile, sets up sway and related applications."; + options.profiles.gui = { + enable = lib.mkEnableOption + "The gui profile, sets up sway and related applications."; + + font = { + name = lib.mkOption { + type = lib.types.str; + default = "Dina"; + description = "Name of the primary font"; + }; + + size = lib.mkOption { + type = lib.types.number; + default = 10; + description = "Size for the primary font"; + }; + + pixelSize = lib.mkOption { + type = lib.types.number; + default = 13; + description = "Pixelsize(px) for the primary font"; + }; + }; + }; config = lib.mkIf cfg.enable { gtk.enable = true; @@ -18,7 +40,7 @@ in gtk.iconTheme.name = "Papirus-Dark"; gtk.theme.package = (pkgs.orchis-theme.override { tweaks = [ "primary" "compact" ]; }); gtk.theme.name = "Orchis-dark-compact"; - gtk.font.name = "Dina 10"; + gtk.font.name = "${cfg.font.name} ${toString cfg.font.size}"; home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ-AA"; @@ -87,7 +109,7 @@ in }; extraSessionCommands = '' - export XDG_CURRENT_DESKTOP=sway; + . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" ''; extraConfig = import ./config/sway.nix { inherit config pkgs neotheme; }; @@ -103,7 +125,7 @@ in foot = { enable = true; - settings = import ./config/foot.nix { inherit neotheme; }; + settings = import ./config/foot.nix { inherit config neotheme; }; }; waybar = { @@ -111,14 +133,28 @@ in settings = [ (import ./config/waybar/settings.nix { inherit neotheme; }) ]; - style = import ./config/waybar/style.nix { inherit neotheme; }; + style = import ./config/waybar/style.nix { inherit config neotheme; }; }; }; services = { dunst = { enable = true; - settings = import ./config/dunst.nix { inherit neotheme; }; + settings = import ./config/dunst.nix { inherit config neotheme; }; + }; + + kanshi = { + enable = true; + profiles = { + haruka-standalone = { + outputs = [ + { + criteria = "AU Optronics 0xD291 Unknown"; + scale = 1.25; + } + ]; + }; + }; }; swayidle = -- cgit 1.4.1