Desktop usability adjustments (#1)

Reviewed-on: #1
This commit is contained in:
2025-05-18 12:56:42 +00:00
parent 1d2b3f799d
commit d91ebe083d
42 changed files with 1649 additions and 1403 deletions

View File

@@ -0,0 +1,11 @@
{
inputs,
pkgs,
...
}:
{
environment.systemPackages =
with pkgs; [
inputs.better-control.packages.${pkgs.system}.better-control
];
}

View File

@@ -0,0 +1,7 @@
{inputs, pkgs, ...}:
{
# Put a cursor theme to the location expected by the hyprland window manager
# TODO
}

View File

@@ -0,0 +1,11 @@
{
imports = [
# ./better-control.nix
./cursor.nix
./hyprland-customization.nix
./hyprpaper.nix
./hyprlock.nix
./hypridle.nix
./waybar.nix
];
}

View File

@@ -0,0 +1,37 @@
{inputs, pkgs, ...}:
{
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false;
};
listener = [
{
# dim screen after 4 minutes
timeout = 240;
on-timeout = "brightnessctl -s set 10";
# set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r";
# monitor backlight restore.
}
{
# lock screen after 5 minutes
timeout = 300;
on-timeout = "loginctl lock-session && hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
{
# suspend after 10 minutes
timeout = 600;
on-timeout = "systemctl suspend";
on-resume = "hyprctl dispatch dpms on";
}
];
};
};
}

View File

@@ -0,0 +1,220 @@
{inputs, pkgs, ...}:
{
home.packages = [
pkgs.hyprshot
pkgs.nautilus
pkgs.gnome-control-center
pkgs.brightnessctl
pkgs.cliphist
pkgs.wl-clipboard
pkgs.gcr # Provides org.gnome.keyring.SystemPrompter
];
# Also use gnome keyring
services.gnome-keyring.enable = true;
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
settings = {
"$mod" = "SUPER";
"$browser" = "firefox";
"$launcher-cmd" = "wofi --show drun -n";
"$ide" = "code";
# Global bindings
bind = [
# Launch applications
"$mod, space, exec, $launcher-cmd"
"$mod, return, exec, kitty"
"$mod, b, exec, $browser"
"$mod, s, exec, $ide"
"$mod, e, exec, nautilus"
# Lock screen
"$mod, l, exec, hyprlock"
# Clipboard management
"$mod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy"
# Close window
"$mod, Q, killactive,"
"$mod+Shift, Q, exit," # this is the true kill
# Toggle Floating and reduce size
"$mod, f, togglefloating,"
"$mod, f, resizeactive, 50% 50%,"
# Toggle fullscreen
"$mod+Shift, f, fullscreen,"
# Alt-tab alternative
"$mod, Tab, cyclenext,"
"$mod, Tab, bringactivetotop,"
# Move the window
"$mod+Shift, left, movewindow, l"
"$mod+Shift, right, movewindow, r"
"$mod+Shift, up, movewindow, u"
"$mod+Shift, down, movewindow, d"
"$mod+Ctrl, left, movetoworkspace, -1"
"$mod+Ctrl, right, movetoworkspace, +1"
# # Switch workspace
"$mod+Alt, left, workspace, -1"
"$mod+Alt, right, workspace, +1"
# Screenshot
"$mod, Print, exec, hyprshot -m region -o ~/Pictures/Screenshots"
"$mod+Shift, Print, exec, hyprshot -m window -o ~/Pictures/Screenshots"
];
# repeatable bindings
binde = [
# Fn keys
", XF86MonBrightnessDown, exec, brightnessctl set -5%"
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
# Reshape the window in focus
"$mod, MINUS, resizeactive, -2% -2%"
"$mod, KP_Subtract, resizeactive, -2% -2%"
"$mod, PLUS, resizeactive, 2% 2%"
"$mod, KP_Add, resizeactive, 2% 2%"
];
# lock-screen bindings
bindl = [
# on lid close, lock the screen
# if another monitor is connected, only turn the internal monitor off and don't lock the screen
", switch:on:Lid Switch, exec, hyprctl dispatch dpms off eDP-1"
# if there is no active monitor, perform a screen lock
", switch:on:Lid Switch, exec, hyprctl monitors | grep 'dpmsStatus: 1' || hyprlock"
", switch:off:Lid Switch, exec, hyprctl dispatch dpms on eDP-1"
];
# bindr = [
# # Overview
# "$mod, , overview:toggle"
# ];
bindm = [
# move the window
"$mod, mouse:272, movewindow"
];
exec-once = [
"gnome-keyring-daemon --start --components=secrets"
# "${pkgs.hyprpaper}/bin/hyprpaper"
# hyprpaper is handled as its own service
"${pkgs.waybar}/bin/waybar"
# listen to clipboard events and send them to cliphist
"wl-paste --watch cliphist store"
"${pkgs.waybar}/bin/hypridle"
"hyprpaper"
# # Fixes cursor themes in gnome apps under hyprland
# "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'"
# "gsettings set org.gnome.desktop.interface cursor-size ${toString home.pointerCursor.size}"
];
general = {
resize_on_border = true;
gaps_in = 5;
gaps_out = 5;
border_size = 1;
"col.active_border" = "rgb(98971A) rgb(CC241D) 45deg";
layout = "master";
};
misc = {
# disable refreshs when nothing is going on
vfr = false;
disable_hyprland_logo = true;
};
input = {
kb_layout = "de";
# remap caps lock to ctrl
kb_options = "ctrl:nocaps";
numlock_by_default = true;
# mouse input should be unchanged
natural_scroll = false;
sensitivity = 0.3;
touchpad = {
disable_while_typing = false;
natural_scroll = true;
};
};
gestures = {
workspace_swipe = true;
workspace_swipe_fingers = 4;
workspace_swipe_touch = true;
};
decoration = {
rounding = 7;
# active_opacity = 0.95;
inactive_opacity = 0.9;
shadow = {
enabled = false;
};
# blur is set on a per-program basis
windowrulev2 = [
# kitty should behave like a floating window
"animation popin, class:kitty"
"move cursor -50% -50%, class:kitty"
"float, class:kitty"
"size 50% 50%, class:kitty"
# some more floating windows
"float, class:org.gnome.Settings"
"float, class:desktopclient.owncloud.com"
"float, class:org.keepassxc.KeePassXC"
];
};
monitor = [
"eDP-1, 3840x2160, 0x0, 1.5" # the internal laptop monitor
# Samsung monitor at irchel (matching the description)
# "desc:Samsung Electric Company LS27D80xU HK7X800803, 3840x2160, auto-up, 1.5"
", preferred, auto-up, auto" # automatically add any newly detected monitor
];
xwayland = {
enabled = false;
};
env = [
# force apps to use wayland
"NIXOS_OZONE_WL, 1"
"ELECTRON_OZONE_PLATFORM_HINT, wayland"
# set the scale factor for GDK apps
"GDK_SCALE, 1.5"
# set the scale factor for QT apps
"QT_SCALE_FACTOR, 1.5"
# set the scale factor for GTK apps
];
};
plugins = [
# Global overview
pkgs.hyprlandPlugins.hyprspace
# Touch gestures
pkgs.hyprlandPlugins.hyprgrass
];
};
services.swaync.enable = true;
}

View File

@@ -0,0 +1,52 @@
{inputs, pkgs, ...}:
{
programs.hyprlock = {
enable = true;
settings = {
general = {
# immediately lock the screen
grace = 0;
no_fade_in = false;
disable_loading_bar = false;
};
background = {
blur_passes = 3;
blur_size = 10;
# image is set by stylix
};
input-field = {
monitor = "";
size = "300, 60";
# radius = 15;
position = "0, -250";
halign = "center";
valign = "center";
};
label = [
{
# Day-Month-Date
monitor = "";
text = ''cmd[update:1000] echo -e "$(date +"%A, %B %d")"'';
font_size = 28;
position = "0, 490";
halign = "center";
valign = "center";
}
# Time
{
monitor = "";
text = ''cmd[update:1000] echo "<span>$(date +"%H:%M")</span>"'';
font_size = 160;
font_weight = "bold";
# font_family = "steelfish outline regular";
position = "0, 370";
halign = "center";
valign = "center";
}
];
};
};
}

View File

@@ -0,0 +1,63 @@
{
pkgs,
lib,
...
}:
with lib; let
# # load the wallpapers from the wallpapers directory - this gives a set with the folder content
# dirContent = builtins.readDir ../../../wallpapers;
# wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers;
# # # load each wallpaper and keep its path (now in the nix store) as an array
# # wallpapers = map (x: builtins.readDir "${../../../wallpapers}/${x.value}") dirContent;
# # wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers;
# # script that picks a random wallpaper from the array and sets it as the desktop background
# monitor = ""; # leave empty to set the wallpaper on all monitors
# wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
# wallpaper=$(shuf -n 1 -e ${wallpaperString})
# hyprctl hyprpaper unload all
# hyprctl hyprpaper preload $wallpaper
# hyprctl hyprpaper wallpaper "${monitor},$wallpaper"
# '';
in {
# home.packages = [wallpaperRandomizer];
services.hyprpaper = {
enable = true;
};
# settings = {
# ipc = "off";
# splash = false;
# };
# };
# systemd.user = {
# services.wallpaperRandomizer = {
# Install = {WantedBy = ["graphical-session.target"];};
# Unit = {
# Description = "Set random desktop background using hyprpaper";
# After = ["graphical-session-pre.target"];
# PartOf = ["graphical-session.target"];
# };
# Service = {
# Type = "oneshot";
# ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
# IOSchedulingClass = "idle";
# };
# };
# timers.wallpaperRandomizer = {
# Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
# Timer = {OnUnitActiveSec = "6h";};
# Install = {WantedBy = ["timers.target"];};
# };
# };
}

View File

@@ -0,0 +1,239 @@
{inputs, pkgs, ...}:
{
# required to autoload fonts from packages installed via Home Manager
fonts.fontconfig.enable = true;
# waybar requires font-awesome
home.packages = [
pkgs.pavucontrol
];
# enable waybar
programs.waybar.enable = true;
programs.waybar = {
settings = {
mainBar = {
margin-top = 2;
margin-bottom = 2;
margin-left = 5;
margin-right = 5;
layer = "top";
position = "top";
spacing = 5;
modules-left = [
"hyprland/workspaces"
"hyprland/window"
];
modules-center = [
"clock"
"custom/notification"
];
modules-right = [
"tray"
"privacy"
"wireplumber"
"network"
"battery"
"backlight"
"idle_inhibitor"
];
# module specific settings
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
active = "";
default = "";
};
};
"hyprland/window"= {
"icon" = true;
"separate-outputs" = true;
"format" = "{}";
"rewrite" = {
"(.*) Mozilla Firefox" = "$1";
"(.*) - fish" = "> [$1]";
"(.*) - Visual Studio Code" = "$1";
};
};
"clock" = {
format = "{:%H:%M}";
interval = 1;
tooltip-format = "<tt>{calendar}</tt>";
calendar = {
"format" = {
"today" = "<span color='#fAfBfC'><b>{}</b></span>";
};
};
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
tooltip = "true";
};
"bluetooth" = {
format-on = "󰂯";
format-off = "BT-off";
format-disabled = "󰂲";
format-connected-battery = "{device_battery_percentage}% 󰂯";
format-alt = "{device_alias} 󰂯";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
tooltip-formaenumeratet-enumerate-connected = "{device_alias}\n{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\n{device_address}\n{device_battery_percentage}%";
on-click-right = "blueman-manager";
};
"battery" = {
interval = 60;
states = {
good = 80;
warning = 30;
critical = 10;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% 󰂄";
format-plugged = "{capacity}% 󰂄 ";
format-icons = [ "󰁻" "󰁼" "󰁾" "󰂀" "󰂂" "󰁹" ];
};
"backlight" = {
"format" = "{percent}% {icon}";
"format-icons" = ["" "" "" "" "" "" "" "" ""];
};
"wireplumber" = {
scroll-step = 10;
format = "{icon} {volume}%";# {format_source}";
format-bluetooth = "{volume}% {icon}";# {format_source}";
format-bluetooth-muted = " {icon}";# {format_source}";
format-muted = " Muted";# {format_source}";
# format-source = " {volume}%";
# format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
default = [
""
""
""
];
};
on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center sound";
};
"tray" = {
spacing = 5;
};
"custom/notification" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "sleep 0.1 && task-waybar";
escape = true;
};
"network" = {
format = "󰤭";
format-wifi = "{icon} {essid}";
format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ];
format-ethernet = "󰊗 {ipaddr}/{cidr}";
format-disconnected = "";
tooltip-format = "󰊗 {ifname} via {gwaddr}";
tooltip-format-wifi = "SSID: {essid}({signalStrength}%), {frequency} MHz\nInterface: {ifname}\nIP: {ipaddr}\nGW: {gwaddr}\n\n<span color='#a6da95'>{bandwidthUpBits}</span>\t<span color='#ee99a0'>{bandwidthDownBits}</span>\t<span color='#c6a0f6'>󰹹{bandwidthTotalBits}</span>";
tooltip-format-ethernet = "{ifname} ";
tooltip-format-disconnected = "Disconnected";
on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi";
};
"privacy" = {
icon-spacing = 4;
# icon-size" = 18;
transition-duration = 250;
modules = [
{
type = "screenshare";
tooltip = true;
# tooltip-icon-size = 24
}
{
type = "audio-out";
tooltip = true;
# tooltip-icon-size = 24
}
{
type = "audio-in";
tooltip = true;
# tooltip-icon-size = 24
}
];
};
};
};
style = ''
* {
font-family: "FiraCode Nerd Font";
font-weight: bold;
font-size: 22px;
}
window#waybar {
background-color: transparent;
}
.module {
background: rgba(0, 0, 0, 0.6);
color: white;
border-radius: 7px;
padding: 5px 5px 5px 5px;
margin: 5px 0;
}
box.module button:hover {
box-shadow: inset 0 -3px #ffffff;
}
.modules-left {
padding: 3px;
}
.modules-right {
padding: 3px;
}
.modules-center {
padding: 3px;
}
#workspaces button {
color: #ffffff;
}
#battery.warning {
background:rgba(240, 165, 0, 0.6);
}
#battery.critical {
background:rgba(255, 0, 0, 0.6);
}
'';
};
}