feat(home): Disable nixGL

This commit is contained in:
punkfairie 2025-01-06 20:29:08 -08:00
parent fefab6e9f4
commit 86259e05db
No known key found for this signature in database
GPG key ID: B3C5488E9A1A7CA6
4 changed files with 444 additions and 429 deletions

View file

@ -3,7 +3,6 @@
in {
marleyos = {
isDesktop = true;
nixGL = enabled;
appearance = {
base = enabled;

View file

@ -14,7 +14,7 @@ in {
config = mkIf (cfg.enable && hasXorg) {
services.picom = {
enable = true;
package = config.lib.nixGL.wrap pkgs.picom;
package = mkIf config.marleyos.nixGL.enable (config.lib.nixGL.wrap pkgs.picom);
};
# The module config options are a nightmare.

View file

@ -3,8 +3,7 @@
config,
pkgs,
...
}:
let
}: let
inherit (lib) mkEnableOption mkIf getExe;
cfg = config.marleyos.services.polybar;
@ -12,16 +11,16 @@ let
xrandr = getExe pkgs.xorg.xrandr;
grep = getExe pkgs.gnugrep;
cut = "${pkgs.coreutils}/bin/cut";
in
{
in {
options.marleyos.services.polybar.enable = mkEnableOption "polybar";
config = mkIf (cfg.enable && hasXorg) {
services.polybar = {
enable = true;
package = config.lib.nixGL.wrap pkgs.polybar;
package = mkIf config.marleyos.nixGL.enable (config.lib.nixGL.wrap pkgs.polybar);
script = # bash
script =
# bash
''
for m in $(${xrandr} --query | ${grep} " connected" | ${cut} -d" " -f1); do
bar="main"
@ -36,385 +35,398 @@ in
# colorblock theme from
# https://github.com/adi1090x/polybar-themes
settings =
let
color = rec {
background = "#26232f";
foreground = background;
foreground-alt = "#c8c8cb";
alpha = "#00000000";
shade1 = "#d6adb5";
shade2 = "#d7bdc3";
dark = "#0a0a0a";
};
settings = let
color = rec {
background = "#26232f";
foreground = background;
foreground-alt = "#c8c8cb";
alpha = "#00000000";
shade1 = "#d6adb5";
shade2 = "#d7bdc3";
dark = "#0a0a0a";
};
fmt = {
prefix.font = 2;
padding = 2;
};
pref = {
font = 2;
fmt = {
prefix.font = 2;
padding = 2;
};
pref = {
font = 2;
padding = 2;
};
hasRofi = config.marleyos.programs.rofi.enable;
cfgHome = config.xdg.configHome;
in {
# Global Settings - - - - - - - - - - - - - - - - - - - - - - - - - -
"settings" = {
screenchange.reload = true;
compositing = {
background = "source";
foreground = "over";
overline = "over";
underline = "over";
border = "over";
};
pseudo.transparency = false;
};
"global/wm" = {
margin.bottom = 0;
};
# Bars - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"bar/main" = {
monitor.text = "\${env:MONITOR:}";
monitor.strict = false;
override.redirect = true;
bottom = false;
fixed.center = true;
width = "99%";
height = 40;
offset.x = "0.5%";
offset.y = "1%";
background = color.alpha;
inherit (color) foreground;
radius.top = 0.0;
radius.bottom = 0.0;
underline.size = 2;
underline.color = color.foreground;
border.size = 0;
border.color = color.background;
padding = 0;
module.margin.left = 0;
module.margin.right = 0;
font = let
mkFt = s: "Maple Mono NF:pixelsize=${toString s};4";
in [
(mkFt 10)
(mkFt 15)
];
modules.left = "launcher sep workspaces sep title sep mpd";
modules.right = "filesystem sep cpu memory pulseaudio network date sep sysmenu";
dim.value = 1.0;
wm.restack = "i3";
enable.ipc = true;
scroll.up = "i3-msg workspace next_on_output";
scroll.down = "i3-msg workspace prev_on_output";
};
"bar/tray" = {
"inherit" = "bar/main";
modules.right = "tray sep filesystem sep cpu memory pulseaudio network date sep sysmenu";
};
# Modules - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"module/sep" = {
type = "custom/text";
format = " ";
content.background = color.alpha;
content-foreground = color.alpha;
};
"module/launcher" = {
type = "custom/text";
content = {
text = "";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
click.left = mkIf hasRofi "${cfgHome}/rofi/launchers/type-1/launcher.sh &";
click.right = mkIf hasRofi "${cfgHome}/rofi/applets/bin/screenshot.sh &";
};
hasRofi = config.marleyos.programs.rofi.enable;
cfgHome = config.xdg.configHome;
in
{
# Global Settings - - - - - - - - - - - - - - - - - - - - - - - - - -
"settings" = {
screenchange.reload = true;
compositing = {
background = "source";
foreground = "over";
overline = "over";
underline = "over";
border = "over";
};
pseudo.transparency = false;
};
"global/wm" = {
margin.bottom = 0;
};
# Bars - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"bar/main" = {
monitor.text = "\${env:MONITOR:}";
monitor.strict = false;
override.redirect = true;
bottom = false;
fixed.center = true;
width = "99%";
height = 40;
offset.x = "0.5%";
offset.y = "1%";
background = color.alpha;
"module/workspaces" = {
type = "internal/xworkspaces";
pin.workspaces = true;
enable.click = true;
enable.scroll = true;
icon.text = [
"1;1"
"2;2"
"3;3"
"4;4"
"5;5"
"6;6"
"7;7"
"8;8"
"9;9"
"10;10"
];
icon.default = 0;
format = {
text = "<label-state>";
inherit (color) background;
inherit (color) foreground;
radius.top = 0.0;
radius.bottom = 0.0;
underline.size = 2;
underline.color = color.foreground;
border.size = 0;
border.color = color.background;
padding = 0;
module.margin.left = 0;
module.margin.right = 0;
font =
let
mkFt = s: "Maple Mono NF:pixelsize=${toString s};4";
in
[
(mkFt 10)
(mkFt 15)
];
modules.left = "launcher sep workspaces sep title sep mpd";
modules.right = "filesystem sep cpu memory pulseaudio network date sep sysmenu";
dim.value = 1.0;
wm.restack = "i3";
enable.ipc = true;
scroll.up = "i3-msg workspace next_on_output";
scroll.down = "i3-msg workspace prev_on_output";
};
"bar/tray" = {
"inherit" = "bar/main";
modules.right = "tray sep filesystem sep cpu memory pulseaudio network date sep sysmenu";
};
# Modules - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"module/sep" = {
type = "custom/text";
format = " ";
content.background = color.alpha;
content-foreground = color.alpha;
};
"module/launcher" = {
type = "custom/text";
content = {
text = "";
label = {
monitor = "%name%";
active = {
text = "%icon%";
background = color.shade2;
foreground = color.dark;
padding = 2;
};
occupied = {
text = "%icon%";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
click.left = mkIf hasRofi "${cfgHome}/rofi/launchers/type-1/launcher.sh &";
click.right = mkIf hasRofi "${cfgHome}/rofi/applets/bin/screenshot.sh &";
};
"module/workspaces" = {
type = "internal/xworkspaces";
pin.workspaces = true;
enable.click = true;
enable.scroll = true;
icon.text = [
"1;1"
"2;2"
"3;3"
"4;4"
"5;5"
"6;6"
"7;7"
"8;8"
"9;9"
"10;10"
];
icon.default = 0;
format = {
text = "<label-state>";
urgent = {
text = "%icon%";
inherit (color) background;
inherit (color) foreground;
foreground = "#cc6666";
padding = 2;
};
label = {
monitor = "%name%";
active = {
text = "%icon%";
background = color.shade2;
foreground = color.dark;
padding = 2;
};
occupied = {
text = "%icon%";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
urgent = {
text = "%icon%";
inherit (color) background;
foreground = "#cc6666";
padding = 2;
};
empty = {
text = "%icon%";
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
empty = {
text = "%icon%";
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
};
};
"module/title" = {
type = "internal/xwindow";
format.text = "<label>";
format.prefix = pref // {
"module/title" = {
type = "internal/xwindow";
format.text = "<label>";
format.prefix =
pref
// {
text = "";
background = color.shade2;
foreground = color.dark;
};
label = {
text = "%title%";
maxlen = 30;
label = {
text = "%title%";
maxlen = 30;
inherit (color) background;
foreground = "${color.foreground-alt}";
padding = 2;
empty = {
text = "Desktop";
inherit (color) background;
foreground = "${color.foreground-alt}";
padding = 2;
empty = {
text = "Desktop";
inherit (color) background;
foreground = "${color.foreground-alt}";
padding = 2;
};
};
};
};
"module/mpd" = {
type = "internal/mpd";
interval = 1;
format.online = "<icon-prev><toggle><icon-next><label-song>";
format.offline = {
text = "<label-offline>";
prefix = pref // {
"module/mpd" = {
type = "internal/mpd";
interval = 1;
format.online = "<icon-prev><toggle><icon-next><label-song>";
format.offline = {
text = "<label-offline>";
prefix =
pref
// {
text = "";
background = color.shade1;
inherit (color) foreground;
};
};
label = {
song = {
text = "%artist% - %title%";
maxlen = 25;
ellipsis = true;
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
label = {
song = {
text = "%artist% - %title%";
maxlen = 25;
ellipsis = true;
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
time = "%elapsed / %total%";
offline = {
text = "Offline";
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
};
icon =
let
mkIcon =
i:
pref
// {
text = i;
foreground = color.dark;
background = color.shade1;
};
in
{
play = mkIcon "";
pause = mkIcon "";
stop = "";
prev = mkIcon " ";
next = mkIcon " ";
seekb = "";
seekf = "";
random = "";
repeat = "";
repeatone = "";
single = "";
consume = "";
};
toggle = {
on.foreground = color.foreground;
off.foreground = color.background;
time = "%elapsed / %total%";
offline = {
text = "Offline";
inherit (color) background;
foreground = color.foreground-alt;
padding = 2;
};
};
icon = let
mkIcon = i:
pref
// {
text = i;
foreground = color.dark;
background = color.shade1;
};
in {
play = mkIcon "";
pause = mkIcon "";
stop = "";
prev = mkIcon " ";
next = mkIcon " ";
seekb = "";
seekf = "";
random = "";
repeat = "";
repeatone = "";
single = "";
consume = "";
};
toggle = {
on.foreground = color.foreground;
off.foreground = color.background;
};
};
"module/filesystem" = {
type = "internal/fs";
mount = [
"/"
"/mnt/babeshare/marley"
"/mnt/babeshare/babez"
];
interval = 30;
fixed.values = true;
format = {
mounted = fmt // {
"module/filesystem" = {
type = "internal/fs";
mount = [
"/"
"/mnt/babeshare/marley"
"/mnt/babeshare/babez"
];
interval = 30;
fixed.values = true;
format = {
mounted =
fmt
// {
text = "<label-mounted>";
prefix.text = "";
background = color.shade2;
};
unmounted = fmt // {
unmounted =
fmt
// {
text = "<label-unmounted>";
prefix.text = "";
background = color.shade2;
};
};
label = {
mounted = " %free%";
unmounted = " %mountpoint: not mounted";
};
};
label = {
mounted = " %free%";
unmounted = " %mountpoint: not mounted";
};
};
"module/cpu" = {
type = "internal/cpu";
interval = 1;
format = fmt // {
"module/cpu" = {
type = "internal/cpu";
interval = 1;
format =
fmt
// {
text = "<label>";
prefix.text = "";
background = color.shade2;
inherit (color) foreground;
};
label = " %percentage%%";
};
label = " %percentage%%";
};
"module/memory" = {
type = "internal/memory";
interval = 1;
format = fmt // {
"module/memory" = {
type = "internal/memory";
interval = 1;
format =
fmt
// {
text = "<label>";
prefix.text = "";
background = color.shade1;
};
label = " %mb_used%";
};
label = " %mb_used%";
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
sink = "alsa_output.pci-0000_03_00.6.analog-stereo";
use.ui.max = false;
interval = 5;
format = {
volume = {
text = "<ramp-volume> <label-volume>";
background = color.shade2;
padding = 2;
};
muted = fmt // {
"module/pulseaudio" = {
type = "internal/pulseaudio";
sink = "alsa_output.pci-0000_03_00.6.analog-stereo";
use.ui.max = false;
interval = 5;
format = {
volume = {
text = "<ramp-volume> <label-volume>";
background = color.shade2;
padding = 2;
};
muted =
fmt
// {
text = "<label-muted>";
prefix.text = "";
background = color.shade2;
};
};
ramp.volume = {
text = [
""
""
""
];
font = 2;
};
};
ramp.volume = {
text = [
""
""
""
];
font = 2;
};
};
"module/network" = {
type = "internal/network";
interface = "enp4s0";
interval = 1.0;
accumulate.stats = true;
unknown.as.up = true;
format = {
connected = fmt // {
"module/network" = {
type = "internal/network";
interface = "enp4s0";
interval = 1.0;
accumulate.stats = true;
unknown.as.up = true;
format = {
connected =
fmt
// {
text = "<label-connected>";
prefix.text = "";
background = color.shade2;
};
disconnected = fmt // {
disconnected =
fmt
// {
text = "<label-disconnected>";
prefix.text = "";
background = color.shade2;
};
};
label = {
connected = "%{A1:networkmanager_dmenu &:} %netspeed%%{A}";
disconnected = "%{A1:networkmanager_dmenu &:} Offline%{A}";
};
};
label = {
connected = "%{A1:networkmanager_dmenu &:} %netspeed%%{A}";
disconnected = "%{A1:networkmanager_dmenu &:} Offline%{A}";
};
};
"module/date" = {
type = "internal/date";
interval = 1.0;
time.text = " %I:%M %p";
time.alt = " %a, %d %b %Y";
format = fmt // {
"module/date" = {
type = "internal/date";
interval = 1.0;
time.text = " %I:%M %p";
time.alt = " %a, %d %b %Y";
format =
fmt
// {
text = "<label>";
prefix.text = "";
background = color.shade1;
inherit (color) foreground;
};
label = "%time%";
};
label = "%time%";
};
"module/sysmenu" = {
type = "custom/text";
format = {
text = "";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
click.left = mkIf hasRofi "${cfgHome}/rofi/powermenu/type-1/powermenu.sh &";
"module/sysmenu" = {
type = "custom/text";
format = {
text = "";
inherit (color) background;
foreground = color.shade2;
padding = 2;
};
click.left = mkIf hasRofi "${cfgHome}/rofi/powermenu/type-1/powermenu.sh &";
};
"module/tray" = {
type = "internal/tray";
tray = {
size = 16;
background = color.shade2;
spacing = "5px";
};
format = {
background = color.shade2;
padding = 2;
};
"module/tray" = {
type = "internal/tray";
tray = {
size = 16;
background = color.shade2;
spacing = "5px";
};
format = {
background = color.shade2;
padding = 2;
};
};
};
};
};
}

View file

@ -3,9 +3,9 @@
config,
pkgs,
...
}:
let
inherit (lib)
}: let
inherit
(lib)
mkEnableOption
mkIf
concatMapAttrs
@ -18,8 +18,7 @@ let
cfg = config.marleyos.xorg.i3;
isGenericLinux = config.targets.genericLinux.enable;
in
{
in {
options.marleyos.xorg.i3.enable = mkEnableOption "i3";
config = mkIf cfg.enable {
@ -30,7 +29,10 @@ in
picom = enabled;
polybar = enabled;
# broken on non-nixOS
screen-locker = if isGenericLinux then disabled else enabled;
screen-locker =
if isGenericLinux
then disabled
else enabled;
};
};
@ -41,138 +43,140 @@ in
xsession.windowManager.i3 = {
enable = true;
package = config.lib.nixGL.wrap pkgs.i3;
package = mkIf config.marleyos.nixGL.enable (config.lib.nixGL.wrap pkgs.i3);
extraConfig = "tiling_drag modifier titlebar";
config =
let
directions = {
left = "h";
down = "j";
up = "k";
right = "l";
};
config = let
directions = {
left = "h";
down = "j";
up = "k";
right = "l";
};
in {
focus.followMouse = false;
window.border = 0;
floating.border = 0;
window.titlebar = false;
floating.titlebar = false;
gaps = {
smartBorders = "no_gaps";
inner = 10;
top = 50;
};
bars = [];
# Startup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
startup = with pkgs; [
{command = "${getExe feh} --no-fehbg --bg-fill ${./bg.jpg}";}
{command = "${getExe networkmanagerapplet}";}
];
# Keybindings - - - - - - - - - - - - - - - - - - - - - - - - - - - -
modifier = "Mod4";
keybindings = let
mod = config.xsession.windowManager.i3.config.modifier;
workspaces = range 1 10;
getI = i:
if i == 10
then "0"
else toString i;
inherit (config.xdg) configHome;
isGenericLinux = config.targets.genericLinux.enable;
in
{
focus.followMouse = false;
window.border = 0;
floating.border = 0;
{
"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
window.titlebar = false;
floating.titlebar = false;
"${mod}+e" = "layout toggle split";
"${mod}+Control+h" = "split -";
"${mod}+Control+v" = "split |";
gaps = {
smartBorders = "no_gaps";
inner = 10;
top = 50;
};
"${mod}+f" = "fullscreen toggle";
bars = [ ];
"${mod}+Shift+space" = "floating toggle";
# Startup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"${mod}+Control+r" = "mode resize";
startup = with pkgs; [
{ command = "${getExe feh} --no-fehbg --bg-fill ${./bg.jpg}"; }
{ command = "${getExe networkmanagerapplet}"; }
];
"${mod}+q" = "kill";
# Keybindings - - - - - - - - - - - - - - - - - - - - - - - - - - - -
modifier = "Mod4";
keybindings =
let
mod = config.xsession.windowManager.i3.config.modifier;
workspaces = range 1 10;
getI = i: if i == 10 then "0" else toString i;
inherit (config.xdg) configHome;
isGenericLinux = config.targets.genericLinux.enable;
in
"${mod}+r" = "exec ${configHome}/rofi/launchers/type-1/launcher.sh";
"${mod}+Return" = "exec ${
if isGenericLinux
then "wezterm"
else "${pkgs.wezterm}/bin/wezterm"
}";
}
# PulseAudio Volume - - - - - - - - - - - - - - - - - - - - - - - -
// (
concatMapAttrs
(key: cmd: {
"${key}" = "exec --no-startup-id pactl ${cmd} && killall -SIGUSR1 i3status";
})
{
"${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
"${mod}+e" = "layout toggle split";
"${mod}+Control+h" = "split -";
"${mod}+Control+v" = "split |";
"${mod}+f" = "fullscreen toggle";
"${mod}+Shift+space" = "floating toggle";
"${mod}+Control+r" = "mode resize";
"${mod}+q" = "kill";
"${mod}+r" = "exec ${configHome}/rofi/launchers/type-1/launcher.sh";
"${mod}+Return" = "exec ${if isGenericLinux then "wezterm" else "${pkgs.wezterm}/bin/wezterm"}";
XF86AudioRaiseVolume = "set-sink-volume @DEFAULT_SINK@ +10%";
XF86AudioLowerVolume = "set-sink-volume @DEFAULT_SINK@ -10%";
XF86AudioMute = "set-sink-mute @DEFAULT_SINK@ toggle";
XF86AudioMicMute = "set-source-mute @DEFAULT_SOURCE@ toggle";
}
# PulseAudio Volume - - - - - - - - - - - - - - - - - - - - - - - -
// (concatMapAttrs
(key: cmd: {
"${key}" = "exec --no-startup-id pactl ${cmd} && killall -SIGUSR1 i3status";
})
{
XF86AudioRaiseVolume = "set-sink-volume @DEFAULT_SINK@ +10%";
XF86AudioLowerVolume = "set-sink-volume @DEFAULT_SINK@ -10%";
XF86AudioMute = "set-sink-mute @DEFAULT_SINK@ toggle";
XF86AudioMicMute = "set-source-mute @DEFAULT_SOURCE@ toggle";
}
)
# Focus & Movement - - - - - - - - - - - - - - - - - - - - - - - - -
// (concatMapAttrs (direction: key: {
)
# Focus & Movement - - - - - - - - - - - - - - - - - - - - - - - - -
// (concatMapAttrs (direction: key: {
"${mod}+${key}" = "focus ${direction}";
"${mod}+Shift+${key}" = "move ${direction}";
}) directions)
})
directions)
# Switch Workspaces - - - - - - - - - - - - - - - - - - - - - - - - -
// (listToAttrs (
(map (i: {
name = "${mod}+${getI i}";
value = "workspace number ${toString i}";
}))
workspaces
))
# Move Windows Between Workspaces - - - - - - - - - - - - - - - - - -
// (listToAttrs (
(map (i: {
name = "${mod}+Shift+${getI i}";
value = "move container to workspace number ${toString i}";
}))
workspaces
));
# Switch Workspaces - - - - - - - - - - - - - - - - - - - - - - - - -
// (listToAttrs (
(map (i: {
name = "${mod}+${getI i}";
value = "workspace number ${toString i}";
}))
workspaces
))
# Move Windows Between Workspaces - - - - - - - - - - - - - - - - - -
// (listToAttrs (
(map (i: {
name = "${mod}+Shift+${getI i}";
value = "move container to workspace number ${toString i}";
}))
workspaces
));
# Resize Windows - - - - - - - - - - - - - - - - - - - - - - - - - - -
modes.resize =
let
mod = config.xsession.windowManager.i3.config.modifier;
in
{
Return = "mode default";
Escape = "mode default";
"${mod}+Control+r" = "mode default";
# Resize Windows - - - - - - - - - - - - - - - - - - - - - - - - - - -
modes.resize = let
mod = config.xsession.windowManager.i3.config.modifier;
in
{
Return = "mode default";
Escape = "mode default";
"${mod}+Control+r" = "mode default";
}
// (
concatMapAttrs
(key: action: {
"${key}" = "resize ${action} 10 px or 10 ppt";
})
rec {
Left = "shrink width";
Down = "shrink height";
Up = "grow height";
Right = "grow width";
"${directions.left}" = Left;
"${directions.down}" = Down;
"${directions.up}" = Up;
"${directions.right}" = Right;
}
// (concatMapAttrs
(key: action: {
"${key}" = "resize ${action} 10 px or 10 ppt";
})
rec {
Left = "shrink width";
Down = "shrink height";
Up = "grow height";
Right = "grow width";
"${directions.left}" = Left;
"${directions.down}" = Down;
"${directions.up}" = Up;
"${directions.right}" = Right;
}
);
};
);
};
};
};
}