diff options
author | Adrian Kummerlaender | 2019-02-01 18:46:54 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2019-02-01 18:48:35 +0100 |
commit | cec64613630b68a8b0e286df862a92ce555a6bdc (patch) | |
tree | ff10677225010bc1043b770cea5920759089ecf9 /gui | |
parent | 51a119b91bc56d57cd857ac5c08cf75b5f61c16e (diff) | |
download | nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.tar nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.tar.gz nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.tar.bz2 nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.tar.lz nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.tar.xz nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.tar.zst nixos_home-cec64613630b68a8b0e286df862a92ce555a6bdc.zip |
Add custom config key for enabling hidpi mode
If this approach works as well as I hope it might become advantageous to nixify e.g. XMonad configuration.
Diffstat (limited to 'gui')
-rw-r--r-- | gui/default.nix | 17 | ||||
-rw-r--r-- | gui/gtk.nix | 5 | ||||
-rw-r--r-- | gui/hidpi.nix | 25 | ||||
-rw-r--r-- | gui/lowdpi.nix | 11 | ||||
-rw-r--r-- | gui/rofi.nix | 10 | ||||
-rw-r--r-- | gui/twmn.nix | 9 | ||||
-rw-r--r-- | gui/xmonad.nix | 8 |
7 files changed, 39 insertions, 46 deletions
diff --git a/gui/default.nix b/gui/default.nix index 9ada0be..2cc011e 100644 --- a/gui/default.nix +++ b/gui/default.nix @@ -1,6 +1,9 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: -{ +let + hidpi = config.custom.hidpi; + +in { imports = [ ./xmonad.nix ./kitty.nix @@ -11,4 +14,14 @@ ./apps/web.nix ./apps/dev.nix ]; + + xresources.extraConfig = pkgs.lib.mkIf hidpi '' + Xft.dpi: 160 + Xft.autohint: 0 + Xft.lcdfilter: lcddefault + Xft.hintstyle: hintfull + Xft.hinting: 1 + Xft.antialias: 1 + Xft.rgba: rgb + ''; } diff --git a/gui/gtk.nix b/gui/gtk.nix index 3aec4ea..abfc889 100644 --- a/gui/gtk.nix +++ b/gui/gtk.nix @@ -1,6 +1,7 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: let + hidpi = config.custom.hidpi; mypkgs = import (fetchTarball "https://pkgs.kummerlaender.eu/nixexprs.tar.gz") { }; in { gtk = { @@ -27,7 +28,7 @@ in { txt_fg = "101010"; gradient = 0.0; roundness = 0; - spacing = 5; + spacing = if hidpi then 5 else 1; wm_border_focus = "909636"; wm_border_unfocus = "909636"; gtk3_generate_dark = false; diff --git a/gui/hidpi.nix b/gui/hidpi.nix deleted file mode 100644 index d687ca7..0000000 --- a/gui/hidpi.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs, ... }: - -{ - xresources.extraConfig = '' - Xft.dpi: 160 - Xft.autohint: 0 - Xft.lcdfilter: lcddefault - Xft.hintstyle: hintfull - Xft.hinting: 1 - Xft.antialias: 1 - Xft.rgba: rgb - ''; - - xsession.pointerCursor.size = 48; - - home.file.".config/twmn/twmn.conf".text = '' - [gui] - font_size=24 - height=32 - ''; - - programs.rofi.extraConfig = '' - rofi.dpi: 160 - ''; -} diff --git a/gui/lowdpi.nix b/gui/lowdpi.nix deleted file mode 100644 index 6410f23..0000000 --- a/gui/lowdpi.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - xsession.pointerCursor.size = 16; - - home.file.".config/twmn/twmn.conf".text = '' - [gui] - font_size=15 - height=20 - ''; -} diff --git a/gui/rofi.nix b/gui/rofi.nix index 19749f5..034abdc 100644 --- a/gui/rofi.nix +++ b/gui/rofi.nix @@ -1,6 +1,11 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: -{ +let + hidpiExtraConfig = if config.custom.hidpi then '' + rofi.dpi: 160 + '' else ""; + +in { programs.rofi = { enable = true; location = "top"; @@ -52,6 +57,7 @@ rofi.combi-modi: windowcd,drun,ssh rofi.terminal: kitty rofi.ssh-command: {terminal} {ssh-client} {host} + ${hidpiExtraConfig} ''; }; } diff --git a/gui/twmn.nix b/gui/twmn.nix index e2dcbcb..de0a84f 100644 --- a/gui/twmn.nix +++ b/gui/twmn.nix @@ -1,6 +1,9 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: -{ +let + hidpi = config.custom.hidpi; + +in { home.packages = with pkgs; [ twmn libnotify @@ -30,6 +33,8 @@ background_color=#909737 bounce=true font=Iosevka + font_size=${if hidpi then "24" else "14"} + height=${if hidpi then "32" else "20"} foreground_color=#111111 in_animation=6 in_animation_duration=500 diff --git a/gui/xmonad.nix b/gui/xmonad.nix index 9e8a0a8..52de48d 100644 --- a/gui/xmonad.nix +++ b/gui/xmonad.nix @@ -1,6 +1,9 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: -{ +let + hidpi = config.custom.hidpi; + +in { imports = [ ./gtk.nix ./rofi.nix @@ -13,6 +16,7 @@ pointerCursor = { package = pkgs.vanilla-dmz; name = "Vanilla-DMZ-AA"; + size = if hidpi then 48 else 16; }; windowManager.xmonad = { |