mirror of
https://github.com/nmasur/dotfiles
synced 2024-10-19 03:49:03 +00:00
Compare commits
6 Commits
9ec448ad9c
...
cc4296c416
Author | SHA1 | Date | |
---|---|---|---|
|
cc4296c416 | ||
|
40491a315d | ||
|
3cecb8810c | ||
|
af753153f1 | ||
|
d2afdd56ae | ||
|
18fec1d058 |
@ -11,23 +11,10 @@
|
|||||||
|
|
||||||
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
||||||
|
|
||||||
# Set the Rofi-Systemd terminal for viewing logs
|
terminal = "${pkgs.kitty}/bin/kitty";
|
||||||
# Using optionalAttrs because only available in NixOS
|
|
||||||
environment = { } // lib.attrsets.optionalAttrs
|
|
||||||
(builtins.hasAttr "sessionVariables" config.environment) {
|
|
||||||
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
# Set the i3 terminal
|
|
||||||
xsession.windowManager.i3.config.terminal =
|
|
||||||
lib.mkIf pkgs.stdenv.isLinux "kitty";
|
|
||||||
|
|
||||||
# Set the Rofi terminal for running programs
|
|
||||||
programs.rofi.terminal =
|
|
||||||
lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
|
|
||||||
|
|
||||||
# Display images in the terminal
|
# Display images in the terminal
|
||||||
programs.fish.shellAliases = {
|
programs.fish.shellAliases = {
|
||||||
icat = "kitty +kitten icat";
|
icat = "kitty +kitten icat";
|
||||||
|
@ -44,7 +44,8 @@
|
|||||||
# Better local mail search
|
# Better local mail search
|
||||||
programs.notmuch = {
|
programs.notmuch = {
|
||||||
enable = true;
|
enable = true;
|
||||||
new.ignore = [ ".mbsyncstate.lock" ".mbsyncstate.journal" ];
|
new.ignore =
|
||||||
|
[ ".mbsyncstate.lock" ".mbsyncstate.journal" ".mbsyncstate.new" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
accounts.email = {
|
accounts.email = {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
programs.gh =
|
programs.gh =
|
||||||
lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
|
lib.mkIf config.home-manager.users.${config.user}.programs.git.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableGitCredentialHelper = true;
|
gitCredentialHelper.enable = true;
|
||||||
settings.git_protocol = "https";
|
settings.git_protocol = "https";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./dunst.nix
|
./dunst.nix
|
||||||
./fonts.nix
|
./fonts.nix
|
||||||
|
./gtk.nix
|
||||||
./i3.nix
|
./i3.nix
|
||||||
./picom.nix
|
./picom.nix
|
||||||
./polybar.nix
|
./polybar.nix
|
||||||
@ -12,14 +13,6 @@
|
|||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
launcherCommand = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "Command to use for launching";
|
|
||||||
};
|
|
||||||
systemdSearch = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "Command to use for interacting with systemd";
|
|
||||||
};
|
|
||||||
altTabCommand = lib.mkOption {
|
altTabCommand = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to use for choosing windows";
|
description = "Command to use for choosing windows";
|
||||||
@ -36,14 +29,30 @@
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to use for quick calculations";
|
description = "Command to use for quick calculations";
|
||||||
};
|
};
|
||||||
toggleBarCommand = lib.mkOption {
|
launcherCommand = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to hide and show the status bar.";
|
description = "Command to use for launching";
|
||||||
|
};
|
||||||
|
lockScreenCommand = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Command to use to lock the screen";
|
||||||
};
|
};
|
||||||
powerCommand = lib.mkOption {
|
powerCommand = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to use for power options menu";
|
description = "Command to use for power options menu";
|
||||||
};
|
};
|
||||||
|
systemdSearch = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Command to use for interacting with systemd";
|
||||||
|
};
|
||||||
|
terminal = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Package to use for graphical terminal";
|
||||||
|
};
|
||||||
|
toggleBarCommand = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Command to hide and show the status bar.";
|
||||||
|
};
|
||||||
wallpaper = lib.mkOption {
|
wallpaper = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = "Wallpaper background image file";
|
description = "Wallpaper background image file";
|
||||||
|
116
modules/nixos/graphical/gtk.nix
Normal file
116
modules/nixos/graphical/gtk.nix
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
# Based on: https://gitlab.com/rycee/nur-expressions/-/blob/7ae92e3497e1f1805fb849510120e2ee393018cd/pkgs/materia-theme/default.nix
|
||||||
|
gtkTheme = pkgs.stdenv.mkDerivation rec {
|
||||||
|
pname = "materia-custom";
|
||||||
|
version = "20210322";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "nana-4";
|
||||||
|
repo = "materia-theme";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "1fsicmcni70jkl4jb3fvh7yv0v9jhb8nwjzdq8vfwn256qyk0xvl";
|
||||||
|
};
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
bc
|
||||||
|
optipng
|
||||||
|
sassc
|
||||||
|
|
||||||
|
(runCommandLocal "rendersvg" { } ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s ${resvg}/bin/resvg $out/bin/rendersvg
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
|
||||||
|
# Fixes problem "Fontconfig error: Cannot load default config file"
|
||||||
|
FONTCONFIG_FILE =
|
||||||
|
pkgs.makeFontsConf { fontDirectories = [ pkgs.cantarell-fonts ]; };
|
||||||
|
|
||||||
|
# Derivation adds an extra # so we need to remove it from our colorscheme
|
||||||
|
theme = let stripHash = color: lib.strings.removePrefix "#" color;
|
||||||
|
in lib.generators.toKeyValue { } {
|
||||||
|
# Color selection copied from
|
||||||
|
# https://github.com/pinpox/nixos-home/blob/1cefe28c72930a0aed41c20d254ad4d193a3fa37/gtk.nix#L11
|
||||||
|
ACCENT_BG = stripHash config.theme.colors.base0B;
|
||||||
|
ACCENT_FG = stripHash config.theme.colors.base00;
|
||||||
|
BG = stripHash config.theme.colors.base00;
|
||||||
|
BTN_BG = stripHash config.theme.colors.base02;
|
||||||
|
BTN_FG = stripHash config.theme.colors.base06;
|
||||||
|
FG = stripHash config.theme.colors.base05;
|
||||||
|
HDR_BG = stripHash config.theme.colors.base02;
|
||||||
|
HDR_BTN_BG = stripHash config.theme.colors.base01;
|
||||||
|
HDR_BTN_FG = stripHash config.theme.colors.base05;
|
||||||
|
HDR_FG = stripHash config.theme.colors.base05;
|
||||||
|
MATERIA_SURFACE = stripHash config.theme.colors.base01;
|
||||||
|
MATERIA_VIEW = stripHash config.theme.colors.base01;
|
||||||
|
MENU_BG = stripHash config.theme.colors.base02;
|
||||||
|
MENU_FG = stripHash config.theme.colors.base06;
|
||||||
|
SEL_BG = stripHash config.theme.colors.base04;
|
||||||
|
SEL_FG = stripHash config.theme.colors.base05;
|
||||||
|
TXT_BG = stripHash config.theme.colors.base02;
|
||||||
|
TXT_FG = stripHash config.theme.colors.base07;
|
||||||
|
WM_BORDER_FOCUS = stripHash config.theme.colors.base03;
|
||||||
|
WM_BORDER_UNFOCUS = stripHash config.theme.colors.base02;
|
||||||
|
|
||||||
|
MATERIA_COLOR_VARIANT = if config.theme.dark then "dark" else "light";
|
||||||
|
MATERIA_STYLE_COMPACT = "True";
|
||||||
|
UNITY_DEFAULT_LAUNCHER_STYLE = "False";
|
||||||
|
};
|
||||||
|
|
||||||
|
passAsFile = [ "theme" ];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
patchShebangs .
|
||||||
|
|
||||||
|
sed -e '/handle-horz-.*/d' -e '/handle-vert-.*/d' \
|
||||||
|
-i ./src/gtk-2.0/assets.txt
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
export HOME="$NIX_BUILD_ROOT"
|
||||||
|
./change_color.sh \
|
||||||
|
-i False \
|
||||||
|
-t $out/share/themes \
|
||||||
|
-o "materia-custom" \
|
||||||
|
"$themePath"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
config = lib.mkIf config.gui.enable {
|
||||||
|
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
gtk = let
|
||||||
|
gtkExtraConfig = {
|
||||||
|
gtk-application-prefer-dark-theme = config.theme.dark;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
theme = {
|
||||||
|
name = "materia-custom";
|
||||||
|
package = gtkTheme;
|
||||||
|
};
|
||||||
|
gtk3.extraConfig = gtkExtraConfig;
|
||||||
|
gtk4.extraConfig = gtkExtraConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make the login screen dark
|
||||||
|
services.xserver.displayManager.lightdm.greeters.gtk.theme = {
|
||||||
|
name = config.home-manager.users.${config.user}.gtk.theme.name;
|
||||||
|
package = gtkTheme;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.sessionVariables = {
|
||||||
|
GTK_THEME = config.home-manager.users.${config.user}.gtk.theme.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
lockCmd =
|
|
||||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
|
||||||
lockUpdate =
|
lockUpdate =
|
||||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
||||||
|
|
||||||
@ -29,12 +27,6 @@ in {
|
|||||||
ws2 = "2:II";
|
ws2 = "2:II";
|
||||||
ws3 = "3:III";
|
ws3 = "3:III";
|
||||||
ws4 = "4:IV";
|
ws4 = "4:IV";
|
||||||
ws5 = "5:V";
|
|
||||||
ws6 = "6:VI";
|
|
||||||
ws7 = "7:VII";
|
|
||||||
ws8 = "8:VIII";
|
|
||||||
ws9 = "9:IX";
|
|
||||||
ws10 = "10:X";
|
|
||||||
in {
|
in {
|
||||||
modifier = modifier;
|
modifier = modifier;
|
||||||
assigns = {
|
assigns = {
|
||||||
@ -92,118 +84,6 @@ in {
|
|||||||
followMouse = false;
|
followMouse = false;
|
||||||
};
|
};
|
||||||
keybindings = {
|
keybindings = {
|
||||||
|
|
||||||
# Adjust screen brightness
|
|
||||||
"Shift+F12" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30";
|
|
||||||
"Shift+F11" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30";
|
|
||||||
"XF86MonBrightnessUp" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30";
|
|
||||||
"XF86MonBrightnessDown" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30";
|
|
||||||
|
|
||||||
# Media player controls
|
|
||||||
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
||||||
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
|
|
||||||
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
|
||||||
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
|
||||||
|
|
||||||
# Launchers
|
|
||||||
"${modifier}+Return" =
|
|
||||||
"exec --no-startup-id kitty; workspace ${ws2}; layout tabbed";
|
|
||||||
"${modifier}+space" =
|
|
||||||
"exec --no-startup-id ${config.launcherCommand}";
|
|
||||||
"${modifier}+Shift+s" =
|
|
||||||
"exec --no-startup-id ${config.systemdSearch}";
|
|
||||||
"${modifier}+Shift+a" =
|
|
||||||
"exec --no-startup-id ${config.audioSwitchCommand}";
|
|
||||||
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
|
|
||||||
"${modifier}+Shift+period" =
|
|
||||||
"exec --no-startup-id ${config.powerCommand}";
|
|
||||||
"${modifier}+Shift+m" =
|
|
||||||
"exec --no-startup-id ${config.brightnessCommand}";
|
|
||||||
"${modifier}+c" =
|
|
||||||
"exec --no-startup-id ${config.calculatorCommand}";
|
|
||||||
"${modifier}+Shift+c" = "reload";
|
|
||||||
"${modifier}+Shift+r" = "restart";
|
|
||||||
"${modifier}+Shift+q" = ''
|
|
||||||
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
|
|
||||||
"${modifier}+Shift+x" = "exec ${lockCmd}";
|
|
||||||
"${modifier}+Mod1+h" =
|
|
||||||
"exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
|
||||||
"${modifier}+Mod1+r" =
|
|
||||||
"exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
|
||||||
|
|
||||||
# Window options
|
|
||||||
"${modifier}+q" = "kill";
|
|
||||||
"${modifier}+b" = "exec ${config.toggleBarCommand}";
|
|
||||||
"${modifier}+f" = "fullscreen toggle";
|
|
||||||
"${modifier}+h" = "focus left";
|
|
||||||
"${modifier}+j" = "focus down";
|
|
||||||
"${modifier}+k" = "focus up";
|
|
||||||
"${modifier}+l" = "focus right";
|
|
||||||
"${modifier}+Left" = "focus left";
|
|
||||||
"${modifier}+Down" = "focus down";
|
|
||||||
"${modifier}+Up" = "focus up";
|
|
||||||
"${modifier}+Right" = "focus right";
|
|
||||||
"${modifier}+Shift+h" = "move left";
|
|
||||||
"${modifier}+Shift+j" = "move down";
|
|
||||||
"${modifier}+Shift+k" = "move up";
|
|
||||||
"${modifier}+Shift+l" = "move right";
|
|
||||||
"${modifier}+Shift+Left" = "move left";
|
|
||||||
"${modifier}+Shift+Down" = "move down";
|
|
||||||
"${modifier}+Shift+Up" = "move up";
|
|
||||||
"${modifier}+Shift+Right" = "move right";
|
|
||||||
|
|
||||||
# Tiling
|
|
||||||
"${modifier}+i" = "split h";
|
|
||||||
"${modifier}+v" = "split v";
|
|
||||||
"${modifier}+s" = "layout stacking";
|
|
||||||
"${modifier}+t" = "layout tabbed";
|
|
||||||
"${modifier}+e" = "layout toggle split";
|
|
||||||
"${modifier}+Shift+space" = "floating toggle";
|
|
||||||
"${modifier}+Control+space" = "focus mode_toggle";
|
|
||||||
"${modifier}+a" = "focus parent";
|
|
||||||
|
|
||||||
# Workspaces
|
|
||||||
"${modifier}+1" = "workspace ${ws1}";
|
|
||||||
"${modifier}+2" = "workspace ${ws2}";
|
|
||||||
"${modifier}+3" = "workspace ${ws3}";
|
|
||||||
"${modifier}+4" = "workspace ${ws4}";
|
|
||||||
"${modifier}+5" = "workspace ${ws5}";
|
|
||||||
"${modifier}+6" = "workspace ${ws6}";
|
|
||||||
"${modifier}+7" = "workspace ${ws7}";
|
|
||||||
"${modifier}+8" = "workspace ${ws8}";
|
|
||||||
"${modifier}+9" = "workspace ${ws9}";
|
|
||||||
"${modifier}+0" = "workspace ${ws10}";
|
|
||||||
|
|
||||||
# Move windows
|
|
||||||
"${modifier}+Shift+1" =
|
|
||||||
"move container to workspace ${ws1}; workspace ${ws1}";
|
|
||||||
"${modifier}+Shift+2" =
|
|
||||||
"move container to workspace ${ws2}; workspace ${ws2}";
|
|
||||||
"${modifier}+Shift+3" =
|
|
||||||
"move container to workspace ${ws3}; workspace ${ws3}";
|
|
||||||
"${modifier}+Shift+4" =
|
|
||||||
"move container to workspace ${ws4}; workspace ${ws4}";
|
|
||||||
"${modifier}+Shift+5" =
|
|
||||||
"move container to workspace ${ws5}; workspace ${ws5}";
|
|
||||||
"${modifier}+Shift+6" =
|
|
||||||
"move container to workspace ${ws6}; workspace ${ws6}";
|
|
||||||
"${modifier}+Shift+7" =
|
|
||||||
"move container to workspace ${ws7}; workspace ${ws7}";
|
|
||||||
"${modifier}+Shift+8" =
|
|
||||||
"move container to workspace ${ws8}; workspace ${ws8}";
|
|
||||||
"${modifier}+Shift+9" =
|
|
||||||
"move container to workspace ${ws9}; workspace ${ws9}";
|
|
||||||
"${modifier}+Shift+0" =
|
|
||||||
"move container to workspace ${ws10}; workspace ${ws10}";
|
|
||||||
|
|
||||||
# Move screens
|
|
||||||
"${modifier}+Control+l" = "move workspace to output right";
|
|
||||||
"${modifier}+Control+h" = "move workspace to output left";
|
|
||||||
|
|
||||||
# Resizing
|
# Resizing
|
||||||
"${modifier}+r" = ''mode "resize"'';
|
"${modifier}+r" = ''mode "resize"'';
|
||||||
"${modifier}+Control+Shift+h" =
|
"${modifier}+Control+Shift+h" =
|
||||||
@ -232,6 +112,7 @@ in {
|
|||||||
notification = false;
|
notification = false;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
terminal = config.terminal;
|
||||||
window = {
|
window = {
|
||||||
border = 0;
|
border = 0;
|
||||||
hideEdgeBorders = "smart";
|
hideEdgeBorders = "smart";
|
||||||
@ -239,22 +120,13 @@ in {
|
|||||||
};
|
};
|
||||||
workspaceAutoBackAndForth = false;
|
workspaceAutoBackAndForth = false;
|
||||||
workspaceOutputAssign = [ ];
|
workspaceOutputAssign = [ ];
|
||||||
# gaps = {
|
|
||||||
# bottom = 8;
|
|
||||||
# top = 8;
|
|
||||||
# left = 8;
|
|
||||||
# right = 8;
|
|
||||||
# horizontal = 15;
|
|
||||||
# vertical = 15;
|
|
||||||
# inner = 15;
|
|
||||||
# outer = 0;
|
|
||||||
# smartBorders = "off";
|
|
||||||
# smartGaps = false;
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
extraConfig = "";
|
extraConfig = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lockScreenCommand =
|
||||||
|
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
||||||
|
|
||||||
programs.fish.functions = {
|
programs.fish.functions = {
|
||||||
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
||||||
description = "Update lockscreen with wallpaper";
|
description = "Update lockscreen with wallpaper";
|
||||||
@ -278,14 +150,14 @@ in {
|
|||||||
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
||||||
systemd.services.lock = {
|
systemd.services.lock = {
|
||||||
enable = config.services.xserver.enable;
|
enable = config.services.xserver.enable;
|
||||||
description = "Lock the screen on resume from suspend";
|
description = "Lock the screen before suspend";
|
||||||
before = [ "sleep.target" "suspend.target" ];
|
before = [ "sleep.target" "suspend.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = config.user;
|
User = config.user;
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
Environment = "DISPLAY=:0";
|
Environment = "DISPLAY=:0";
|
||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
ExecStart = lockCmd;
|
ExecStart = config.lockScreenCommand;
|
||||||
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
|
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
|
||||||
};
|
};
|
||||||
wantedBy = [ "sleep.target" "suspend.target" ];
|
wantedBy = [ "sleep.target" "suspend.target" ];
|
||||||
|
100
modules/nixos/graphical/keybinds.nix
Normal file
100
modules/nixos/graphical/keybinds.nix
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
keybindings =
|
||||||
|
config.home-manager.users.${config.user}.programs.sxhkd.keybindings;
|
||||||
|
|
||||||
|
workspaceBindings = let
|
||||||
|
workspaces = {
|
||||||
|
"1" = "1:I";
|
||||||
|
"2" = "2:II";
|
||||||
|
"3" = "3:III";
|
||||||
|
"4" = "4:IV";
|
||||||
|
"5" = "5:V";
|
||||||
|
"6" = "6:VI";
|
||||||
|
"7" = "7:VII";
|
||||||
|
"8" = "8:VIII";
|
||||||
|
"9" = "9:IX";
|
||||||
|
"0" = "10:X";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create an attrset of keybinds to actions for every workspace by number
|
||||||
|
bindAll = keybindFunction: actionFunction:
|
||||||
|
(lib.genAttrs (map keybindFunction (builtins.attrNames workspaces))
|
||||||
|
actionFunction);
|
||||||
|
|
||||||
|
# Look up the name of the workspace based on its number
|
||||||
|
lookup = num: builtins.getAttr num workspaces;
|
||||||
|
|
||||||
|
in (bindAll (num: "super + ${num}")
|
||||||
|
(num: ''${pkgs.i3}/bin/i3-msg "workspace ${lookup num}"''))
|
||||||
|
// (bindAll (num: "super + shift + ${num}") (num:
|
||||||
|
''
|
||||||
|
${pkgs.i3}/bin/i3-msg "move container to workspace ${
|
||||||
|
lookup num
|
||||||
|
}; workspace ${lookup num}"''));
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
home-manager.users.${config.user}.programs.sxhkd = {
|
||||||
|
enable = true;
|
||||||
|
keybindings = {
|
||||||
|
|
||||||
|
# Adjust screen brightness (TODO: replace with pkgs.light?)
|
||||||
|
"shift + {F11,F12}" = ''
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
|
||||||
|
'';
|
||||||
|
"XF86MonBrightness{Down,Up}" = keybindings."shift + {F11,F12}";
|
||||||
|
|
||||||
|
# Media controls
|
||||||
|
"XF86Audio{Play,Stop,Next,Prev}" =
|
||||||
|
"${pkgs.playerctl}/bin/playerctl {play-pause,stop,next,previous}";
|
||||||
|
|
||||||
|
# Window management
|
||||||
|
"super + q" = ''${pkgs.i3}/bin/i3-msg "kill"'';
|
||||||
|
"super + b" = config.toggleBarCommand;
|
||||||
|
"super + f" = ''${pkgs.i3}/bin/i3-msg "fullscreen toggle"'';
|
||||||
|
"super + {h,j,k,l}" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "focus {left,down,up,right}"'';
|
||||||
|
"super + {Left,Down,Up,Right}" = keybindings."super + {h,j,k,l}";
|
||||||
|
"super + shift + {h,j,k,l}" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "move {left,down,up,right}"'';
|
||||||
|
"super + shift + {Left,Down,Up,Right}" =
|
||||||
|
keybindings."super + shift + {h,j,k,l}";
|
||||||
|
|
||||||
|
# Screen management
|
||||||
|
"super + control + l" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "move workspace to output right"'';
|
||||||
|
"super + control + h" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "move workspace to output left"'';
|
||||||
|
|
||||||
|
# Window layouts and tiling
|
||||||
|
"super + {i,v}" = ''${pkgs.i3}/bin/i3-msg "split {h,v}"'';
|
||||||
|
"super + {s,t,e}" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "layout {stacking,tabbed,toggle split}"'';
|
||||||
|
"super + shift + space" = ''${pkgs.i3}/bin/i3-msg "floating toggle"'';
|
||||||
|
"super + control + space" = ''${pkgs.i3}/bin/i3-msg "focus mode_toggle"'';
|
||||||
|
"super + a" = ''${pkgs.i3}/bin/i3-msg "focus parent"'';
|
||||||
|
|
||||||
|
# Launchers
|
||||||
|
"super + Return" = config.terminal;
|
||||||
|
"super + space" = config.launcherCommand;
|
||||||
|
"super + shift + s" = config.systemdSearch;
|
||||||
|
"super + shift + a" = config.audioSwitchCommand;
|
||||||
|
"alt + Tab" = config.altTabCommand;
|
||||||
|
"super + shift + period" = config.powerCommand;
|
||||||
|
"super + shift + m" = config.brightnessCommand;
|
||||||
|
"super + c" = config.calculatorCommand;
|
||||||
|
"super + shift + {c,r}" = ''${pkgs.i3}/bin/i3-msg "{reload,restart}"'';
|
||||||
|
"super + shift + x" = config.lockScreenCommand;
|
||||||
|
"super + alt + h" =
|
||||||
|
"${config.terminal} sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||||
|
"super + alt + r" =
|
||||||
|
"${config.terminal} sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||||
|
|
||||||
|
} // workspaceBindings;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
config = lib.mkIf config.services.xserver.enable {
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
services.picom = {
|
services.picom = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
config = lib.mkIf config.services.xserver.enable {
|
||||||
|
|
||||||
toggleBarCommand = "polybar-msg cmd toggle";
|
toggleBarCommand = "polybar-msg cmd toggle";
|
||||||
|
|
||||||
|
@ -8,11 +8,10 @@ in {
|
|||||||
|
|
||||||
imports = [ ./rofi/power.nix ./rofi/brightness.nix ];
|
imports = [ ./rofi/power.nix ./rofi/brightness.nix ];
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
config = lib.mkIf config.services.xserver.enable {
|
||||||
|
|
||||||
# Set the Rofi-Systemd terminal for viewing logs
|
# Set the Rofi-Systemd terminal for viewing logs
|
||||||
environment.sessionVariables.ROFI_SYSTEMD_TERM =
|
environment.sessionVariables.ROFI_SYSTEMD_TERM = config.terminal;
|
||||||
lib.mkIf config.kitty.enable "${pkgs.kitty}/bin/kitty";
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
@ -24,6 +23,13 @@ in {
|
|||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cycle = true;
|
cycle = true;
|
||||||
|
extraConfig = {
|
||||||
|
show-icons = true;
|
||||||
|
kb-cancel = "Escape,Super+space";
|
||||||
|
modi = "window,run,ssh,emoji,calc,systemd";
|
||||||
|
sort = true;
|
||||||
|
# levenshtein-sort = true;
|
||||||
|
};
|
||||||
location = "center";
|
location = "center";
|
||||||
pass = { };
|
pass = { };
|
||||||
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-systemd ];
|
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-systemd ];
|
||||||
@ -143,15 +149,9 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
terminal = config.terminal;
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
yoffset = -20;
|
yoffset = -20;
|
||||||
extraConfig = {
|
|
||||||
show-icons = true;
|
|
||||||
kb-cancel = "Escape,Super+space";
|
|
||||||
modi = "window,run,ssh,emoji,calc,systemd";
|
|
||||||
sort = true;
|
|
||||||
# levenshtein-sort = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".local/share/rofi/themes" = {
|
home.file.".local/share/rofi/themes" = {
|
||||||
|
0
modules/nixos/graphical/rofi/brightness.nix
Executable file → Normal file
0
modules/nixos/graphical/rofi/brightness.nix
Executable file → Normal file
2
modules/nixos/graphical/rofi/power.nix
Executable file → Normal file
2
modules/nixos/graphical/rofi/power.nix
Executable file → Normal file
@ -25,7 +25,7 @@ in {
|
|||||||
| ${rofi}/bin/rofi \
|
| ${rofi}/bin/rofi \
|
||||||
-theme-str '@import "power.rasi"' \
|
-theme-str '@import "power.rasi"' \
|
||||||
-hover-select \
|
-hover-select \
|
||||||
-me-select-entry ''' \
|
-me-select-entry "" \
|
||||||
-me-accept-entry MousePrimary \
|
-me-accept-entry MousePrimary \
|
||||||
-dmenu \
|
-dmenu \
|
||||||
-sep ';' \
|
-sep ';' \
|
||||||
|
@ -32,7 +32,7 @@ done
|
|||||||
chosen=$(printf '%s;%s\n' "$yes" "$no" |
|
chosen=$(printf '%s;%s\n' "$yes" "$no" |
|
||||||
rofi -theme-str '@import "prompt.rasi"' \
|
rofi -theme-str '@import "prompt.rasi"' \
|
||||||
-hover-select \
|
-hover-select \
|
||||||
-me-select-entry '' \
|
-me-select-entry "" \
|
||||||
-me-accept-entry MousePrimary \
|
-me-accept-entry MousePrimary \
|
||||||
-p "$query" \
|
-p "$query" \
|
||||||
-dmenu \
|
-dmenu \
|
||||||
|
25
modules/nixos/graphical/sway.nix
Normal file
25
modules/nixos/graphical/sway.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
|
config = lib.mkIf config.gui.enable {
|
||||||
|
|
||||||
|
programs.sway = {
|
||||||
|
enable = true;
|
||||||
|
package = null; # Use home-manager Sway instead
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
wayland.windowManager.sway = {
|
||||||
|
enable = true;
|
||||||
|
config =
|
||||||
|
config.home-manager.users.${config.user}.xsession.windowManager.i3.config;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: swaybg
|
||||||
|
# TODO: swaylock
|
||||||
|
|
||||||
|
}
|
@ -36,9 +36,6 @@
|
|||||||
enable = config.services.xserver.enable;
|
enable = config.services.xserver.enable;
|
||||||
background = config.wallpaper;
|
background = config.wallpaper;
|
||||||
|
|
||||||
# Make the login screen dark
|
|
||||||
greeters.gtk.theme = gtkTheme;
|
|
||||||
|
|
||||||
# Show default user
|
# Show default user
|
||||||
# Also make sure /var/lib/AccountsService/users/<user> has SystemAccount=false
|
# Also make sure /var/lib/AccountsService/users/<user> has SystemAccount=false
|
||||||
extraSeatDefaults = ''
|
extraSeatDefaults = ''
|
||||||
@ -59,8 +56,6 @@
|
|||||||
services.dbus.packages = [ pkgs.dconf ];
|
services.dbus.packages = [ pkgs.dconf ];
|
||||||
programs.dconf.enable = true;
|
programs.dconf.enable = true;
|
||||||
|
|
||||||
environment.sessionVariables = { GTK_THEME = config.gtk.theme.name; };
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
programs.fish.shellAliases = {
|
programs.fish.shellAliases = {
|
||||||
@ -68,17 +63,6 @@
|
|||||||
pbpaste = "xclip -selection clipboard -out";
|
pbpaste = "xclip -selection clipboard -out";
|
||||||
};
|
};
|
||||||
|
|
||||||
gtk = let
|
|
||||||
gtkExtraConfig = {
|
|
||||||
gtk-application-prefer-dark-theme = config.theme.dark;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
enable = true;
|
|
||||||
theme = gtkTheme;
|
|
||||||
gtk3.extraConfig = gtkExtraConfig;
|
|
||||||
gtk4.extraConfig = gtkExtraConfig;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user