Compare commits

...

4 Commits

Author SHA1 Message Date
326148e795 Make keyboard work more like macOS
Producing characters (like æ, ø and å) via hyprland was always a terrible idea,
but working around it was a bit finicky. This seems to work.
2026-02-20 20:39:38 +01:00
954e2adc45 Replace hyprlock with swaylock and remove fingerprint reader 2026-02-19 19:19:11 +01:00
34a4f08ac7 Theme should be data only 2026-02-19 14:26:58 +01:00
b431896ca1 Add my user to dialout
I needed this to be able to flash a USB-device through Chrome.
2026-02-19 13:49:16 +01:00
9 changed files with 157 additions and 121 deletions

View File

@ -12,14 +12,7 @@
../../modules/desktop
];
services.fprintd.enable = true;
services.gnome.gnome-keyring.enable = true;
security.pam.services = {
login.fprintAuth = true;
sudo.fprintAuth = true;
hyprlock.fprintAuth = true;
login.enableGnomeKeyring = true;
};
systemd.services.disable-thinkpad-leds = {
description = "Disable ThinkPad lid logo LED and power button led";

View File

@ -22,7 +22,7 @@
imports = [
inputs.zen-browser.homeModules.beta
./hypr
./theme
./swaylock
];
programs.zen-browser = {
@ -44,4 +44,9 @@
# find more options here: https://mozilla.github.io/policy-templates/
};
};
services.darkman = {
enable = true;
settings.portal = true;
};
}

View File

@ -1,6 +1,7 @@
{ pkgs, inputs, ... }:
let
nanostatus = inputs.nanostatus.packages.${pkgs.system}.default;
toggle-mirror-display = pkgs.writeShellScriptBin "toggle-mirror-display" ''
if hyprctl monitors | grep -q '^Monitor eDP-1'; then
M=$(hyprctl monitors | awk '/Monitor/ && $2 != "eDP-1" { print $2 }' | head -n1)
@ -13,7 +14,10 @@ in
{
wayland.windowManager.hyprland.settings = {
input = {
kb_options = "altwin:swap_alt_win";
kb_layout = "us";
kb_variant = "mac";
# Both Alt keys becomes Option (called Mod5)
kb_options = "lv3:alt_switch,apple:alupckeys";
repeat_delay = 300;
repeat_rate = 50;
@ -25,56 +29,48 @@ in
};
};
"$mod" = "SUPER";
"$shiftMod" = "SUPER_SHIFT";
"$mod" = "SUPER Mod5";
bind = [
# Master layout
"$mod, F, fullscreen"
"$mod, Return, layoutmsg, swapwithmaster master"
"$mod, minus, layoutmsg, mfact -0.01"
"$mod, equal, layoutmsg, mfact +0.01"
"$mod, Tab, layoutmsg, cyclenext"
"$shiftMod, Tab, layoutmsg, cycleprev"
"$mod, comma, layoutmsg, addmaster"
"$mod, period, layoutmsg, removemaster"
"$mod, code:41, fullscreen" # F (code:41)
"$mod, code:24, killactive" # Q (code:24)
"$mod, code:119, exec, swaylock" # Delete (code:119)
# App launchers / session
"$mod, T, exec, kitty"
"$mod, E, exec, emacs"
"$mod, B, exec, zen-beta"
"$mod, Q, killactive"
# Focus Movement (Super + Alt + HJKL)
"$mod, S, exec, grimblast copysave area /tmp/screenshot-$(date +%F--%T).png"
"$shiftMod, S, exec, grimblast copysave screen /tmp/screenshot-$(date +%F--%T).png"
"$mod, code:43, movefocus, l" # H (code:43)
"$mod, code:44, movefocus, d" # J (code:44)
"$mod, code:45, movefocus, u" # K (code:45)
"$mod, code:46, movefocus, r" # L (code:46)
# Window focus & movement
"$mod, H, movefocus, l"
"$mod, J, movefocus, d"
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
"$shiftMod, H, movewindow, l"
"$shiftMod, J, movewindow, d"
"$shiftMod, K, movewindow, u"
"$shiftMod, L, movewindow, r"
# Window Movement (Super + Shift + Alt + HJKL)
"$mod SHIFT, code:43, movewindow, l"
"$mod SHIFT, code:44, movewindow, d"
"$mod SHIFT, code:45, movewindow, u"
"$mod SHIFT, code:46, movewindow, r"
"$mod, =, resizeactive, +10"
"$mod, -, resizeactive, -10"
# Master Layout & Resize
"$mod, code:36, layoutmsg, swapwithmaster master" # Return (code:36)
"$mod, code:20, layoutmsg, mfact -0.01" # Minus (code:20)
"$mod, code:21, layoutmsg, mfact +0.01" # Equal (code:21)
"$mod, code:23, layoutmsg, cyclenext" # Tab (code:23)
"$mod SHIFT, code:23, layoutmsg, cycleprev"
"$mod, code:59, layoutmsg, addmaster" # Comma (code:59)
"$mod, code:60, layoutmsg, removemaster" # Period (code:60)
"$mod, D, exec, darkman toggle"
"$mod, space, exec, ${nanostatus}/bin/nanostatus-toggle"
"$mod, delete, exec, hyprlock"
"$shiftMod, M, exec, ${toggle-mirror-display}/bin/toggle-mirror-display"
# App Launchers (Super + Alt + Key)
"$mod, code:28, exec, kitty" # T (code:28)
"$mod, code:26, exec, emacs" # E (code:26)
"$mod, code:56, exec, zen-beta" # B (code:56)
"$mod, code:40, exec, darkman toggle" # D (code:40)
"$mod, code:65, exec, ${nanostatus}/bin/nanostatus-toggle" # Space (code:65)
"$mod SHIFT, code:58, exec, ${toggle-mirror-display}/bin/toggle-mirror-display" # M (code:58) + Shift
# Text input (macOS-like way of producing Norwegian characters)
"$mod, A, exec, wtype 'å'"
"$mod, O, exec, wtype 'ø'"
"$mod, apostrophe, exec, wtype 'æ'"
"$shiftMod, A, exec, wtype 'Å'"
"$shiftMod, O, exec, wtype 'Ø'"
"$shiftMod, apostrophe, exec, wtype 'Æ'"
# Screenshots
# Media & brightness
"$mod, code:39, exec, grimblast copysave area /tmp/screenshot-$(date +%F--%T).png" # S (code:39)
"$mod SHIFT, code:39, exec, grimblast copysave screen /tmp/screenshot-$(date +%F--%T).png"
# Media & Brightness (Standard Keys)
", XF86AudioRaiseVolume, exec, pamixer -i 5 "
", XF86AudioLowerVolume, exec, pamixer -d 5 "
", XF86AudioMute, exec, pamixer -t"
@ -83,19 +79,38 @@ in
", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
"SHIFT, XF86MonBrightnessUp, exec, brightnessctl set 100%"
"SHIFT, XF86MonBrightnessDown, exec, brightnessctl set 1"
]
++ builtins.concatLists (
builtins.genList (
i:
let
code = "1${toString i}";
ws = toString (i + 1);
in
[
"$mod, code:${code}, workspace, ${ws}"
"$shiftMod, code:${code}, movetoworkspace, ${ws}"
]
) 9
);
# Workspaces (Super + Alt + 1-9)
# 1=code:10, 2=code:11, ... 9=code:18, 0=code:19
"$mod, code:10, workspace, 1"
"$mod SHIFT, code:10, movetoworkspace, 1"
"$mod, code:11, workspace, 2"
"$mod SHIFT, code:11, movetoworkspace, 2"
"$mod, code:12, workspace, 3"
"$mod SHIFT, code:12, movetoworkspace, 3"
"$mod, code:13, workspace, 4"
"$mod SHIFT, code:13, movetoworkspace, 4"
"$mod, code:14, workspace, 5"
"$mod SHIFT, code:14, movetoworkspace, 5"
"$mod, code:15, workspace, 6"
"$mod SHIFT, code:15, movetoworkspace, 6"
"$mod, code:16, workspace, 7"
"$mod SHIFT, code:16, movetoworkspace, 7"
"$mod, code:17, workspace, 8"
"$mod SHIFT, code:17, movetoworkspace, 8"
"$mod, code:18, workspace, 9"
"$mod SHIFT, code:18, movetoworkspace, 9"
"$mod, code:19, workspace, 10"
"$mod SHIFT, code:19, movetoworkspace, 10"
];
};
}

View File

@ -1,8 +1,11 @@
let
theme = import ../theme;
in
{
imports = [
./bindings
./hypridle
./hyprlock
# ./hyprlock
];
programs.kitty.enable = true;
@ -12,7 +15,7 @@
settings = {
exec-once = [ "hyprlock || hyprctl dispatch exit" ];
exec-once = [ "swaylock || hyprctl dispatch exit" ];
misc.disable_hyprland_logo = true;
@ -55,4 +58,17 @@
];
};
};
services.darkman = {
lightModeScripts.hyprland-light = ''
hyprctl keyword misc:background_color 0x${theme.bg.light}
hyprctl keyword general:col.active_border 0xFF${theme.primary.light}
hyprctl keyword general:col.inactive_border 0xFF${theme.secondary.light}
'';
darkModeScripts.hyprland-dark = ''
hyprctl keyword misc:background_color 0x${theme.bg.dark}
hyprctl keyword general:col.active_border 0xFF${theme.primary.dark}
hyprctl keyword general:col.inactive_border 0xFF${theme.secondary.dark}
'';
};
}

View File

@ -3,7 +3,7 @@
enable = true;
settings = {
general = {
lock_cmd = "hyprlock";
lock_cmd = "swaylock";
before_sleep_cmd = "loginctl lock-session";
};
listener = [

View File

@ -1,32 +0,0 @@
{
programs.hyprlock = {
enable = true;
settings = {
background = [
{
monitor = "";
path = "screenshot";
blur_passes = 3;
}
];
input-field = [
{
monitor = "";
size = "600, 100";
position = "0, 0";
halign = "center";
valign = "center";
outline_thickness = 4;
placeholder_text = "";
fade_on_empty = false;
}
];
auth."fingerprint:enabled" = true;
};
};
}

View File

@ -0,0 +1,40 @@
let
theme = import ../theme;
in
{
programs.swaylock = {
enable = true;
settings = {
color = theme.bg.dark;
indicator-caps-lock = true;
inside-color = theme.bg.dark;
inside-clear-color = theme.bg.dark;
inside-caps-lock-color = theme.bg.dark;
inside-ver-color = theme.bg.dark;
inside-wrong-color = theme.bg.dark;
ring-color = theme.secondary.dark;
ring-clear-color = theme.warning.dark;
ring-caps-lock-color = theme.primary.light;
ring-ver-color = theme.primary.dark;
ring-wrong-color = theme.error.dark;
text-color = theme.fg.dark;
text-clear-color = theme.fg.dark;
text-caps-lock-color = theme.fg.dark;
text-ver-color = theme.fg.dark;
text-wrong-color = theme.fg.dark;
key-hl-color = theme.primary.light;
bs-hl-color = theme.warning.dark;
line-color = "00000000";
line-clear-color = "00000000";
line-caps-lock-color = "00000000";
line-ver-color = "00000000";
line-wrong-color = "00000000";
separator-color = "00000000";
};
};
}

View File

@ -1,12 +1,12 @@
let
bg = {
light = "FAFAFA";
dark = "2E3440";
};
{
fg = {
light = "37474F";
dark = "ECEFF4";
};
bg = {
light = "FAFAFA";
dark = "2E3440";
};
primary = {
light = "673AB7";
dark = "81A1C1";
@ -15,20 +15,12 @@ let
light = "90A4AE";
dark = "677691";
};
in
{
services.darkman = {
enable = true;
settings.portal = true;
lightModeScripts.hyprland-light = ''
hyprctl keyword misc:background_color 0x${bg.light}
hyprctl keyword general:col.active_border 0xFF${primary.light}
hyprctl keyword general:col.inactive_border 0xFF${secondary.light}
'';
darkModeScripts.hyprland-dark = ''
hyprctl keyword misc:background_color 0x${bg.dark}
hyprctl keyword general:col.active_border 0xFF${primary.dark}
hyprctl keyword general:col.inactive_border 0xFF${secondary.dark}
'';
warning = {
light = "FF6F00";
dark = "EBCB8B";
};
error = {
light = "FFAB91";
dark = "D08770";
};
}

View File

@ -18,12 +18,19 @@
home = "/home/larstvei";
shell = pkgs.fish;
extraGroups = [
"dialout"
"networkmanager"
"wheel"
];
};
console.keyMap = "us";
services.xserver.xkb = {
layout = "us";
variant = "mac";
options = "lv3:alt_switch,apple:alupckeys";
};
console.useXkbConfig = true;
nixpkgs.config.allowUnfree = true;