diff options
author | Franck Cuny <franck@fcuny.net> | 2023-05-05 19:41:58 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2023-05-05 19:41:58 -0700 |
commit | 43da9edb4598eef509c481ae0b305384418c45de (patch) | |
tree | a0ad614c90102757143e026e4fe1806431a3dbf4 /home/wm | |
parent | profiles/default: users are immutable (diff) | |
download | world-43da9edb4598eef509c481ae0b305384418c45de.tar.gz |
home/profiles: move (almost) all modules to profiles
This is a major refactor, similar to what was done for the hosts, but in a single commit.
Diffstat (limited to 'home/wm')
-rw-r--r-- | home/wm/default.nix | 12 | ||||
-rw-r--r-- | home/wm/gammastep/default.nix | 17 | ||||
-rw-r--r-- | home/wm/mako/default.nix | 33 | ||||
-rw-r--r-- | home/wm/sway/default.nix | 138 | ||||
-rw-r--r-- | home/wm/swaylock/config | 4 | ||||
-rw-r--r-- | home/wm/swaylock/default.nix | 34 | ||||
-rw-r--r-- | home/wm/waybar/default.nix | 67 | ||||
-rw-r--r-- | home/wm/waybar/style.css | 69 | ||||
-rwxr-xr-x | home/wm/waybar/waybar-systemd.sh | 22 | ||||
-rw-r--r-- | home/wm/wofi/config | 6 | ||||
-rw-r--r-- | home/wm/wofi/default.nix | 9 |
11 files changed, 0 insertions, 411 deletions
diff --git a/home/wm/default.nix b/home/wm/default.nix deleted file mode 100644 index ecf8bf3..0000000 --- a/home/wm/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, ... }: -{ - imports = [ ./sway ./waybar ./mako ./swaylock ./wofi ./gammastep ]; - options.my.home.wm = with lib; { - windowManager = mkOption { - type = with types; nullOr (enum [ "sway" ]); - default = null; - example = "sway"; - description = "Which window manager to use for home session"; - }; - }; -} diff --git a/home/wm/gammastep/default.nix b/home/wm/gammastep/default.nix deleted file mode 100644 index 4530126..0000000 --- a/home/wm/gammastep/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - services.gammastep = { - enable = true; - #TODO: this needs to come from locale.nix - latitude = 37.8715; - longitude = -122.273; - temperature = { - day = 5000; - night = 3700; - }; - }; - }; -} diff --git a/home/wm/mako/default.nix b/home/wm/mako/default.nix deleted file mode 100644 index 325ee3d..0000000 --- a/home/wm/mako/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - home.packages = [ - pkgs.libnotify # to send notifications - ]; - - systemd.user.services.mako = { - Service = { ExecStart = "${pkgs.mako}/bin/mako"; }; - Install = { WantedBy = [ "sway-session.target" ]; }; - }; - - # All the options are documented via `man 5 mako` - services.mako = { - enable = true; - layer = "overlay"; - # The timeout value is in millisecond - defaultTimeout = 30000; - padding = "10,20"; - width = 400; - height = 150; - borderSize = 2; - # The maximum number of notifications - maxVisible = 3; - maxIconSize = 24; - # Enable pango markup (see https://docs.gtk.org/Pango/pango_markup.html) - markup = true; - actions = true; - }; - }; -} diff --git a/home/wm/sway/default.nix b/home/wm/sway/default.nix deleted file mode 100644 index 7ee6791..0000000 --- a/home/wm/sway/default.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ config, lib, pkgs, ... }: -let - isEnabled = config.my.home.wm.windowManager == "sway"; - terminal = config.my.home.terminal.program; - modifier = "Mod4"; # `Super` key -in -{ - config = lib.mkIf isEnabled { - home.packages = with pkgs; [ - wlogout - brightnessctl - pulseaudio - grim - slurp - polkit_gnome - xsettingsd - swaylock - swayidle - wl-clipboard - ]; - - home.sessionVariables = { - MOZ_ENABLE_WAYLAND = "1"; - XDG_CURRENT_DESKTOP = "sway"; - XDG_SESSION_TYPE = "wayland"; - }; - - programs = { - zsh.loginExtra = '' - if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then - eval $(ssh-agent -s) > /dev/null - fi - if [ "$(tty)" = "/dev/tty1" ]; then - exec sway &> /dev/null - fi - ''; - - zsh.profileExtra = '' - if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then - eval $(ssh-agent -s) > /dev/null - fi - if [ "$(tty)" = "/dev/tty1" ]; then - exec sway &> /dev/null - fi - ''; - }; - - wayland.windowManager.sway = { - enable = true; - # in order to import some variables (e.g. PATH) so that all the - # units that will be started have all the required environment - # variables - extraSessionCommands = "systemctl --user import-environment"; - # this will start sway-session.target and run - # dbus-update-activation-environment - systemdIntegration = true; - config = { - # FIXME: this should be a variable - terminal = "alacritty"; - modifier = modifier; - menu = ''${pkgs.wofi}/bin/wofi -S drun -p "app:" -L 10''; - bars = [ ]; - fonts = { - names = [ "Source Code Pro" ]; - size = 10.0; - }; - keybindings = lib.mkOptionDefault { - # control the volume - "XF86AudioRaiseVolume" = - "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"; - "XF86AudioLowerVolume" = - "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"; - "XF86AudioMute" = - "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - "XF86AudioMicMute" = - "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - - # control brightness - "XF86MonBrightnessDown" = - "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; - "XF86MonBrightnessUp" = - "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%"; - - # logout - "${modifier}+Escape" = "exec ${pkgs.wlogout}/bin/wlogout"; - - # screenshot - "${modifier}+s" = - "exec ${pkgs.grim}/bin/grim $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"; - "${modifier}+Shift+s" = - "exec ${pkgs.slurp}/bin/slurp | ${pkgs.grim}/bin/grim -g - $(xdg-user-dir DOCUMENTS)/screenshots/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"; - - # File Manager - "${modifier}+p" = "exec ${pkgs.pcmanfm}/bin/pcmanfm"; - }; - - # use `swaymsg -t get_tree' to get the title/name/ID of the applications - window = { - commands = [ - { - criteria.class = ".blueman-manager-wrapped"; - command = "floating enable"; - } - { - criteria.class = "Pavucontrol"; - command = "floating enable"; - } - ]; - }; - - input = { - "*" = { - "xkb_layout" = "us,fr"; - # map capslock to ctrl, and switch layout using shift+caps - "xkb_options" = "ctrl:nocaps,grp:shift_caps_toggle"; - }; - }; - - - assigns = { - "1" = [{ app_id = "emacs"; }]; - "2" = [{ app_id = "Alacritty"; }]; - "3" = [{ app_id = "firefox"; }]; - "4" = [{ app_id = "org.gnome.Fractal"; }]; - }; - - output = { - "*" = { - scale = "1.5"; - bg = "#2E3440 solid_color"; - }; - # This is for aptos - "eDP-1" = { scale = "1.3"; }; - }; - }; - }; - }; -} diff --git a/home/wm/swaylock/config b/home/wm/swaylock/config deleted file mode 100644 index 2d5b4a1..0000000 --- a/home/wm/swaylock/config +++ /dev/null @@ -1,4 +0,0 @@ -color=2E3440 -daemonize -indicator-caps-lock -hide-keyboard-layout diff --git a/home/wm/swaylock/default.nix b/home/wm/swaylock/default.nix deleted file mode 100644 index a22d548..0000000 --- a/home/wm/swaylock/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - xdg.configFile."swaylock/config" = { source = ./config; }; - - services.swayidle = { - enable = true; - events = [ - { - event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock -fF"; - } - { - event = "lock"; - command = "${pkgs.swaylock}/bin/swaylock -fF"; - } - ]; - timeouts = [ - { - timeout = 300; - command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\""; - resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\""; - } - { - timeout = 310; - command = "${pkgs.systemd}/bin/loginctl lock-session"; - } - ]; - }; - - }; -} diff --git a/home/wm/waybar/default.nix b/home/wm/waybar/default.nix deleted file mode 100644 index 4a524a8..0000000 --- a/home/wm/waybar/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ config, lib, pkgs, ... }: -let - isEnabled = config.my.home.wm.windowManager == "sway"; - waybarSystemd = - pkgs.runCommandLocal "waybar-systemd" - { nativeBuildInputs = [ pkgs.makeWrapper ]; } - '' - makeWrapper ${./waybar-systemd.sh} $out/bin/waybar-systemd - ''; -in -{ - config = lib.mkIf isEnabled { - programs.waybar = { - enable = true; - systemd = { enable = true; }; - - settings = [{ - layer = "bottom"; - height = 25; - position = "top"; - margin-top = 0; - margin-left = 0; - margin-right = 0; - margin-bottom = 0; - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-right = [ "custom/systemd" "pulseaudio" "network" "battery" "clock" "tray" ]; - "sway/workspaces" = { - format = "{name}"; - disable-scroll = true; - }; - "sway/mode" = { format = "{}"; }; - tray = { spacing = 10; }; - clock = { format = "{: %a %b %d %R}"; }; - battery = { - states = { - warning = 30; - critical = 15; - }; - format = "ac:{capacity}%"; - tooltip = true; - tooltip-format = "{timeTo} ({capacity}%)"; - }; - "custom/systemd" = { - exec = "${waybarSystemd}/bin/waybar-systemd"; - return-type = "json"; - interval = 10; - }; - pulseaudio = { - format = "vol:{volume}%"; - format-bluetooth = "bt:{volume}%"; - format-bluetooth-muted = "bt:{volume}%"; - format-muted = "vol:{volume}%"; - on-click = "pavucontrol"; - }; - "network" = { - format-wifi = "{essid}:{signalStrength}%"; - format-ethernet = "{ipaddr}/{cidr}"; - format-linked = "{ifname} (No IP)"; - format-disconnected = "network unavailable"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - tooltip = false; - }; - }]; - style = (builtins.readFile ./style.css); - }; - }; -} diff --git a/home/wm/waybar/style.css b/home/wm/waybar/style.css deleted file mode 100644 index 1362cd5..0000000 --- a/home/wm/waybar/style.css +++ /dev/null @@ -1,69 +0,0 @@ -* { - border-radius: 0; - border: none; - margin: 0; - min-height: 0; - padding: 0; - font-family: Source Code Pro; - font-size: 15px; -} -window#waybar { - background-color: #282A36; - color: #eee; -} -#workspaces button { - padding: 0 3px; - background-color: transparent; - color: #eee; -} -#workspaces button.focused { - background-color: #285577; - border: 1px solid #4c7899; -} -#clock, -#battery, -#network, -#pulseaudio, -#tray, -#mode { - padding-left: 10px; - padding-right: 10px; -} -#mode { - /* No styles */ -} -#tray { - /* No styles */ -} -#clock { - /* No styles */ -} -#battery { - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; -} -#battery.discharging { - color: #90a1ad; -} -#battery.charging { - color: #fffff8; -} -#battery.warning { - border-bottom: 2px solid #ff9e21; -} -#battery.critical { - border-bottom: 2px solid #ff3121; -} -#network { - /* No styles */ -} -#network.disconnected { - color: orange; -} -#pulseaudio { - /* No styles */ -} -#pulseaudio.muted { - color: #90a1ad; -} diff --git a/home/wm/waybar/waybar-systemd.sh b/home/wm/waybar/waybar-systemd.sh deleted file mode 100755 index bf4e8b8..0000000 --- a/home/wm/waybar/waybar-systemd.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -failed_user="$(systemctl --plain --no-legend --user list-units --state=failed | awk '{ print $1 }')" -failed_system="$(systemctl --plain --no-legend list-units --state=failed | awk '{ print $1 }')" - -failed_systemd_count="$(echo -n "$failed_system" | grep -c '^')" -failed_user_count="$(echo -n "$failed_user" | grep -c '^')" - -text=$(( failed_systemd_count + failed_user_count )) - -if [ "$text" -eq 0 ]; then - printf '{"text": ""}\n' -else - tooltip="" - - [ -n "$failed_system" ] && tooltip="Failed system services:\n\n${failed_system}\n\n${tooltip}" - [ -n "$failed_user" ] && tooltip="Failed user services:\n\n${failed_user}\n\n${tooltip}" - - tooltip="$(printf "%s" "$tooltip" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')" - - printf '{"text": "%s", "tooltip": "%s" }\n' "$text" "$tooltip" -fi diff --git a/home/wm/wofi/config b/home/wm/wofi/config deleted file mode 100644 index 3d8133f..0000000 --- a/home/wm/wofi/config +++ /dev/null @@ -1,6 +0,0 @@ -allow_images=true -image_size=25px -drun-display_generic=true -dynamic_lines=true -insensitive=true -run-cache_file=/dev/null diff --git a/home/wm/wofi/default.nix b/home/wm/wofi/default.nix deleted file mode 100644 index 7f8a92b..0000000 --- a/home/wm/wofi/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, ... }: -let isEnabled = config.my.home.wm.windowManager == "sway"; -in -{ - config = lib.mkIf isEnabled { - home.packages = with pkgs; [ wofi ]; - xdg.configFile."wofi/config".source = ./config; - }; -} |