From 0c0e98b61ad550c64bf8b9ae8a7c8477763c7fbd Mon Sep 17 00:00:00 2001 From: vorboyvo Date: Sat, 13 Apr 2024 23:18:20 -0400 Subject: [PATCH] Changed locale settings to French. Abandoned fcitx5 and switched to wayland-native keyboard layout management. Changed various other settings to help with the last. Added gammastep for night shift. --- configuration.nix | 2 +- home.nix | 32 +++++++++++++++++++++----------- programs/sway.nix | 21 +++++++++++++-------- programs/waybar.nix | 10 ++++++++-- scripts/shutdownmenu.sh | 12 ++++++------ 5 files changed, 49 insertions(+), 28 deletions(-) diff --git a/configuration.nix b/configuration.nix index 11b16de..fc4f2af 100644 --- a/configuration.nix +++ b/configuration.nix @@ -45,7 +45,7 @@ time.timeZone = "America/Montreal"; # Select internationalization properties. - i18n.defaultLocale = "en_CA.UTF-8"; + i18n.defaultLocale = "fr_CA.UTF-8"; console = { font = "Lat2-Terminus16"; keyMap = "us"; diff --git a/home.nix b/home.nix index aeffde7..8d9747c 100644 --- a/home.nix +++ b/home.nix @@ -8,7 +8,7 @@ in { home.username = "alice"; home.homeDirectory = "/home/alice"; - + home.stateVersion = "23.11"; # Configure cursor @@ -27,11 +27,25 @@ in }; }; + # Configure internationalization + # i18n.inputMethod.enabled = "fcitx5"; + # Configure xdg-desktop-portal (for file picker, etc.) # xdg.portal = { # enable = true; # }; + # Configure gammastep (night shift) + services.gammastep = { + enable = true; + temperature.day = 6500; + temperature.night = 4000; + # boul robert-bourassa/boul rené-lévesque : 45.498743909804354, -73.5703457606738 + latitude = 45.4987; + longitude = -73.5703; + tray = true; + }; + # Install packages home.packages = with pkgs; @@ -53,15 +67,15 @@ in [ firefox cinnamon.nemo gnome.file-roller cinnamon.nemo-fileroller evince imv vlc pavucontrol ] ++ # Basic graphical apps [ libreoffice signal-desktop element-desktop prismlauncher mumble gimp inkscape deluge-gtk shotwell lorien ] ++ # Personalized selection of graphical apps [ mons ] ++ # Games - [ swaybg bemenu j4-dmenu-desktop fcitx5-with-addons ] ++ # Sway- and Wayland-related packages + [ swaybg bemenu j4-dmenu-desktop ] ++ # Sway- and Wayland-related packages [ noto-fonts redhat-official-fonts overpass ibm-plex rubik archivo font-awesome ] ++ # Fonts # [ papirus-icon-theme ] ++ # Icons # [ vanilla-dmz ] ++ # Cursor [ ] ++ # Temp [ ]; - + programs.home-manager.enable = true; - + # Enabling bash from home-manager means environment variables set by HM get set correctly # Worst case, fallback to bash. programs.zsh = { @@ -72,10 +86,6 @@ in ''; profileExtra = '' export VISUAL=nvim - # Enable fcitx for sway - #export GTK_IM_MODULE=fcitx - #export QT_IM_MODULE=fcitx - #export XMODIFIERS=@im=fcitx # If running from tty1 start sway [ "$(tty)" = "/dev/tty1" ] && exec sway ''; @@ -90,9 +100,9 @@ in core.editor = "kak"; }; }; - + wayland.windowManager.sway = import ./programs/sway.nix { inherit scripts extra config lib pkgs terminal; }; - + programs.waybar = import ./programs/waybar.nix { inherit scripts config lib pkgs terminal; }; programs.swaylock = { @@ -111,7 +121,7 @@ in home.sessionVariables = { NIXOS_OZONE_WL = "1"; }; - + # configure fonts correctly fonts.fontconfig.enable = true; xdg.configFile."fontconfig/conf.d/20-default.fonts.conf".source = "${extra}/20-default-fonts.conf"; diff --git a/programs/sway.nix b/programs/sway.nix index f30fdf3..356d295 100644 --- a/programs/sway.nix +++ b/programs/sway.nix @@ -1,6 +1,5 @@ { scripts, extra, config, lib, pkgs, terminal, ... }@inputs: - let dynscreenshot = pkgs.writeShellScript "dynscreenshot" (builtins.readFile "${scripts}/dynscreenshot.sh"); changebrightness = pkgs.writeShellScript "changebrightness" (builtins.readFile "${scripts}/changebrightness.sh"); @@ -18,11 +17,17 @@ in { style = "Regular"; size = 12.0; }; - input."type:touchpad" = { + input = { + "type:touchpad" = { natural_scroll = "disabled"; - dwt = "disabled"; - click_method = "clickfinger"; - scroll_factor = "0.5"; + dwt = "disabled"; + click_method = "clickfinger"; + scroll_factor = "0.5"; + }; + "*" = { + xkb_layout = "ca,ca"; + xkb_variant = ",eng"; + }; }; bars = let config = config; in [{ command = "${pkgs.lib.getExe pkgs.waybar}"; @@ -50,7 +55,7 @@ in { XF86AudioMedia = "dunstctl set-paused toggle; dunstify -a 'dunst_mute_key' -u low -h string:x-dunst-stack-tag:dunst_mute_key 'Notifications mute toggled'"; XF86PowerOff = "exec DMENU_COMMAND='${dmenuCommand}' bash ${shutdownMenu}"; } // { - "${mod}+space" = "exec fcitx5-remote -t"; + "${mod}+space" = "input \"*\" xkb_switch_layout next"; } // { }); menu = "j4-dmenu-desktop --no-generic --term=${pkgs.lib.getExe inputs.terminal} --dmenu='${dmenuCommand}'"; @@ -61,8 +66,8 @@ in { output 'eDP-1' scale 1.50 '' + # Fractional scaling to 1.50 '' - exec fcitx5 - '' + # Fcitx5 enables input method switching + exec gammastep-indicator + '' + # gammastep-indicator enables red shift '' exec dunst '' + # Enable notifications diff --git a/programs/waybar.nix b/programs/waybar.nix index d261541..06ebe6c 100644 --- a/programs/waybar.nix +++ b/programs/waybar.nix @@ -7,7 +7,7 @@ in enable = true; settings = [{ modules-left = [ "sway/workspaces" ]; - modules-right = [ "pulseaudio" "bluetooth" "network" "cpu" "memory" "disk" "battery" "tray" "clock" ]; + modules-right = [ "pulseaudio" "bluetooth" "network" "cpu" "memory" "disk" "battery" "tray" "sway/language" "clock" ]; "sway/workspaces" = { enable-bar-scroll = true; disable-scroll-wraparound = true; @@ -71,9 +71,15 @@ in icon-size = 20; spacing = 5; }; + "sway/language" = { + format = "eriuu"; + tooltip-format = "boofer"; + on-click = "swaymsg input \"*\" xkb_switch_layout next"; + }; clock = { interval = 1; - format = "{:%H:%M:%S %a %F}"; + format = "{:L%H:%M:%S %a %F}"; + locale = "fr_CA.utf8"; # TODO fix this; I don't want it to be hardcoded but rather tied to i18n.defaultLocale tooltip-format = "{:%Y %B}\n{calendar}"; }; }]; diff --git a/scripts/shutdownmenu.sh b/scripts/shutdownmenu.sh index a6157d4..69745f3 100644 --- a/scripts/shutdownmenu.sh +++ b/scripts/shutdownmenu.sh @@ -1,17 +1,17 @@ -case `printf "Cancel\nSuspend\nPower Off\nReboot\nLog Out" | $DMENU_COMMAND` in - "Cancel") +case `printf "Annuler\nSuspendre\nÉteindre\nRedémarrer\nQuitter" | $DMENU_COMMAND` in + "Annuler") : ;; - "Suspend") + "Suspendre") systemctl suspend ;; - "Power Off") + "Éteindre") systemctl poweroff ;; - "Reboot") + "Redémarrer") systemctl reboot ;; - "Log Out") + "Quitter") swaymsg exit ;; esac