From 807e8f177c18f9e06de517fc6e33c43e10a4a4e3 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 23 May 2023 11:59:07 +0100 Subject: [PATCH] feat: sway configuration - Change the mod key to Alt. - Change the keyboard input language to UK. - Replace dmenu with wofi. - Disable the laptop screen when used in clam mode (lid closed with an external monitor). - Override the GTK theme to ensure that a dark theme is used in all apps (e.g. Firefox). See: - https://github.com/swaywm/sway/wiki#clamshell-mode - https://wiki.archlinux.org/title/Sway#Keymap --- config/sway/config | 28 +++++++++++++++++++++-- config/sway/status.sh | 2 +- home-manager/nixedo.nix | 2 +- system/nixos/nixedo/configuration.nix | 33 +++++++++++++++++++++++---- 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/config/sway/config b/config/sway/config index 6524bfe..e46f75d 100644 --- a/config/sway/config +++ b/config/sway/config @@ -20,7 +20,7 @@ set $term alacritty # Your preferred application launcher # Note: pass the final command to swaymsg so that the resulting window can be opened # on the original workspace that the command was run on. -set $menu dmenu_path | dmenu | xargs swaymsg exec -- +set $menu wofi --show run ### Output configuration # @@ -32,8 +32,24 @@ output * bg /run/current-system/sw/share/backgrounds/sway/Sway_Wallpaper_Blue_19 # output HDMI-A-1 resolution 1920x1080 position 1920,0 # # You can get the names of your outputs by running: swaymsg -t get_outputs +output DP-7 resolution 2560x1440 scale 1.0 output eDP-1 scale 1.0 +set $laptop eDP-1 +bindswitch --reload --locked lid:on output $laptop disable +bindswitch --reload --locked lid:off output $laptop enable + +# bindsym $mod+1 [workspace="1"] move workspace to output current; workspace number 1 +# bindsym $mod+2 [workspace="2"] move workspace to output current; workspace number 2 +# bindsym $mod+3 [workspace="3"] move workspace to output current; workspace number 3 +# bindsym $mod+4 [workspace="4"] move workspace to output current; workspace number 4 +# bindsym $mod+5 [workspace="5"] move workspace to output current; workspace number 5 +# bindsym $mod+6 [workspace="6"] move workspace to output current; workspace number 6 +# bindsym $mod+7 [workspace="7"] move workspace to output current; workspace number 7 +# bindsym $mod+8 [workspace="8"] move workspace to output current; workspace number 8 +# bindsym $mod+9 [workspace="9"] move workspace to output current; workspace number 9 +# bindsym $mod+0 [workspace="10"] move workspace to output current; workspace number 10 + ### Idle configuration # # Example configuration: @@ -208,7 +224,7 @@ bar { # When the status_command prints a new line to stdout, swaybar updates. # The default just shows the current date and time. # status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done - status_command while ~/.config/sway/status.sh; do sleep 1; done + status_command while ~/.config/sway/status.sh; do sleep 10; done colors { statusline #ffffff @@ -219,6 +235,11 @@ bar { default_border pixel 3 +input * { + xkb_layout "gb" + # xkb_options "caps:swapescape" +} + input type:touchpad { tap enabled dwt enabled @@ -229,4 +250,7 @@ smart_borders on smart_gaps on gaps inner 10 +exec configure-gtk +exec configue-keyboard + include /etc/sway/config.d/* diff --git a/config/sway/status.sh b/config/sway/status.sh index 6842740..c9416b3 100755 --- a/config/sway/status.sh +++ b/config/sway/status.sh @@ -1,4 +1,4 @@ -date_formatted=$(date "+%m/%d/%Y - %l:%M %p - ") +date_formatted=$(date "+%d/%m/%Y - %l:%M %p - ") battery_status=$(cat /sys/class/power_supply/BAT0/capacity) diff --git a/home-manager/nixedo.nix b/home-manager/nixedo.nix index f1fec04..21cecca 100644 --- a/home-manager/nixedo.nix +++ b/home-manager/nixedo.nix @@ -36,5 +36,5 @@ }; }; - home.packages = with pkgs; [ discord meslo-lg slack teams vlc xcape zoom-us ]; + home.packages = with pkgs; [ discord meslo-lg slack teams vlc wofi xcape zoom-us ]; } diff --git a/system/nixos/nixedo/configuration.nix b/system/nixos/nixedo/configuration.nix index ef9b89e..70d18f0 100644 --- a/system/nixos/nixedo/configuration.nix +++ b/system/nixos/nixedo/configuration.nix @@ -4,7 +4,22 @@ { config, pkgs, ... }: -let nixpkgs = import ../../shared/nixpkgs.nix { }; +let + nixpkgs = import ../../shared/nixpkgs.nix { }; + + configure-gtk = pkgs.writeTextFile { + name = "configure-gtk"; + destination = "/bin/configure-gtk"; + executable = true; + text = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in '' + export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS + gnome_schema=org.gnome.desktop.interface + gsettings set $gnome_schema gtk-theme 'Breeze Dark' + ''; + }; in { nixpkgs = nixpkgs; @@ -103,14 +118,22 @@ in { # $ nix search wget environment.systemPackages = with pkgs; [ + configure-gtk swayidle swaylock ]; - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - }; + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions.