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
This commit is contained in:
Oliver Davies 2023-05-23 11:59:07 +01:00
parent 581dc96157
commit 807e8f177c
4 changed files with 56 additions and 9 deletions

View file

@ -20,7 +20,7 @@ set $term alacritty
# Your preferred application launcher # Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened # 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. # 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 ### 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 # output HDMI-A-1 resolution 1920x1080 position 1920,0
# #
# You can get the names of your outputs by running: swaymsg -t get_outputs # 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 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 ### Idle configuration
# #
# Example configuration: # Example configuration:
@ -208,7 +224,7 @@ bar {
# When the status_command prints a new line to stdout, swaybar updates. # When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time. # 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 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 { colors {
statusline #ffffff statusline #ffffff
@ -219,6 +235,11 @@ bar {
default_border pixel 3 default_border pixel 3
input * {
xkb_layout "gb"
# xkb_options "caps:swapescape"
}
input type:touchpad { input type:touchpad {
tap enabled tap enabled
dwt enabled dwt enabled
@ -229,4 +250,7 @@ smart_borders on
smart_gaps on smart_gaps on
gaps inner 10 gaps inner 10
exec configure-gtk
exec configue-keyboard
include /etc/sway/config.d/* include /etc/sway/config.d/*

View file

@ -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) battery_status=$(cat /sys/class/power_supply/BAT0/capacity)

View file

@ -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 ];
} }

View file

@ -4,7 +4,22 @@
{ config, pkgs, ... }: { 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 { in {
nixpkgs = nixpkgs; nixpkgs = nixpkgs;
@ -103,14 +118,22 @@ in {
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs;
[ [
configure-gtk
swayidle swayidle
swaylock swaylock
]; ];
programs.sway = { xdg.portal = {
enable = true; enable = true;
wrapperFeatures.gtk = 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 # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.