Compare commits

..

3 Commits

View File

@@ -6,8 +6,8 @@ let
cfg = config.sane.gui.sway; cfg = config.sane.gui.sway;
# docs: https://github.com/Alexays/Waybar/wiki/Configuration # docs: https://github.com/Alexays/Waybar/wiki/Configuration
# format specifiers: https://fmt.dev/latest/syntax.html#syntax # format specifiers: https://fmt.dev/latest/syntax.html#syntax
waybar-config = { waybar-config = [
mainBar = { { # TOP BAR
layer = "top"; layer = "top";
height = 40; height = 40;
modules-left = ["sway/workspaces" "sway/mode"]; modules-left = ["sway/workspaces" "sway/mode"];
@@ -68,10 +68,9 @@ let
clock = { clock = {
format-alt = "{:%a, %d. %b %H:%M}"; format-alt = "{:%a, %d. %b %H:%M}";
}; };
}; }
}; ];
# waybar-config-text = lib.generators.toJSON {} waybar-config; waybar-config-text = lib.generators.toJSON {} waybar-config;
waybar-config-text = (pkgs.formats.json {}).generate "waybar-config.json" waybar-config;
in in
{ {
options = { options = {
@@ -84,13 +83,18 @@ in
launch sway via a greeter (like greetd's gtkgreet). launch sway via a greeter (like greetd's gtkgreet).
sway is usable without a greeter, but skipping the greeter means no PAM session. sway is usable without a greeter, but skipping the greeter means no PAM session.
''; '';
default = false; default = true;
type = types.bool; type = types.bool;
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
sane.gui.enable = true; sane.gui.enable = true;
programs.sway = {
# we configure sway with home-manager, but this enable gets us e.g. opengl and fonts
enable = true;
};
# instead of using `services.greetd`, can instead use SDDM by swapping in these lines. # instead of using `services.greetd`, can instead use SDDM by swapping in these lines.
# services.xserver.displayManager.sddm.enable = true; # services.xserver.displayManager.sddm.enable = true;
# services.xserver.enable = true; # services.xserver.enable = true;
@@ -99,9 +103,6 @@ in
# `-l` activates layer-shell mode. # `-l` activates layer-shell mode.
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway" exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway"
''; '';
sway-launcher = pkgs.writeShellScript "sway-launcher" ''
${pkgs.sway}/bin/sway --debug > /home/colin/.sway.log 2>&1
'';
default_session = { default_session = {
"01" = { "01" = {
# greeter session config # greeter session config
@@ -113,7 +114,7 @@ in
}; };
"0" = { "0" = {
# no greeter # no greeter
command = sway-launcher; command = "${pkgs.sway}/bin/sway";
user = "colin"; user = "colin";
}; };
}; };
@@ -156,18 +157,14 @@ in
# a system service can't depend on a user service, so just launch it at graphical-session # a system service can't depend on a user service, so just launch it at graphical-session
systemd.user.services."pipewire".wantedBy = [ "graphical-session.target" ]; systemd.user.services."pipewire".wantedBy = [ "graphical-session.target" ];
programs.sway = { sane.home-manager.windowManager.sway = {
enable = true; enable = true;
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
}; config = let
sane.fs."/home/colin/.config/sway/config" =
let
fuzzel = "${pkgs.fuzzel}/bin/fuzzel"; fuzzel = "${pkgs.fuzzel}/bin/fuzzel";
sed = "${pkgs.gnused}/bin/sed"; sed = "${pkgs.gnused}/bin/sed";
wtype = "${pkgs.wtype}/bin/wtype"; wtype = "${pkgs.wtype}/bin/wtype";
kitty = "${pkgs.kitty}/bin/kitty"; kitty = "${pkgs.kitty}/bin/kitty";
launcher-cmd = fuzzel;
terminal-cmd = kitty;
lock-cmd = "${pkgs.swaylock}/bin/swaylock --indicator-idle-visible --indicator-radius 100 --indicator-thickness 30"; lock-cmd = "${pkgs.swaylock}/bin/swaylock --indicator-idle-visible --indicator-radius 100 --indicator-thickness 30";
vol-up-cmd = "${pkgs.pulsemixer}/bin/pulsemixer --change-volume +5"; vol-up-cmd = "${pkgs.pulsemixer}/bin/pulsemixer --change-volume +5";
vol-down-cmd = "${pkgs.pulsemixer}/bin/pulsemixer --change-volume -5"; vol-down-cmd = "${pkgs.pulsemixer}/bin/pulsemixer --change-volume -5";
@@ -184,158 +181,181 @@ in
snip-cmd = "${wtype} $(${list-snips} | ${fuzzel} -d -i -w 60 | ${strip-comments})"; snip-cmd = "${wtype} $(${list-snips} | ${fuzzel} -d -i -w 60 | ${strip-comments})";
# TODO: next splatmoji release should allow `-s none` to disable skin tones # TODO: next splatmoji release should allow `-s none` to disable skin tones
emoji-cmd = "${pkgs.splatmoji}/bin/splatmoji -s medium-light type"; emoji-cmd = "${pkgs.splatmoji}/bin/splatmoji -s medium-light type";
in sane-lib.fs.wantedText '' in rec {
### default font terminal = kitty;
font pango:monospace 8 window = {
border = 3; # pixel boundary between windows
hideEdgeBorders = "smart"; # don't show border if only window on workspace
};
output = {
### DESKTOP
"Samsung Electric Company S22C300 0x00007F35" = { pos = "0,0"; res = "1920x1080"; };
"Goldstar Company Ltd LG ULTRAWIDE 0x00004E94" = { pos = "1920,0"; res = "3440x1440"; };
### pixel boundary between windows ### LAPTOP
default_border pixel 3 # shen TV
default_floating_border pixel 2 "Pioneer Electronic Corporation VSX-524 0x00000101" = { pos = "0,0"; res = "1920x1080"; };
hide_edge_borders smart # internal display
"Unknown 0x0637 0x00000000" = { pos = "1920,0"; res = "1920x1080"; };
};
### defaults # defaults; required for keybindings decl.
focus_wrapping no modifier = "Mod1";
focus_follows_mouse yes # list of launchers: https://www.reddit.com/r/swaywm/comments/v39hxa/your_favorite_launcher/
focus_on_window_activation smart # menu = "${pkgs.dmenu}/bin/dmenu_path";
mouse_warping output menu = fuzzel;
workspace_layout default # menu = "${pkgs.albert}/bin/albert";
workspace_auto_back_and_forth no left = "h";
down = "j";
up = "k";
right = "l";
# XKB key names: https://wiki.linuxquestions.org/wiki/List_of_Keysyms_Recognised_by_Xmodmap
keybindings = {
"${modifier}+Return" = "exec ${terminal}";
"${modifier}+Shift+q" = "kill";
"${modifier}+d" = "exec ${menu}";
"${modifier}+s" = "exec ${snip-cmd}";
"${modifier}+l" = "exec ${lock-cmd}";
"${modifier}+slash" = "exec ${emoji-cmd}";
### default colors (#border #background #text #indicator #childBorder) # "${modifier}+${left}" = "focus left";
client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 # "${modifier}+${down}" = "focus down";
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a # "${modifier}+${up}" = "focus up";
client.unfocused #333333 #222222 #888888 #292d2e #222222 # "${modifier}+${right}" = "focus right";
client.urgent #2f343a #900000 #ffffff #900000 #900000
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
client.background #ffffff
### key bindings "${modifier}+Left" = "focus left";
floating_modifier Mod1 "${modifier}+Down" = "focus down";
## media keys "${modifier}+Up" = "focus up";
bindsym XF86AudioRaiseVolume exec ${vol-up-cmd} "${modifier}+Right" = "focus right";
bindsym XF86AudioLowerVolume exec ${vol-down-cmd}
bindsym Mod1+Page_Up exec ${vol-up-cmd}
bindsym Mod1+Page_Down exec ${vol-down-cmd}
bindsym XF86AudioMute exec ${mute-cmd}
bindsym XF86MonBrightnessUp exec ${brightness-up-cmd}
bindsym XF86MonBrightnessDown exec ${brightness-down-cmd}
## special functions
bindsym Mod1+Print exec ${screenshot-cmd}
bindsym Mod1+l exec ${lock-cmd}
bindsym Mod1+s exec ${snip-cmd}
bindsym Mod1+slash exec ${emoji-cmd}
bindsym Mod1+d exec ${launcher-cmd}
bindsym Mod1+Return exec ${terminal-cmd}
bindsym Mod1+Shift+q kill
bindsym Mod1+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
bindsym Mod1+Shift+c reload
## layout
bindsym Mod1+b splith
bindsym Mod1+v splitv
bindsym Mod1+f fullscreen toggle
bindsym Mod1+a focus parent
bindsym Mod1+w layout tabbed
bindsym Mod1+e layout toggle split
bindsym Mod1+Shift+space floating toggle
bindsym Mod1+space focus mode_toggle
bindsym Mod1+r mode resize
## movement
bindsym Mod1+Up focus up
bindsym Mod1+Down focus down
bindsym Mod1+Left focus left
bindsym Mod1+Right focus right
bindsym Mod1+Shift+Up move up
bindsym Mod1+Shift+Down move down
bindsym Mod1+Shift+Left move left
bindsym Mod1+Shift+Right move right
## workspaces
bindsym Mod1+1 workspace number 1
bindsym Mod1+2 workspace number 2
bindsym Mod1+3 workspace number 3
bindsym Mod1+4 workspace number 4
bindsym Mod1+5 workspace number 5
bindsym Mod1+6 workspace number 6
bindsym Mod1+7 workspace number 7
bindsym Mod1+8 workspace number 8
bindsym Mod1+9 workspace number 9
bindsym Mod1+Shift+1 move container to workspace number 1
bindsym Mod1+Shift+2 move container to workspace number 2
bindsym Mod1+Shift+3 move container to workspace number 3
bindsym Mod1+Shift+4 move container to workspace number 4
bindsym Mod1+Shift+5 move container to workspace number 5
bindsym Mod1+Shift+6 move container to workspace number 6
bindsym Mod1+Shift+7 move container to workspace number 7
bindsym Mod1+Shift+8 move container to workspace number 8
bindsym Mod1+Shift+9 move container to workspace number 9
## "scratchpad" = ??
bindsym Mod1+Shift+minus move scratchpad
bindsym Mod1+minus scratchpad show
### defaults # "${modifier}+Shift+${left}" = "move left";
mode "resize" { # "${modifier}+Shift+${down}" = "move down";
bindsym Down resize grow height 10 px # "${modifier}+Shift+${up}" = "move up";
bindsym Escape mode default # "${modifier}+Shift+${right}" = "move right";
bindsym Left resize shrink width 10 px
bindsym Return mode default
bindsym Right resize grow width 10 px
bindsym Up resize shrink height 10 px
bindsym h resize shrink width 10 px
bindsym j resize grow height 10 px
bindsym k resize shrink height 10 px
bindsym l resize grow width 10 px
}
### lightly modified bars "${modifier}+Shift+Left" = "move left";
bar { "${modifier}+Shift+Down" = "move down";
# TODO: fonts was: "${modifier}+Shift+Up" = "move up";
# config.fonts.fontconfig.defaultFonts; (monospace ++ emoji) "${modifier}+Shift+Right" = "move right";
font pango:Hack, Font Awesome 6 Free, Twitter Color Emoji 24.000000
mode dock
hidden_state hide
position top
status_command ${pkgs.i3status}/bin/i3status
swaybar_command ${pkgs.waybar}/bin/waybar
workspace_buttons yes
strip_workspace_numbers no
tray_output primary
colors {
background #000000
statusline #ffffff
separator #666666
# #border #background #text
focused_workspace #4c7899 #285577 #ffffff
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
binding_mode #2f343a #900000 #ffffff
}
}
### displays "${modifier}+b" = "splith";
## DESKTOP "${modifier}+v" = "splitv";
output "Samsung Electric Company S22C300 0x00007F35" { "${modifier}+f" = "fullscreen toggle";
pos 0,0 "${modifier}+a" = "focus parent";
res 1920x1080
}
output "Goldstar Company Ltd LG ULTRAWIDE 0x00004E94" {
pos 1920,0
res 3440x1440
}
## LAPTOP # "${modifier}+s" = "layout stacking";
# sh/en TV "${modifier}+w" = "layout tabbed";
output "Pioneer Electronic Corporation VSX-524 0x00000101" { "${modifier}+e" = "layout toggle split";
pos 0,0
res 1920x1080
}
# internal display
output "Unknown 0x0637 0x00000000" {
pos 1920,0
res 1920x1080
}
'';
sane.fs."/home/colin/.config/waybar/config" = sane-lib.fs.wantedSymlinkTo waybar-config-text; "${modifier}+Shift+space" = "floating toggle";
"${modifier}+space" = "focus mode_toggle";
"${modifier}+1" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+Shift+1" =
"move container to workspace number 1";
"${modifier}+Shift+2" =
"move container to workspace number 2";
"${modifier}+Shift+3" =
"move container to workspace number 3";
"${modifier}+Shift+4" =
"move container to workspace number 4";
"${modifier}+Shift+5" =
"move container to workspace number 5";
"${modifier}+Shift+6" =
"move container to workspace number 6";
"${modifier}+Shift+7" =
"move container to workspace number 7";
"${modifier}+Shift+8" =
"move container to workspace number 8";
"${modifier}+Shift+9" =
"move container to workspace number 9";
"${modifier}+Shift+minus" = "move scratchpad";
"${modifier}+minus" = "scratchpad show";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+e" =
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+r" = "mode resize";
# media keys
XF86MonBrightnessDown = "exec ${brightness-down-cmd}";
XF86MonBrightnessUp = "exec ${brightness-up-cmd}";
# TODO: hook into a visual prompt to display volume?
XF86AudioRaiseVolume = "exec ${vol-up-cmd}";
XF86AudioLowerVolume = "exec ${vol-down-cmd}";
XF86AudioMute = "exec ${mute-cmd}";
"${modifier}+Page_Up" = "exec ${vol-up-cmd}";
"${modifier}+Page_Down" = "exec ${vol-down-cmd}";
"${modifier}+Print" = "exec ${screenshot-cmd}";
};
# mostly defaults:
bars = [{
mode = "dock";
hiddenState = "hide";
position = "top";
command = "${pkgs.waybar}/bin/waybar";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = {
# names = [ "monospace" "Noto Color Emoji" ];
# size = 8.0;
# names = [ "Font Awesome 6 Free" "DejaVu Sans" "Hack" ];
# names = with config.fonts.fontconfig.defaultFonts; (emoji ++ monospace ++ serif ++ sansSerif);
names = with config.fonts.fontconfig.defaultFonts; (monospace ++ emoji);
size = 24.0;
};
trayOutput = "primary";
colors = {
background = "#000000";
statusline = "#ffffff";
separator = "#666666";
focusedWorkspace = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
};
activeWorkspace = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
};
inactiveWorkspace = {
border = "#333333";
background = "#222222";
text = "#888888";
};
urgentWorkspace = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
bindingMode = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
};
}];
};
};
sane.fs."/home/colin/.config/waybar/config" = sane-lib.fs.wantedText waybar-config-text;
# style docs: https://github.com/Alexays/Waybar/wiki/Styling # style docs: https://github.com/Alexays/Waybar/wiki/Styling
sane.fs."/home/colin/.config/waybar/style.css" = sane-lib.fs.wantedText '' sane.fs."/home/colin/.config/waybar/style.css" = sane-lib.fs.wantedText ''