🇳🇴/🇬🇧 Locale switcher

- Added no to list of keyboard locales.
- Added no and gb to list of supported locales.
- Added a waybar language switcher, that can be clicked to toggle
- Toggle languages using ALT+SHIFT
- Enable numlock at boot
This commit is contained in:
Martin Berg Alstad 2024-12-30 20:21:06 +01:00
parent 4a5cd5dd73
commit b28a7d7fbb
Signed by: martials
GPG Key ID: A3824877B269F2E2
5 changed files with 67 additions and 49 deletions

View File

@ -17,33 +17,13 @@
./networking.nix
./development.nix
./security.nix
./locale.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Set your time zone.
time.timeZone = "Europe/Oslo";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "nb_NO.UTF-8";
LC_IDENTIFICATION = "nb_NO.UTF-8";
LC_MEASUREMENT = "nb_NO.UTF-8";
LC_MONETARY = "nb_NO.UTF-8";
LC_NAME = "nb_NO.UTF-8";
LC_NUMERIC = "nb_NO.UTF-8";
LC_PAPER = "nb_NO.UTF-8";
LC_TELEPHONE = "nb_NO.UTF-8";
LC_TIME = "nb_NO.UTF-8";
};
# Configure console keymap
console.keyMap = "uk";
# Define a user account. Don't forget to set a password with passwd.
users.users.martin = {
isNormalUser = true;
@ -124,6 +104,7 @@
services = {
displayManager.sddm = {
enable = true;
autoNumlock = true; # Enable numlock at login
wayland.enable = true;
};
@ -135,11 +116,6 @@
enable = true;
# Load Nvidia driver for Xorg and Wayland
videoDrivers = [ "nvidia" ];
# Configure keymap in X11
xkb = {
layout = "gb";
variant = "";
};
};
};
@ -156,26 +132,19 @@
};
};
qt = {
enable = true;
#platformTheme = "gnome";
#style = "adwaita-dark";
};
qt.enable = true;
# Enable OpenGL
hardware.graphics = {
enable = true;
};
hardware.nvidia = {
# Required
modesetting.enable = true;
# Use closed-source drivers
open = false;
# Enable the Nvidia settings menu
nvidiaSettings = true;
hardware = {
graphics.enable = true;
nvidia = {
# Required
modesetting.enable = true;
# Use closed-source drivers
open = false;
# Enable the Nvidia settings menu
nvidiaSettings = true;
};
};
xdg.mime.defaultApplications = {

View File

@ -254,11 +254,12 @@ misc {
#############
# https://wiki.hyprland.org/Configuring/Variables/#input
# Must match configs in nixos!
input {
kb_layout = gb
kb_layout = gb,no
kb_variant =
kb_model =
kb_options =
kb_options = grp:alt_shift_toggle
kb_rules =
follow_mouse = 1

View File

@ -13,11 +13,12 @@
"hyprland/window"
],
"modules-right": [
"hyprland/language",
"wireplumber",
"backlight",
"clock",
"tray",
"custom/notification",
"tray",
"custom/lock",
"custom/power"
],
@ -87,6 +88,12 @@
},
"on-click": "pavucontrol"
},
"hyprland/language": {
"format-en": "EN",
"format-no": "NO",
"keyboard-name": "logitech-logitech-g710-keyboard",
"on-click": "hyprctl switchxkblayout logitech-logitech-g710-keyboard next"
},
"custom/lock": {
"tooltip": false,
"on-click": "sh -c '(sleep 0.5s; swaylock)' & disown",

View File

@ -35,6 +35,7 @@
border-radius: 1rem;
}
#language,
#window,
#custom-notification,
#custom-music,
@ -61,10 +62,14 @@
border-radius: 0;
}
#language {
color: @red;
border-radius: 1rem 0 0 1rem;
margin-left: 1rem;
}
#wireplumber {
color: @maroon;
border-radius: 1rem 0px 0px 1rem;
margin-left: 1rem;
}
#custom-music {

36
locale.nix Normal file
View File

@ -0,0 +1,36 @@
{ ... }:
# TODO move locale config for hyprland here
{
# Configure console keymap
console.keyMap = "uk";
# Select internationalisation properties.
i18n = {
defaultLocale = "en_GB.UTF-8";
supportedLocales = [
"en_GB.UTF-8/UTF-8"
"nb_NO.UTF-8/UTF-8"
];
extraLocaleSettings = {
LC_ADDRESS = "nb_NO.UTF-8";
LC_IDENTIFICATION = "nb_NO.UTF-8";
LC_MEASUREMENT = "nb_NO.UTF-8";
LC_MONETARY = "nb_NO.UTF-8";
LC_NAME = "nb_NO.UTF-8";
LC_NUMERIC = "nb_NO.UTF-8";
LC_PAPER = "nb_NO.UTF-8";
LC_TELEPHONE = "nb_NO.UTF-8";
LC_TIME = "nb_NO.UTF-8";
};
};
# Configure keymaps
services.xserver.xkb = {
layout = "gb,no";
options = "grp:alt_shift_toggle"; # Toggle using ALT + SHIFT
};
# Set your time zone.
time.timeZone = "Europe/Oslo";
}