]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/graphical.nix
xsettingsd: enable service for dynamic GTK theme switching
[julm/julm-nix.git] / home-manager / profiles / graphical.nix
1 { pkgs, lib, config, nixosConfig, ... }:
2 {
3 imports = [
4 ./redshift.nix
5 ];
6 home.packages = [
7 pkgs.arandr
8 pkgs.glib.bin
9 pkgs.glxinfo
10 pkgs.dconf-editor
11 pkgs.hicolor-icon-theme
12 pkgs.pavucontrol
13 pkgs.qpwgraph
14 pkgs.x2goclient
15 pkgs.xclip
16 pkgs.xorg.xkill
17 ];
18 #services.gnome.at-spi2-core.enable = true;
19 home.sessionVariables = lib.mkIf (!nixosConfig.services.gnome.at-spi2-core.enable) {
20 NO_AT_BRIDGE = "1";
21 };
22 # keycode <num> = <x> <Shift+x> _ _ <AltGr+x> <AltGr+Shift+x> _ _"
23 home.file.".Xmodmap".text = ''
24 ! — (tiret insécable) with AltGr+Shift+-
25 keycode 15 = minus 6 bar fiveeighths bar U2011
26 ! — (tiret cadratin) with AltGr+Shift+_
27 keycode 17 = underscore 8 bar fiveeighths backslash emdash
28 ! œ with AltGr+o
29 ! Œ with AltGr+Shift+o
30 keycode 32 = o O o O oe OE
31 ! … (ellipsis) with AltGr+;
32 keycode 59 = semicolon period comma less ellipsis multiply ccedilla Ccedilla
33 !   (nbsp) with AltGr+space and   (narrow nbsp) with AltGr+Shift+space
34 keycode 65 = space space NoSymbol NoSymbol nobreakspace U202F
35 '';
36 systemd.user.services.setxkbmap.Service.ExecStartPost =
37 "${pkgs.xorg.xmodmap}/bin/xmodmap ${config.home.homeDirectory}/.Xmodmap";
38 programs.bash = {
39 initExtra = ''
40 gtk-theme () {
41 case $1 in
42 dark)
43 dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
44 echo 'Net/ThemeName "Adwaita-dark"' > ~/.xsettingsd
45 systemctl --user kill -s HUP xsettingsd.service
46 ;;
47 light)
48 dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
49 echo 'Net/ThemeName "Adwaita"' > ~/.xsettingsd
50 systemctl --user kill -s HUP xsettingsd.service
51 ;;
52 *) echo "Usage: dark-mode <dark|light>";;
53 esac
54 }
55 '';
56 };
57 # Required for gtk-theme to work.
58 services.xsettingsd.enable = true;
59 dconf.settings = {
60 "org/gnome/desktop/interface" = {
61 color-scheme = lib.mkDefault "prefer-dark";
62 };
63 };
64 gtk = {
65 enable = lib.mkDefault true;
66 theme.name = "Adwaita";
67 theme.package = pkgs.gnome-themes-extra;
68 iconTheme.package = pkgs.adwaita-icon-theme;
69 iconTheme.name = "Adwaita";
70 gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
71 gtk3 = {
72 bookmarks = lib.mkDefault [
73 ];
74 };
75 };
76 }