Skip to content

Commit

Permalink
home-manager/desktop: move i3/sway to it
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Sep 29, 2023
1 parent 1675a59 commit 52c7496
Show file tree
Hide file tree
Showing 31 changed files with 1,164 additions and 1,082 deletions.
2 changes: 0 additions & 2 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
imports = [
./desktop
./dev
./i3
./minimal.nix
./sway
./theme
];

Expand Down
2 changes: 2 additions & 0 deletions home-manager/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
imports = [
./chromium.nix
./firefox.nix
./i3
./kitty.nix
./mpv
./sway
./xterm.nix
];

Expand Down
46 changes: 46 additions & 0 deletions home-manager/desktop/i3/autorandr/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ config, lib, pkgs, osConfig, ... }:

let
hostName = osConfig.networking.hostName or "generic";
hostConfigFile = ./${hostName}.nix;
in
{
imports = lib.optionals (builtins.pathExists hostConfigFile) [ hostConfigFile ];

options.home-manager.desktop.i3.autorandr.enable = lib.mkEnableOption "autorandr config" // {
default = config.home-manager.desktop.i3.enable;
};

config = lib.mkIf config.home-manager.desktop.i3.autorandr.enable {
home.activation = let inherit (config.xdg) configHome; in {
# Set default profile to the virtual horizontal profile
autorandrCreateDefaultProfile = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
cd "${configHome}/autorandr"
$DRY_RUN_CMD ln -sf $VERBOSE_ARG horizontal default
'';
};

programs.autorandr = {
enable = true;
hooks = {
postswitch = {
notify-i3 = "${pkgs.i3}/bin/i3-msg restart";
reset-wallpaper = "systemctl restart --user wallpaper.service";
};
};
};

# Configure autorandr globally
xdg.configFile = {
# Skip gamma settings since this is controlled by gammastep
"autorandr/settings.ini" = {
inherit (config.programs.autorandr) enable;
text = lib.generators.toINI { } {
config = {
skip-options = "gamma";
};
};
};
};
};
}
File renamed without changes.
67 changes: 36 additions & 31 deletions home-manager/i3/default.nix → home-manager/desktop/i3/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,42 +85,47 @@ in
./x11.nix
];

home = {
# Disable keyboard management via HM
keyboard = null;

packages = with pkgs; [
arandr
dex
feh
maim
mons
pamixer
playerctl
wmctrl
xsecurelock
xss-lock
];
options.home-manager.desktop.i3.enable = lib.mkEnableOption "i3 config" // {
default = config.home-manager.desktop.enable;
};

xsession.windowManager.i3 = with commonOptions; {
enable = true;

inherit extraConfig;
config = lib.mkIf config.home-manager.desktop.i3.enable {
home = {
# Disable keyboard management via HM
keyboard = null;

config = commonOptions.config // {
startup = [
{
command = "${pkgs.xorg.xset}/bin/xset s 600 30";
notification = false;
}
{
command = "${pkgs.dex}/bin/dex --autostart";
notification = false;
}
packages = with pkgs; [
arandr
dex
feh
maim
mons
pamixer
playerctl
wmctrl
xsecurelock
xss-lock
];
};

xsession.windowManager.i3 = with commonOptions; {
enable = true;

inherit extraConfig;

config = commonOptions.config // {
startup = [
{
command = "${pkgs.xorg.xset}/bin/xset s 600 30";
notification = false;
}
{
command = "${pkgs.dex}/bin/dex --autostart";
notification = false;
}
];

};
};
};

}
60 changes: 60 additions & 0 deletions home-manager/desktop/i3/dunst.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{ config, lib, pkgs, ... }:

{
options.home-manager.desktop.i3.dunst.enable = lib.mkEnableOption "dunst config" // {
default = config.home-manager.desktop.i3.enable;
};

config = lib.mkIf config.home-manager.desktop.i3.dunst.enable {
home.packages = with pkgs; [
dbus # for dbus-send, needed for dunstctl
dunst
];

services.dunst = {
enable = true;
iconTheme = with config.gtk.iconTheme; { inherit name package; };
settings = with config.theme.colors;
let
theme = {
background = base00;
foreground = base05;
};
in
{
global = with config.theme.fonts; {
font = "${gui.name} 8";
markup = true;
format = "<b>%s</b>\\n%b";
sort = true;
indicate_hidden = true;
alignment = "left";
show_age_threshold = 60;
word_wrap = true;
ignore_newline = false;
width = 250;
height = 200;
origin = "top-right";
notification_limit = 5;
transparency = 0;
idle_threshold = 120;
follow = "mouse";
sticky_history = true;
line_height = 0;
padding = 8;
horizontal_padding = 8;
separator_color = base03;
frame_width = 1;
frame_color = base01;
show_indicators = false;
icon_position = "left";
min_icon_size = 48;
max_icon_size = 48;
};
urgency_low = { timeout = 5; } // theme;
urgency_normal = { timeout = 10; } // theme;
urgency_high = { timeout = 20; } // theme;
};
};
};
}
27 changes: 27 additions & 0 deletions home-manager/desktop/i3/gammastep.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ config, lib, pkgs, ... }:

{
options.home-manager.desktop.i3.gammastep.enable = lib.mkEnableOption "gammastep config" // {
default = config.home-manager.desktop.i3.enable;
};

config = lib.mkIf config.home-manager.desktop.i3.gammastep.enable {
services.gammastep = {
enable = config.device.type != "vm";
tray = true;
dawnTime = "6:30-7:30";
duskTime = "18:30-19:30";
package = pkgs.gammastep;
temperature = {
day = 5700;
night = 3700;
};
settings = {
general = {
gamma = 0.8;
fade = 1;
};
};
};
};
}
Loading

0 comments on commit 52c7496

Please sign in to comment.