mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 08:00:14 +00:00
move nixos and darwin back into modules dir
This commit is contained in:
31
modules/nixos/graphical/default.nix
Normal file
31
modules/nixos/graphical/default.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{ lib, ... }: {
|
||||
|
||||
imports =
|
||||
[ ./xorg.nix ./fonts.nix ./i3.nix ./polybar.nix ./picom.nix ./rofi.nix ];
|
||||
|
||||
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 {
|
||||
type = lib.types.str;
|
||||
description = "Command to use for choosing windows";
|
||||
};
|
||||
toggleBarCommand = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Command to hide and show the status bar.";
|
||||
};
|
||||
wallpaper = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Wallpaper background image file";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
14
modules/nixos/graphical/dmenu.nix
Normal file
14
modules/nixos/graphical/dmenu.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
options.gui.dmenu.enable = lib.mkEnableOption "dmenu launcher.";
|
||||
|
||||
config = lib.mkIf (config.services.xserver.enable && config.dmenu.enable) {
|
||||
|
||||
home-manager.users.${config.user}.home.packages = [ pkgs.dmenu ];
|
||||
gui.launcherCommand = "${pkgs.dmenu}/bin/dmenu_run";
|
||||
|
||||
};
|
||||
|
||||
}
|
29
modules/nixos/graphical/fonts.nix
Normal file
29
modules/nixos/graphical/fonts.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let fontName = "Victor Mono";
|
||||
|
||||
in {
|
||||
|
||||
config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) {
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
victor-mono # Used for Vim and Terminal
|
||||
(nerdfonts.override { fonts = [ "Hack" ]; }) # For Polybar, Rofi
|
||||
];
|
||||
fonts.fontconfig.defaultFonts.monospace = [ fontName ];
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
xsession.windowManager.i3.config.fonts = {
|
||||
names = [ "pango:${fontName}" ];
|
||||
# style = "Regular";
|
||||
# size = 11.0;
|
||||
};
|
||||
services.polybar.config."bar/main".font-0 = "Hack Nerd Font:size=10;2";
|
||||
programs.rofi.font = "Hack Nerd Font 14";
|
||||
programs.alacritty.settings.font.normal.family = fontName;
|
||||
programs.kitty.font.name = fontName;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
280
modules/nixos/graphical/i3.nix
Normal file
280
modules/nixos/graphical/i3.nix
Normal file
@ -0,0 +1,280 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
lockCmd =
|
||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
||||
lockUpdate =
|
||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
||||
|
||||
in {
|
||||
|
||||
config = lib.mkIf pkgs.stdenv.isLinux {
|
||||
|
||||
services.xserver.windowManager = {
|
||||
i3 = { enable = config.services.xserver.enable; };
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
feh # Wallpaper
|
||||
playerctl # Media control
|
||||
];
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
xsession.windowManager.i3 = {
|
||||
enable = config.services.xserver.enable;
|
||||
config = let
|
||||
modifier = "Mod4"; # Super key
|
||||
ws1 = "1:I";
|
||||
ws2 = "2:II";
|
||||
ws3 = "3:III";
|
||||
ws4 = "4:IV";
|
||||
ws5 = "5:V";
|
||||
ws6 = "6:VI";
|
||||
ws7 = "7:VII";
|
||||
ws8 = "8:VIII";
|
||||
ws9 = "9:IX";
|
||||
ws10 = "10:X";
|
||||
in {
|
||||
modifier = modifier;
|
||||
assigns = {
|
||||
"${ws1}" = [{ class = "Firefox"; }];
|
||||
"${ws2}" = [{ class = "kitty"; }];
|
||||
"${ws3}" = [{ class = "discord"; }];
|
||||
"${ws4}" = [{ class = "Steam"; }];
|
||||
};
|
||||
bars = [{ command = "echo"; }]; # Disable i3bar
|
||||
colors = let
|
||||
background = config.theme.colors.base00;
|
||||
inactiveBackground = config.theme.colors.base01;
|
||||
border = config.theme.colors.base01;
|
||||
inactiveBorder = config.theme.colors.base01;
|
||||
text = config.theme.colors.base07;
|
||||
inactiveText = config.theme.colors.base04;
|
||||
urgentBackground = config.theme.colors.base08;
|
||||
indicator = "#00000000";
|
||||
in {
|
||||
background = config.theme.colors.base00;
|
||||
focused = {
|
||||
inherit background indicator text border;
|
||||
childBorder = background;
|
||||
};
|
||||
focusedInactive = {
|
||||
inherit indicator;
|
||||
background = inactiveBackground;
|
||||
border = inactiveBorder;
|
||||
childBorder = inactiveBackground;
|
||||
text = inactiveText;
|
||||
};
|
||||
# placeholder = { };
|
||||
unfocused = {
|
||||
inherit indicator;
|
||||
background = inactiveBackground;
|
||||
border = inactiveBorder;
|
||||
childBorder = inactiveBackground;
|
||||
text = inactiveText;
|
||||
};
|
||||
urgent = {
|
||||
inherit text indicator;
|
||||
background = urgentBackground;
|
||||
border = urgentBackground;
|
||||
childBorder = urgentBackground;
|
||||
};
|
||||
};
|
||||
floating.modifier = modifier;
|
||||
focus = {
|
||||
mouseWarping = true;
|
||||
newWindow = "urgent";
|
||||
followMouse = false;
|
||||
};
|
||||
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}";
|
||||
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
|
||||
"${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}";
|
||||
|
||||
# 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
|
||||
"${modifier}+r" = ''mode "resize"'';
|
||||
"${modifier}+Control+Shift+h" =
|
||||
"resize shrink width 10 px or 10 ppt";
|
||||
"${modifier}+Control+Shift+j" =
|
||||
"resize grow height 10 px or 10 ppt";
|
||||
"${modifier}+Control+Shift+k" =
|
||||
"resize shrink height 10 px or 10 ppt";
|
||||
"${modifier}+Control+Shift+l" = "resize grow width 10 px or 10 ppt";
|
||||
};
|
||||
modes = { };
|
||||
startup = [
|
||||
{
|
||||
command = "feh --bg-fill ${config.wallpaper}";
|
||||
always = true;
|
||||
notification = false;
|
||||
}
|
||||
{
|
||||
command =
|
||||
"i3-msg workspace ${ws2}, move workspace to output right";
|
||||
notification = false;
|
||||
}
|
||||
{
|
||||
command =
|
||||
"i3-msg workspace ${ws1}, move workspace to output left";
|
||||
notification = false;
|
||||
}
|
||||
];
|
||||
window = {
|
||||
border = 0;
|
||||
hideEdgeBorders = "smart";
|
||||
titlebar = false;
|
||||
};
|
||||
workspaceAutoBackAndForth = false;
|
||||
workspaceOutputAssign = [ ];
|
||||
# gaps = {
|
||||
# bottom = 8;
|
||||
# top = 8;
|
||||
# left = 8;
|
||||
# right = 8;
|
||||
# horizontal = 15;
|
||||
# vertical = 15;
|
||||
# inner = 15;
|
||||
# outer = 0;
|
||||
# smartBorders = "off";
|
||||
# smartGaps = false;
|
||||
# };
|
||||
};
|
||||
extraConfig = "";
|
||||
};
|
||||
|
||||
programs.fish.functions = {
|
||||
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
||||
description = "Update lockscreen with wallpaper";
|
||||
body = lockUpdate;
|
||||
};
|
||||
};
|
||||
|
||||
# Update lock screen cache only if cache is empty
|
||||
home.activation.updateLockScreenCache =
|
||||
let cacheDir = "${config.homePath}/.cache/betterlockscreen/current";
|
||||
in lib.mkIf config.services.xserver.enable
|
||||
(config.home-manager.users.${config.user}.lib.dag.entryAfter
|
||||
[ "writeBoundary" ] ''
|
||||
if [ ! -d ${cacheDir} ] || [ -z "$(ls ${cacheDir})" ]; then
|
||||
$DRY_RUN_CMD ${lockUpdate}
|
||||
fi
|
||||
'');
|
||||
|
||||
};
|
||||
|
||||
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
||||
systemd.services.lock = {
|
||||
enable = config.services.xserver.enable;
|
||||
description = "Lock the screen on resume from suspend";
|
||||
before = [ "sleep.target" "suspend.target" ];
|
||||
serviceConfig = {
|
||||
User = config.user;
|
||||
Type = "simple";
|
||||
Environment = "DISPLAY=:0";
|
||||
TimeoutSec = "infinity";
|
||||
ExecStart = lockCmd;
|
||||
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
|
||||
};
|
||||
wantedBy = [ "sleep.target" "suspend.target" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
48
modules/nixos/graphical/picom.nix
Normal file
48
modules/nixos/graphical/picom.nix
Normal file
@ -0,0 +1,48 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
services.picom = {
|
||||
enable = true;
|
||||
backend = "glx";
|
||||
settings = {
|
||||
blur = false;
|
||||
blurExclude = [ ];
|
||||
inactiveDim = "0.05";
|
||||
noDNDShadow = false;
|
||||
noDockShadow = false;
|
||||
# shadow-radius = 20
|
||||
# '';
|
||||
# shadow-radius = 20
|
||||
# corner-radius = 10
|
||||
# blur-size = 20
|
||||
# rounded-corners-exclude = [
|
||||
# "window_type = 'dock'",
|
||||
# "class_g = 'i3-frame'"
|
||||
# ]
|
||||
# '';
|
||||
};
|
||||
fade = false;
|
||||
inactiveOpacity = 1.0;
|
||||
menuOpacity = 1.0;
|
||||
opacityRules = [
|
||||
"0:_NET_WM_STATE@[0]:32a = '_NET_WM_STATE_HIDDEN'" # Hide tabbed windows
|
||||
];
|
||||
shadow = false;
|
||||
shadowExclude = [ ];
|
||||
shadowOffsets = [ (-10) (-10) ];
|
||||
shadowOpacity = 0.5;
|
||||
vSync = true;
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [{
|
||||
command = "systemctl --user restart picom";
|
||||
always = true;
|
||||
notification = false;
|
||||
}];
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
185
modules/nixos/graphical/polybar.nix
Normal file
185
modules/nixos/graphical/polybar.nix
Normal file
@ -0,0 +1,185 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
|
||||
toggleBarCommand = "polybar-msg cmd toggle";
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
services.polybar = {
|
||||
enable = true;
|
||||
package = pkgs.polybar.override {
|
||||
pulseSupport = true;
|
||||
githubSupport = true;
|
||||
i3Support = true;
|
||||
};
|
||||
script = "polybar &";
|
||||
config = {
|
||||
"bar/main" = {
|
||||
bottom = false;
|
||||
width = "100%";
|
||||
height = "22pt";
|
||||
radius = 0;
|
||||
# offset-y = -5;
|
||||
# offset-y = "5%";
|
||||
# dpi = 96;
|
||||
background = config.theme.colors.base01;
|
||||
foreground = config.theme.colors.base05;
|
||||
line-size = "3pt";
|
||||
border-top-size = 0;
|
||||
border-right-size = 0;
|
||||
border-left-size = 0;
|
||||
border-bottom-size = "4pt";
|
||||
border-color = config.theme.colors.base00;
|
||||
padding-left = 2;
|
||||
padding-right = 2;
|
||||
module-margin = 1;
|
||||
modules-left = "i3";
|
||||
modules-center = "xwindow";
|
||||
modules-right = "pulseaudio date";
|
||||
cursor-click = "pointer";
|
||||
cursor-scroll = "ns-resize";
|
||||
enable-ipc = true;
|
||||
tray-position = "right";
|
||||
# wm-restack = "generic";
|
||||
# wm-restack = "bspwm";
|
||||
# wm-restack = "i3";
|
||||
# override-redirect = true;
|
||||
};
|
||||
"module/i3" = let padding = 2;
|
||||
in {
|
||||
type = "internal/i3";
|
||||
pin-workspaces = false;
|
||||
show-urgent = true;
|
||||
strip-wsnumbers = true;
|
||||
index-sort = true;
|
||||
enable-click = true;
|
||||
wrapping-scroll = true;
|
||||
fuzzy-match = true;
|
||||
format = "<label-state> <label-mode>";
|
||||
label-focused = "%name%";
|
||||
label-focused-foreground = config.theme.colors.base01;
|
||||
label-focused-background = config.theme.colors.base05;
|
||||
label-focused-underline = config.theme.colors.base03;
|
||||
label-focused-padding = padding;
|
||||
label-unfocused = "%name%";
|
||||
label-unfocused-padding = padding;
|
||||
label-visible = "%name%";
|
||||
label-visible-underline = config.theme.colors.base01;
|
||||
label-visible-padding = padding;
|
||||
label-urgent = "%name%";
|
||||
label-urgent-foreground = config.theme.colors.base00;
|
||||
label-urgent-background = config.theme.colors.base08;
|
||||
label-urgent-underline = config.theme.colors.base0F;
|
||||
label-urgent-padding = padding;
|
||||
};
|
||||
"module/xworkspaces" = {
|
||||
type = "internal/xworkspaces";
|
||||
label-active = "%name%";
|
||||
label-active-background = config.theme.colors.base05;
|
||||
label-active-foreground = config.theme.colors.base01;
|
||||
label-active-underline = config.theme.colors.base03;
|
||||
label-active-padding = 1;
|
||||
label-occupied = "%name%";
|
||||
label-occupied-padding = 1;
|
||||
label-urgent = "%name%";
|
||||
label-urgent-background = config.theme.colors.base08;
|
||||
label-urgent-padding = 1;
|
||||
label-empty = "%name%";
|
||||
label-empty-foreground = config.theme.colors.base06;
|
||||
label-empty-padding = 1;
|
||||
};
|
||||
"module/xwindow" = {
|
||||
type = "internal/xwindow";
|
||||
label = "%title:0:60:...%";
|
||||
};
|
||||
# "module/filesystem" = {
|
||||
# type = "internal/fs";
|
||||
# interval = 25;
|
||||
# mount-0 = "/";
|
||||
# label-mounted = "%{F#F0C674}%mountpoint%%{F-} %percentage_used%%";
|
||||
# label-unmounted = "%mountpoint% not mounted";
|
||||
# label-unmounted-foreground = colors.disabled;
|
||||
# };
|
||||
"module/pulseaudio" = {
|
||||
type = "internal/pulseaudio";
|
||||
# format-volume-prefix = "VOL ";
|
||||
# format-volume-prefix-foreground = colors.primary;
|
||||
format-volume = "<ramp-volume> <label-volume>";
|
||||
# format-volume-background = colors.background;
|
||||
# label-volume-background = colors.background;
|
||||
format-volume-foreground = config.theme.colors.base0B;
|
||||
label-volume = "%percentage%%";
|
||||
label-muted = "ﱝ ---";
|
||||
label-muted-foreground = config.theme.colors.base03;
|
||||
ramp-volume-0 = "";
|
||||
ramp-volume-1 = "墳";
|
||||
ramp-volume-2 = "";
|
||||
};
|
||||
# "module/xkeyboard" = {
|
||||
# type = "internal/xkeyboard";
|
||||
# blacklist-0 = "num lock";
|
||||
# label-layout = "%layout%";
|
||||
# label-layout-foreground = colors.primary;
|
||||
# label-indicator-padding = 2;
|
||||
# label-indicator-margin = 1;
|
||||
# label-indicator-foreground = colors.background;
|
||||
# label-indicator-background = colors.secondary;
|
||||
# };
|
||||
# "module/memory" = {
|
||||
# type = "internal/memory";
|
||||
# interval = 2;
|
||||
# format-prefix = "RAM ";
|
||||
# format-prefix-foreground = colors.primary;
|
||||
# label = "%percentage_used:2%%";
|
||||
# };
|
||||
# "module/cpu" = {
|
||||
# type = "internal/cpu";
|
||||
# interval = 2;
|
||||
# format-prefix = "CPU ";
|
||||
# format-prefix-foreground = colors.primary;
|
||||
# label = "%percentage:2%%";
|
||||
# };
|
||||
# "network-base" = {
|
||||
# type = "internal/network";
|
||||
# interval = 5;
|
||||
# format-connected = "<label-connected>";
|
||||
# format-disconnected = "<label-disconnected>";
|
||||
# label-disconnected = "%{F#F0C674}%ifname%%{F#707880} disconnected";
|
||||
# };
|
||||
# "module/wlan" = {
|
||||
# "inherit" = "network-base";
|
||||
# interface-type = "wireless";
|
||||
# label-connected = "%{F#F0C674}%ifname%%{F-} %essid% %local_ip%";
|
||||
# };
|
||||
# "module/eth" = {
|
||||
# "inherit" = "network-base";
|
||||
# interface-type = "wired";
|
||||
# label-connected = "%{F#F0C674}%ifname%%{F-} %local_ip%";
|
||||
# };
|
||||
"module/date" = {
|
||||
type = "internal/date";
|
||||
interval = 1;
|
||||
date = "%d %b %l:%M %p";
|
||||
date-alt = "%Y-%m-%d %H:%M:%S";
|
||||
label = "%date%";
|
||||
label-foreground = config.theme.colors.base0A;
|
||||
# format-background = colors.background;
|
||||
};
|
||||
"settings" = {
|
||||
screenchange-reload = true;
|
||||
pseudo-transparency = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [{
|
||||
command = "systemctl --user restart polybar";
|
||||
always = true;
|
||||
notification = false;
|
||||
}];
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
153
modules/nixos/graphical/rofi.nix
Normal file
153
modules/nixos/graphical/rofi.nix
Normal file
@ -0,0 +1,153 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
jq # Required for rofi-systemd
|
||||
];
|
||||
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
cycle = true;
|
||||
location = "center";
|
||||
pass = { };
|
||||
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-systemd ];
|
||||
theme = let
|
||||
inherit (config.home-manager.users.${config.user}.lib.formats.rasi)
|
||||
mkLiteral;
|
||||
in {
|
||||
|
||||
# Inspired by https://github.com/sherubthakur/dotfiles/blob/master/users/modules/desktop-environment/rofi/launcher.rasi
|
||||
|
||||
"*" = {
|
||||
background-color = mkLiteral config.theme.colors.base00;
|
||||
foreground-color = mkLiteral config.theme.colors.base07;
|
||||
text-color = mkLiteral config.theme.colors.base07;
|
||||
border-color = mkLiteral config.theme.colors.base04;
|
||||
};
|
||||
|
||||
# Holds the entire window
|
||||
"#window" = {
|
||||
transparency = "real";
|
||||
background-color = mkLiteral config.theme.colors.base00;
|
||||
text-color = mkLiteral config.theme.colors.base07;
|
||||
border = mkLiteral "4px";
|
||||
border-color = mkLiteral config.theme.colors.base04;
|
||||
border-radius = mkLiteral "4px";
|
||||
width = mkLiteral "850px";
|
||||
padding = mkLiteral "15px";
|
||||
};
|
||||
|
||||
# Wrapper around bar and results
|
||||
"#mainbox" = {
|
||||
background-color = mkLiteral config.theme.colors.base00;
|
||||
border = mkLiteral "0px";
|
||||
border-radius = mkLiteral "0px";
|
||||
border-color = mkLiteral config.theme.colors.base04;
|
||||
children = map mkLiteral [ "inputbar" "listview" ];
|
||||
spacing = mkLiteral "10px";
|
||||
padding = mkLiteral "10px";
|
||||
};
|
||||
|
||||
# Unknown
|
||||
"#textbox-prompt-colon" = {
|
||||
expand = false;
|
||||
str = ":";
|
||||
margin = mkLiteral "0px 0.3em 0em 0em";
|
||||
text-color = mkLiteral config.theme.colors.base07;
|
||||
};
|
||||
|
||||
# Command prompt left of the input
|
||||
"#prompt" = { enabled = false; };
|
||||
|
||||
# Actual text box
|
||||
"#entry" = {
|
||||
placeholder-color = mkLiteral config.theme.colors.base03;
|
||||
expand = true;
|
||||
horizontal-align = "0";
|
||||
placeholder = "Launch Program";
|
||||
padding = mkLiteral "0px 0px 0px 5px";
|
||||
blink = true;
|
||||
};
|
||||
|
||||
# Top bar
|
||||
"#inputbar" = {
|
||||
children = map mkLiteral [ "prompt" "entry" ];
|
||||
border = mkLiteral "1px";
|
||||
border-radius = mkLiteral "4px";
|
||||
padding = mkLiteral "6px";
|
||||
};
|
||||
|
||||
# Results
|
||||
"#listview" = {
|
||||
background-color = mkLiteral config.theme.colors.base00;
|
||||
padding = mkLiteral "0px";
|
||||
columns = 1;
|
||||
lines = 12;
|
||||
spacing = "5px";
|
||||
cycle = true;
|
||||
dynamic = true;
|
||||
layout = "vertical";
|
||||
};
|
||||
|
||||
# Each result
|
||||
"#element" = {
|
||||
orientation = "vertical";
|
||||
border-radius = mkLiteral "0px";
|
||||
padding = mkLiteral "5px 0px 5px 5px";
|
||||
};
|
||||
"#element.selected" = {
|
||||
border = mkLiteral "1px";
|
||||
border-radius = mkLiteral "4px";
|
||||
border-color = mkLiteral config.theme.colors.base07;
|
||||
background-color = mkLiteral config.theme.colors.base04;
|
||||
text-color = mkLiteral config.theme.colors.base00;
|
||||
};
|
||||
|
||||
"#element-text" = {
|
||||
expand = true;
|
||||
# horizontal-align = mkLiteral "0.5";
|
||||
vertical-align = mkLiteral "0.5";
|
||||
margin = mkLiteral "0px 2.5px 0px 2.5px";
|
||||
};
|
||||
"#element-text.selected" = {
|
||||
background-color = mkLiteral config.theme.colors.base04;
|
||||
text-color = mkLiteral config.theme.colors.base00;
|
||||
};
|
||||
|
||||
# Not sure how to get icons
|
||||
"#element-icon" = {
|
||||
size = mkLiteral "18px";
|
||||
border = mkLiteral "0px";
|
||||
padding = mkLiteral "2px 5px 2px 2px";
|
||||
background-color = mkLiteral config.theme.colors.base00;
|
||||
};
|
||||
"#element-icon.selected" = {
|
||||
background-color = mkLiteral config.theme.colors.base04;
|
||||
text-color = mkLiteral config.theme.colors.base00;
|
||||
};
|
||||
|
||||
};
|
||||
xoffset = 0;
|
||||
yoffset = -20;
|
||||
extraConfig = {
|
||||
show-icons = true;
|
||||
kb-cancel = "Escape,Super+space";
|
||||
modi = "window,run,ssh,emoji,calc,systemd";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
launcherCommand = "${pkgs.rofi}/bin/rofi -show run -modi run";
|
||||
systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd";
|
||||
altTabCommand = "${pkgs.rofi}/bin/rofi -show window -modi window";
|
||||
|
||||
};
|
||||
|
||||
}
|
10
modules/nixos/graphical/rofi/brightness.sh
Executable file
10
modules/nixos/graphical/rofi/brightness.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# THEME="$HOME/.config/rofi/config.rasi"
|
||||
|
||||
ICON_UP=""
|
||||
ICON_DOWN=""
|
||||
ICON_OPT=""
|
||||
options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN"
|
||||
chosen="$(echo -e "$options" | rofi -theme-str 'listview { layout:horizontal; }' -dmenu)"
|
||||
echo "$chosen"
|
85
modules/nixos/graphical/xorg.nix
Normal file
85
modules/nixos/graphical/xorg.nix
Normal file
@ -0,0 +1,85 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
|
||||
options = {
|
||||
gtk.theme = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Theme name for GTK applications";
|
||||
};
|
||||
package = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Theme package name for GTK applications";
|
||||
default = "gnome-themes-extra";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
|
||||
gtkTheme = {
|
||||
name = config.gtk.theme.name;
|
||||
package = pkgs."${config.gtk.theme.package}";
|
||||
};
|
||||
|
||||
in lib.mkIf config.gui.enable {
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver = {
|
||||
enable = config.gui.enable;
|
||||
|
||||
# Enable touchpad support
|
||||
libinput.enable = true;
|
||||
|
||||
# Login screen
|
||||
displayManager = {
|
||||
lightdm = {
|
||||
enable = config.services.xserver.enable;
|
||||
background = config.wallpaper;
|
||||
|
||||
# Make the login screen dark
|
||||
greeters.gtk.theme = gtkTheme;
|
||||
|
||||
# Show default user
|
||||
extraSeatDefaults = ''
|
||||
greeter-hide-users = false
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs;
|
||||
[
|
||||
xclip # Clipboard
|
||||
];
|
||||
|
||||
# Required for setting GTK theme (for preferred-color-scheme in browser)
|
||||
services.dbus.packages = [ pkgs.dconf ];
|
||||
programs.dconf.enable = true;
|
||||
|
||||
environment.sessionVariables = { GTK_THEME = config.gtk.theme.name; };
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
programs.fish.shellAliases = {
|
||||
pbcopy = "xclip -selection clipboard -in";
|
||||
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;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user