Compare commits

..

3 Commits

Author SHA1 Message Date
marc
40b3eaba12 Added notification center 2024-12-04 15:45:20 +01:00
marc
7fe62ab2ce Brightness control 2024-12-04 14:33:49 +01:00
marc
2af075c7dd More refactoring and added hyprlock 2024-12-03 22:57:56 +01:00
11 changed files with 327 additions and 75 deletions

View File

@@ -81,8 +81,8 @@ case ${chosen} in
$lock)
if command -v i3lock-color; then
i3lock-color -c 808F85 && sleep 1
# elif command -v betterlockscreen; then
# betterlockscreen -l
elif command -v hyprlock; then
hyprlock
fi
;;
$suspend)

View File

@@ -68,10 +68,12 @@ in
# - Desktop ----------------------------------
desktop = {
inherit wallpaper;
env.grapheio.enable = true;
wm.hyprland = {
kb_layout = "es,gr";
};
# Use Γραφείο (custom) desktop environment
grapheio.enable = true;
# Add greek keyboard layout
wm.hyprland.kb_layout = "es,gr";
};
# - Editors and development ------------------

View File

@@ -2,11 +2,11 @@
with lib;
let
cfg = config.samfelag.modules.desktop.env.grapheio;
cfg = config.samfelag.modules.desktop.grapheio;
in
{
options.samfelag.modules.desktop.env.grapheio = {
enable = mkEnableOption "Grapheio desktop environment - hyprland based";
options.samfelag.modules.desktop.grapheio = {
enable = mkEnableOption "Γραφείο desktop environment - hyprland based";
};
config = mkIf cfg.enable {
@@ -14,33 +14,11 @@ in
# - Packages ---------------------------------
environment.systemPackages = with pkgs; [
# - System ---------------------------------
# - Audio
alsa-utils
playerctl
brightnessctl
# - Appearance -----------------------------
# - Cursor
inputs.hyprcursor-rose-pine.packages.${pkgs.system}.default
# - Wallpaper
hyprpaper
];
# - Audio ------------------------------------
services = {
pipewire = {
enable = true;
};
};
# - Hyprpaper --------------------------------
hm.xdg.configFile."hypr/hyprpaper.conf".text = ''
preload = ${config.samfelag.modules.desktop.wallpaper}
wallpaper = ,${config.samfelag.modules.desktop.wallpaper}
'';
# - Cursor -----------------------------------
hm.home.pointerCursor = {
gtk.enable = true;
@@ -61,26 +39,33 @@ in
samfelag.modules = {
system.audio.enable = true;
system.brightness.enable = true;
system.kanata.enable = true;
desktop = {
# Window Manager
wm.hyprland.enable = true;
# Greeter (login screen)
greeter.greetd = {
enable = true;
wm_cmd = "Hyprland";
};
tools = {
# Greeter (login screen)
greetd = {
enable = true;
wm_cmd = "Hyprland";
};
# Locker
hyprlock.enable = true;
# Status bars
eww.enable = true;
# Wallpapper
hyprpaper.enable = true;
# Launcher
rofi.enable = true;
# Notification center
swaync.enable = true;
};
};
system.kanata.enable = true;
app = {
alacritty.enable = true;
firefox.enable = true;

View File

@@ -3,9 +3,6 @@
let
cfg = config.samfelag.modules.desktop.tools.eww;
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
# Paths
paths = {
};
in {
options.samfelag.modules.desktop.tools.eww = {
@@ -29,6 +26,11 @@ in {
hm.xdg.configFile."eww/widgets".source = ../../../config/eww/widgets;
hm.xdg.configFile."eww/scripts".source = ../../../config/eww/scripts;
# - Execute on startup -----------------------
hm.wayland.windowManager.hyprland.settings.exec-once = lib.mkIf hyprCfg.enable [
"eww open top-bar"
];
# - Themeing ---------------------------------
hm.xdg.configFile."eww/colour-scheme.scss".text = ''
$base00: #${config.colorScheme.palette.base00};

View File

@@ -1,10 +1,10 @@
{ inputs, config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.desktop.greeter.greetd;
cfg = config.samfelag.modules.desktop.tools.greetd;
in {
options.samfelag.modules.desktop.greeter.greetd = with lib; {
options.samfelag.modules.desktop.tools.greetd = with lib; {
enable = mkEnableOption "Greetd based greeter";
wm_cmd = lib.my.mkOpt' types.str "" "Window manager command";
};

View File

@@ -0,0 +1,115 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.samfelag.modules.desktop.tools.hyprlock;
hexToRGBString = inputs.nix-colors.lib-core.conversions.hexToRGBString ",";
in
{
options.samfelag.modules.desktop.tools.hyprlock = {
enable = mkEnableOption "Hyprlock screen locker";
};
config = mkIf cfg.enable {
# environment.systemPackages = with pkgs; [
# hypridle
# ];
hm.programs.hyprlock = {
enable = true;
settings = {
general = {
# disable_loading_bar = true;
# grace = 5;
};
background = [
{
path = "${config.samfelag.modules.desktop.wallpaper}";
blur_passes = 2;
blur_size = 4;
}
];
input-field = [
{
font_family = "Iosevka";
size = "300, 40";
position = "0, -80";
outline_thickness = 1;
fade_on_empty = "false";
placeholder_text = "";
outer_color = "rgba(${hexToRGBString config.colorScheme.palette.base02},1.0)";
inner_color = "rgba(${hexToRGBString config.colorScheme.palette.base00},1.0)";
font_color = "rgba(${hexToRGBString config.colorScheme.palette.base05},1.0)";
check_color = "rgba(${hexToRGBString config.colorScheme.palette.base07},1.0)";
fail_color = "rgba(${hexToRGBString config.colorScheme.palette.base06},1.0)";
}
];
label = [
{
text = "$TIME";
color = "rgba(${hexToRGBString config.colorScheme.palette.base00},1.0)";
font_size = 25;
font_family = "Iosevka";
position = "0, 80";
halign = "center";
valign = "center";
}
];
};
};
hm.services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
before_sleep_cmd = "loginctl lock-session"; # lock before suspend.
after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display.
};
listener = [
{
timeout = 90;
on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r"; # monitor backlight restore.
}
{
timeout = 90;
on-timeout = "brightnessctl -sd platform::kbd_backlight set 0"; # turn off keyboard backlight.
on-resume = "brightnessctl -rd platform::kbd_backlight"; # turn on keyboard backlight.
}
{
timeout = 300; # 5min
on-timeout = "loginctl lock-session"; # lock screen when timeout has passed
}
{
timeout = 330; # 5.5min
on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed
on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
}
{
timeout = 1800; # 30min
on-timeout = "systemctl suspend"; # suspend pc
}
];
};
};
# - Execute on startup -----------------------
# hm.wayland.windowManager.hyprland.settings.exec-once = [
# "hypridle"
# ];
};
}

View File

@@ -0,0 +1,28 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.samfelag.modules.desktop.tools.hyprpaper;
in
{
options.samfelag.modules.desktop.tools.hyprpaper = {
enable = mkEnableOption "Hyprpaper desktop wallpaper";
};
config = mkIf cfg.enable {
hm.services.hyprpaper = {
enable = true;
settings = {
preload = "${config.samfelag.modules.desktop.wallpaper}";
wallpaper = ",${config.samfelag.modules.desktop.wallpaper}";
};
};
# - Execute on startup -----------------------
hm.wayland.windowManager.hyprland.settings.exec-once = [
"hyprpaper"
];
};
}

View File

@@ -0,0 +1,63 @@
{ inputs, config, lib, pkgs, ... }:
let
cfg = config.samfelag.modules.desktop.tools.swaync;
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in {
options.samfelag.modules.desktop.tools.swaync = with lib; {
enable = mkEnableOption "Sway Notification Center";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
libnotify
swaynotificationcenter
];
hm.services.swaync = {
enable = true;
settings = {
};
style = ''
* {
font-family: Iosevka;
}
.notification {
padding: 4px 4px 0px 4px;
background-color: #${config.colorScheme.palette.base00};
color: #${config.colorScheme.palette.base05};
}
.summary {
}
.body {
}
.control-center {
margin: 20px;
opacity: 0.95;
background-color: #${config.colorScheme.palette.base01};
color: #${config.colorScheme.palette.base05};
}
'';
};
# - Execute on startup -----------------------
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
exec-once = [
"swaync"
];
bind = [
# Notification center
"${hyprCfg.mod}, n, exec, swaync-client -t -sw"
];
};
};
}

View File

@@ -7,20 +7,13 @@ in {
options.samfelag.modules.desktop.wm.hyprland = with lib; {
enable = mkEnableOption "hyprland window manager";
mod = my.mkOpt' types.str "Mod4" "Main modifier key for hyprland";
kb_layout = my.mkOpt' types.str "es" "Keyboard layout(s) for hyprland";
extraKeybindings = my.mkOpt (types.listOf types.str) [ ];
# extraStartup = my.mkOpt (types.listOf types.attrs) [ ];
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
];
# - Configuration -----------------------------
# Hyprland config
@@ -31,11 +24,9 @@ in {
hm.wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
package = pkgs.hyprland;
# Optional
# Whether to enable hyprland-session.target on hyprland startup
xwayland.enable = true;
systemd.enable = true;
plugins = [
@@ -60,8 +51,6 @@ in {
monitor = ",highres,auto,1";
exec-once = [
"hyprpaper"
"eww open top-bar"
];
decoration = {
@@ -120,29 +109,11 @@ in {
"${cfg.mod} SHIFT, 5, movetoworkspace, 5"
"${cfg.mod} SHIFT, 0, movetoworkspace, 6"
# - Media ------------------------------
# Pulse Audio controls (mute)
", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
# Media player controls
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPause, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioStop, exec, playerctl stop"
# - Keyboard ---------------------------
"${cfg.mod}, Escape, exec, hyprctl switchxkblayout current next"
] ++ cfg.extraKeybindings;
binde = [
# Pulse Audio controls (volume)
", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%"
", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%"
];
bindm = [
"${cfg.mod}, mouse:272, hy3:movewindow"
"${cfg.mod} SHIFT, mouse:272, resizewindow 1"

44
modules/system/audio.nix Normal file
View File

@@ -0,0 +1,44 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.samfelag.modules.system.audio;
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in
{
options.samfelag.modules.system.audio = {
enable = mkEnableOption "Audio support";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
alsa-utils
playerctl
brightnessctl
];
services.pipewire.enable = true;
# - Hyprland keybindings ---------------------
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
bind = [
# Pulse Audio controls (mute)
", XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
# Media player controls
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPause, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioStop, exec, playerctl stop"
];
binde = [
# Pulse Audio controls (volume)
", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%"
", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%"
];
};
};
}

View File

@@ -0,0 +1,42 @@
{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.samfelag.modules.system.brightness;
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in
{
options.samfelag.modules.system.brightness = {
enable = mkEnableOption "Brightness support";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
brightnessctl
];
# - Hyprland keybindings ---------------------
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
bind = [
# Brightness control
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86MonBrightnessDown, exec, brightnessctl set -5%"
# Keyboard brightness control
"${hyprCfg.mod}, XF86MonBrightnessUp, exec, brightnessctl -d platform::kbd_backlight set +1"
"${hyprCfg.mod}, XF86MonBrightnessDown, exec, brightnessctl -d platform::kbd_backlight set -1"
];
binde = [
# Brightness control (keep button pressed)
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
# Keyboard brightness control (keep button pressed)
"${hyprCfg.mod}, XF86MonBrightnessUp, exec, brightnessctl -d platform::kbd_backlight set +1"
"${hyprCfg.mod}, XF86MonBrightnessDown, exec, brightnessctl -d platform::kbd_backlight set 1-"
];
};
};
}