refactor
This commit is contained in:
parent
66c05f9093
commit
45d6f4b0f3
205 changed files with 9040 additions and 342 deletions
BIN
modules/nixos/desktop/sway/background.png
Normal file
BIN
modules/nixos/desktop/sway/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 MiB |
274
modules/nixos/desktop/sway/config
Normal file
274
modules/nixos/desktop/sway/config
Normal file
|
@ -0,0 +1,274 @@
|
|||
###########################################
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#░░█▀█░█░░░█░█░█▀▀░░░█░█░█░░░▀█▀░█▀▄░█▀█░░#
|
||||
#░░█▀▀░█░░░█░█░▀▀█░░░█░█░█░░░░█░░█▀▄░█▀█░░#
|
||||
#░░▀░░░▀▀▀░▀▀▀░▀▀▀░░░▀▀▀░▀▀▀░░▀░░▀░▀░▀░▀░░#
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
###########################################
|
||||
|
||||
|
||||
#########################################
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#░░█░█░█▀█░█▀▄░▀█▀░█▀█░█▀▄░█░░░█▀▀░█▀▀░░#
|
||||
#░░▀▄▀░█▀█░█▀▄░░█░░█▀█░█▀▄░█░░░█▀▀░▀▀█░░#
|
||||
#░░░▀░░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀░░▀▀▀░▀▀▀░▀▀▀░░#
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#########################################
|
||||
|
||||
# Modifier key (Mod1 = Alt, Mod4 = Meta)
|
||||
set $mod Mod4
|
||||
|
||||
# Movement keys
|
||||
set $left h
|
||||
set $down j
|
||||
set $up k
|
||||
set $right l
|
||||
|
||||
# Terminal
|
||||
set $term env @term@
|
||||
|
||||
# Swaylock
|
||||
set $swaylock swaylock-fancy -f "Hack-Regular-Nerd-Font-Complete"
|
||||
|
||||
# Menu
|
||||
set $menu-run wofi --show drun --prompt search
|
||||
|
||||
# Output names
|
||||
set $laptop-screen eDP-1
|
||||
# set $monitor-left HDMI-A-1
|
||||
# set $monitor-center HDMI-A-2
|
||||
|
||||
# Workspace names
|
||||
set $workspace1 1
|
||||
set $workspace2 2
|
||||
set $workspace3 3
|
||||
set $workspace4 4
|
||||
set $workspace5 5
|
||||
set $workspace6 6
|
||||
set $workspace7 7
|
||||
set $workspace8 8
|
||||
set $workspace9 9
|
||||
set $workspace10 10
|
||||
|
||||
#############################
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#░░█▀█░█░█░▀█▀░█▀█░█░█░▀█▀░░#
|
||||
#░░█░█░█░█░░█░░█▀▀░█░█░░█░░░#
|
||||
#░░▀▀▀░▀▀▀░░▀░░▀░░░▀▀▀░░▀░░░#
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#############################
|
||||
|
||||
# Backgrounds
|
||||
# output $monitor-left bg /home/short/Photos/wallpapers/left.jpg fill
|
||||
# output $monitor-center bg /home/short/Photos/wallpapers/center.jpg fill
|
||||
|
||||
# Positioning
|
||||
# output $monitor-left resolution 1920x1080 position 0,300
|
||||
# output $monitor-center resolution 1920x1080 position 1920,0
|
||||
|
||||
###################################################
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#░░█░█░█▀▀░█░█░░░█▀▄░▀█▀░█▀█░█▀▄░▀█▀░█▀█░█▀▀░█▀▀░░#
|
||||
#░░█▀▄░█▀▀░░█░░░░█▀▄░░█░░█░█░█░█░░█░░█░█░█░█░▀▀█░░#
|
||||
#░░▀░▀░▀▀▀░░▀░░░░▀▀░░▀▀▀░▀░▀░▀▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀░░#
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
###################################################
|
||||
|
||||
# Start a terminal
|
||||
bindsym $mod+Return exec $term
|
||||
|
||||
# Kill focused window
|
||||
bindsym $mod+q kill
|
||||
|
||||
# Reload configuration
|
||||
bindsym $mod+Shift+r reload
|
||||
|
||||
# Exit sway
|
||||
bindsym $mod+Shift+e exit
|
||||
|
||||
# Lock
|
||||
bindsym $mod+Control+l exec $swaylock
|
||||
|
||||
# Open run menu
|
||||
bindsym $mod+d exec $menu-run
|
||||
|
||||
# Drag floating windows while holding down modifier key
|
||||
floating_modifier $mod normal
|
||||
|
||||
# Sticky windows
|
||||
bindsym $mod+Shift+s sticky toggle
|
||||
|
||||
# Toggle fullscreen
|
||||
bindsym $mod+f fullscreen
|
||||
|
||||
# Toggle floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# Toggle floating focus
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# Focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# Focus the child container
|
||||
bindsym $mod+c focus child
|
||||
|
||||
# Split horizontal
|
||||
bindsym $mod+b splith
|
||||
|
||||
# Split vertical
|
||||
bindsym $mod+v splitv
|
||||
|
||||
# Move window into scratchpad
|
||||
bindsym $mod+Shift+minus move scratchpad
|
||||
|
||||
# Get window out of scratchpad
|
||||
bindsym $mod+minus scratchpad show
|
||||
|
||||
# Change layout style
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
bindsym $mod+Shift+v layout splitv
|
||||
bindsym $mod+Shift+b layout splith
|
||||
|
||||
# Moving focus
|
||||
bindsym $mod+$left focus left
|
||||
bindsym $mod+$down focus down
|
||||
bindsym $mod+$up focus up
|
||||
bindsym $mod+$right focus right
|
||||
|
||||
# Moving windows
|
||||
bindsym $mod+Shift+$left move left
|
||||
bindsym $mod+Shift+$down move down
|
||||
bindsym $mod+Shift+$up move up
|
||||
bindsym $mod+Shift+$right move right
|
||||
|
||||
# Switching workspace
|
||||
bindsym $mod+1 workspace $workspace1
|
||||
bindsym $mod+2 workspace $workspace2
|
||||
bindsym $mod+3 workspace $workspace3
|
||||
bindsym $mod+4 workspace $workspace4
|
||||
bindsym $mod+5 workspace $workspace5
|
||||
bindsym $mod+6 workspace $workspace6
|
||||
bindsym $mod+7 workspace $workspace7
|
||||
bindsym $mod+8 workspace $workspace8
|
||||
bindsym $mod+9 workspace $workspace9
|
||||
bindsym $mod+0 workspace $workspace10
|
||||
|
||||
# Moving windows to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace $workspace1
|
||||
bindsym $mod+Shift+2 move container to workspace $workspace2
|
||||
bindsym $mod+Shift+3 move container to workspace $workspace3
|
||||
bindsym $mod+Shift+4 move container to workspace $workspace4
|
||||
bindsym $mod+Shift+5 move container to workspace $workspace5
|
||||
bindsym $mod+Shift+6 move container to workspace $workspace6
|
||||
bindsym $mod+Shift+7 move container to workspace $workspace7
|
||||
bindsym $mod+Shift+8 move container to workspace $workspace8
|
||||
bindsym $mod+Shift+9 move container to workspace $workspace9
|
||||
bindsym $mod+Shift+0 move container to workspace $workspace10
|
||||
|
||||
# Brightness
|
||||
bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||
bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||
|
||||
# Sound
|
||||
bindsym XF86AudioMute exec pulsemixer --toggle-mute
|
||||
bindsym XF86AudioRaiseVolume exec pulsemixer --change-volume +10
|
||||
bindsym XF86AudioLowerVolume exec pulsemixer --change-volume -10
|
||||
|
||||
# Media
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
bindsym XF86AudioPlay exec playerctl play-pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
|
||||
# Print screen
|
||||
bindsym Print exec grimshot --notify save screen - | swappy -f -
|
||||
bindsym Shift+Print exec grimshot --notify save area - | swappy -f -
|
||||
bindsym Control+Print exec grimshot --notify save window - | swappy -f -
|
||||
bindsym $mod+Print exec grimshot --notify copy screen
|
||||
bindsym $mod+Shift+Print exec grimshot --notify copy area
|
||||
bindsym $mod+Control+Print exec grimshot --notify copy window
|
||||
|
||||
# Airplane mode
|
||||
# bindsym XF86RFKill exec nmcli radio all $(test $(nmcli -g wifi radio all) == "enabled" && "off" || echo "on")
|
||||
|
||||
# Resize mode
|
||||
mode "resize" {
|
||||
# Shrink the width
|
||||
bindsym $left resize shrink width 10px
|
||||
|
||||
# Grow the width
|
||||
bindsym $right resize grow width 10px
|
||||
|
||||
# Grow the height
|
||||
bindsym $up resize grow height 10px
|
||||
|
||||
# Shrink the height
|
||||
bindsym $down resize shrink height 10px
|
||||
|
||||
# Return to default mode
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
}
|
||||
|
||||
# Enter resize mode
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
######################
|
||||
#░░░░░░░░░░░░░░░░░░░░#
|
||||
#░▀█▀░█▀█░█▀█░█░█░▀█▀#
|
||||
#░░█░░█░█░█▀▀░█░█░░█░#
|
||||
#░▀▀▀░▀░▀░▀░░░▀▀▀░░▀░#
|
||||
#░░░░░░░░░░░░░░░░░░░░#
|
||||
######################
|
||||
|
||||
input type:keyboard {
|
||||
xkb_options caps:swapescape
|
||||
}
|
||||
|
||||
input type:touchpad {
|
||||
natural_scroll enabled
|
||||
tap enabled
|
||||
tap_button_map lrm
|
||||
}
|
||||
|
||||
#################
|
||||
#░░░░░░░░░░░░░░░#
|
||||
#░░█▀▄░█▀█░█▀▄░░#
|
||||
#░░█▀▄░█▀█░█▀▄░░#
|
||||
#░░▀▀░░▀░▀░▀░▀░░#
|
||||
#░░░░░░░░░░░░░░░#
|
||||
#################
|
||||
|
||||
bar {
|
||||
# Run waybar
|
||||
swaybar_command waybar
|
||||
}
|
||||
|
||||
#########################
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#░░█▀▀░▀█▀░█░█░█░░░█▀▀░░#
|
||||
#░░▀▀█░░█░░░█░░█░░░█▀▀░░#
|
||||
#░░▀▀▀░░▀░░░▀░░▀▀▀░▀▀▀░░#
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#########################
|
||||
|
||||
# Remove title bars
|
||||
default_border pixel 1
|
||||
default_floating_border pixel 1
|
||||
|
||||
client.focused #8fbcbb #8fbcbb #eceff4 #eceff4
|
||||
client.focused_inactive #2E3440 #2E3440 #e5e9f0 #5e81ac
|
||||
client.unfocused #3b4252 #3b4252 #4c566a #5e81ac
|
||||
client.urgent #d08770 #d08770 #eceff4 #bf616a
|
||||
|
||||
for_window [app_id="wofi"] border none
|
||||
# for_window [app_id="firefox"] border none
|
||||
|
||||
# Don't focus moused over windows
|
||||
focus_follows_mouse no
|
||||
|
||||
# Gaps
|
||||
gaps outer 4
|
||||
gaps inner 5
|
148
modules/nixos/desktop/sway/default.nix
Normal file
148
modules/nixos/desktop/sway/default.nix
Normal file
|
@ -0,0 +1,148 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let
|
||||
cfg = config.plusultra.desktop.sway;
|
||||
term = config.plusultra.desktop.addons.term;
|
||||
substitutedConfig = pkgs.substituteAll {
|
||||
src = ./config;
|
||||
term = term.pkg.pname or term.pkg.name;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.plusultra.desktop.sway = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to enable Sway.";
|
||||
wallpaper = mkOpt (nullOr package) null "The wallpaper to display.";
|
||||
extraConfig =
|
||||
mkOpt str "" "Additional configuration for the Sway config file.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Desktop additions
|
||||
plusultra.desktop.addons = {
|
||||
gtk = enabled;
|
||||
foot = enabled;
|
||||
mako = enabled;
|
||||
rofi = enabled;
|
||||
wofi = enabled;
|
||||
swappy = enabled;
|
||||
kanshi = enabled;
|
||||
waybar = enabled;
|
||||
keyring = enabled;
|
||||
nautilus = enabled;
|
||||
xdg-portal = enabled;
|
||||
electron-support = enabled;
|
||||
};
|
||||
|
||||
plusultra.home.configFile."sway/config".text =
|
||||
fileWithText substitutedConfig ''
|
||||
#############################
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#░░█▀▀░█░█░█▀▀░▀█▀░█▀▀░█▄█░░#
|
||||
#░░▀▀█░░█░░▀▀█░░█░░█▀▀░█░█░░#
|
||||
#░░▀▀▀░░▀░░▀▀▀░░▀░░▀▀▀░▀░▀░░#
|
||||
#░░░░░░░░░░░░░░░░░░░░░░░░░░░#
|
||||
#############################
|
||||
|
||||
# Launch services waiting for the systemd target sway-session.target
|
||||
exec "systemctl --user import-environment; systemctl --user start sway-session.target"
|
||||
|
||||
# Start a user session dbus (required for things like starting
|
||||
# applications through wofi).
|
||||
exec dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus
|
||||
|
||||
${optionalString (cfg.wallpaper != null) ''
|
||||
output * {
|
||||
bg ${cfg.wallpaper.gnomeFilePath or cfg.wallpaper} fill
|
||||
}
|
||||
''}
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
programs.sway = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
rofi
|
||||
swaylock
|
||||
swayidle
|
||||
xwayland
|
||||
sway-contrib.grimshot
|
||||
swaylock-fancy
|
||||
wl-clipboard
|
||||
wf-recorder
|
||||
libinput
|
||||
playerctl
|
||||
brightnessctl
|
||||
glib # for gsettings
|
||||
gtk3.out # for gtk-launch
|
||||
gnome.gnome-control-center
|
||||
];
|
||||
|
||||
extraSessionCommands = ''
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
export XDG_SESSION_DESKTOP=sway
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs;
|
||||
[
|
||||
(pkgs.writeTextFile {
|
||||
name = "startsway";
|
||||
destination = "/bin/startsway";
|
||||
executable = true;
|
||||
text = ''
|
||||
#! ${pkgs.bash}/bin/bash
|
||||
|
||||
# Import environment variables from the login manager
|
||||
systemctl --user import-environment
|
||||
|
||||
# Start Sway
|
||||
exec systemctl --user start sway.service
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
# configuring sway itself (assmung a display manager starts it)
|
||||
systemd.user.targets.sway-session = {
|
||||
description = "Sway compositor session";
|
||||
documentation = [ "man:systemd.special(7)" ];
|
||||
bindsTo = [ "graphical-session.target" ];
|
||||
wants = [ "graphical-session-pre.target" ];
|
||||
after = [ "graphical-session-pre.target" ];
|
||||
};
|
||||
|
||||
systemd.user.services.sway = {
|
||||
description = "Sway - Wayland window manager";
|
||||
documentation = [ "man:sway(5)" ];
|
||||
bindsTo = [ "graphical-session.target" ];
|
||||
wants = [ "graphical-session-pre.target" ];
|
||||
after = [ "graphical-session-pre.target" ];
|
||||
# We explicitly unset PATH here, as we want it to be set by
|
||||
# systemctl --user import-environment in startsway
|
||||
environment.PATH = lib.mkForce null;
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = ''
|
||||
${pkgs.dbus}/bin/dbus-run-session ${pkgs.sway}/bin/sway --debug
|
||||
'';
|
||||
Restart = "on-failure";
|
||||
RestartSec = 1;
|
||||
TimeoutStopSec = 10;
|
||||
};
|
||||
};
|
||||
|
||||
services.xserver.enable = true;
|
||||
services.xserver.displayManager.defaultSession = "sway";
|
||||
services.xserver.displayManager.gdm.enable = true;
|
||||
services.xserver.displayManager.gdm.wayland = true;
|
||||
services.xserver.libinput.enable = true;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue