aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-01 18:46:54 +0100
committerAdrian Kummerlaender2019-02-01 18:48:35 +0100
commitcec64613630b68a8b0e286df862a92ce555a6bdc (patch)
treeff10677225010bc1043b770cea5920759089ecf9
parent51a119b91bc56d57cd857ac5c08cf75b5f61c16e (diff)
downloadnixos_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.
-rw-r--r--custom.nix8
-rw-r--r--gui/default.nix17
-rw-r--r--gui/gtk.nix5
-rw-r--r--gui/hidpi.nix25
-rw-r--r--gui/lowdpi.nix11
-rw-r--r--gui/rofi.nix10
-rw-r--r--gui/twmn.nix9
-rw-r--r--gui/xmonad.nix8
-rw-r--r--home.nix1
-rw-r--r--host/asterix.nix3
-rw-r--r--host/athena.nix3
-rw-r--r--host/obelix.nix3
12 files changed, 54 insertions, 49 deletions
diff --git a/custom.nix b/custom.nix
new file mode 100644
index 0000000..266a37e
--- /dev/null
+++ b/custom.nix
@@ -0,0 +1,8 @@
+{ pkgs, ... }:
+
+{
+ options.custom.hidpi = pkgs.lib.mkOption {
+ type = pkgs.lib.types.bool;
+ description = "Configure UI for high DPI displays";
+ };
+}
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 = {
diff --git a/home.nix b/home.nix
index 671686b..07d081b 100644
--- a/home.nix
+++ b/home.nix
@@ -7,6 +7,7 @@
};
imports = [
+ ./custom.nix
./host/current.nix
];
diff --git a/host/asterix.nix b/host/asterix.nix
index 1830779..7862a21 100644
--- a/host/asterix.nix
+++ b/host/asterix.nix
@@ -3,7 +3,6 @@
{
imports = [
../gui/default.nix
- ../gui/lowdpi.nix
../gui/autorandr.nix
../gui/networkmanager.nix
];
@@ -11,4 +10,6 @@
home.packages = with pkgs; [
acpi
];
+
+ custom.hidpi = false;
}
diff --git a/host/athena.nix b/host/athena.nix
index 4e8a824..362d7cd 100644
--- a/host/athena.nix
+++ b/host/athena.nix
@@ -3,7 +3,6 @@
{
imports = [
../gui/default.nix
- ../gui/hidpi.nix
../gui/networkmanager.nix
../gui/stalonetray.nix
../gui/redshift.nix
@@ -14,4 +13,6 @@
acpi
xorg.xbacklight
];
+
+ custom.hidpi = true;
}
diff --git a/host/obelix.nix b/host/obelix.nix
index 8bbb62a..26a17ea 100644
--- a/host/obelix.nix
+++ b/host/obelix.nix
@@ -3,6 +3,7 @@
{
imports = [
../gui/default.nix
- ../gui/lowdpi.nix
];
+
+ custom.hidpi = false;
}