about summary refs log tree commit diff
path: root/home/profiles/gui
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-07-25 18:58:27 +0900
committersefidel <contact@sefidel.net>2023-07-25 18:58:27 +0900
commitec647eecd447bfbbd8f7b6f2fe5bb65ebf9abf16 (patch)
treee36c9348852f95d95040ed61f7ee7a2b4501ef89 /home/profiles/gui
parent6ccd70ae9afee4f9c98135502abca8f9d0f2b58d (diff)
downloadnixrc-ec647eecd447bfbbd8f7b6f2fe5bb65ebf9abf16.tar.gz
nixrc-ec647eecd447bfbbd8f7b6f2fe5bb65ebf9abf16.zip
feat(home): split gui from base
Diffstat (limited to 'home/profiles/gui')
-rw-r--r--home/profiles/gui/config/dunst.nix47
-rw-r--r--home/profiles/gui/config/foot.nix37
-rw-r--r--home/profiles/gui/config/sway.nix226
-rw-r--r--home/profiles/gui/config/waybar/settings.nix64
-rw-r--r--home/profiles/gui/config/waybar/style.nix80
-rw-r--r--home/profiles/gui/default.nix142
6 files changed, 596 insertions, 0 deletions
diff --git a/home/profiles/gui/config/dunst.nix b/home/profiles/gui/config/dunst.nix
new file mode 100644
index 0000000..60ed15f
--- /dev/null
+++ b/home/profiles/gui/config/dunst.nix
@@ -0,0 +1,47 @@
+{ neotheme }:
+
+with neotheme.colors;
+{
+  global = {
+    padding = 8;
+    width = "330";
+    height = "500";
+    origin = "top-right";
+    offset = "8x25";
+    notification_limit = 5;
+    frame_width = 2;
+    vertical_alignment = "center";
+    horizontal_padding = 8;
+    icon_position = "left";
+    corner_radius = 10;
+
+    markup = "full";
+    word_wrap = true;
+    show_indicators = false;
+    format = "<b>%s</b>\\n\\n%b";
+    font = "Dina 10";
+    frame_color = "#${color3}";
+    separator_color = "auto";
+    max_icon_size = 80;
+  };
+
+  urgency_low = {
+    foreground = "#${foreground}";
+    background = "#${background}";
+    frame_color = "#${color4}";
+    timeout = 4;
+  };
+
+  urgency_normal = {
+    foreground = "#${foreground}";
+    background = "#${background}";
+    frame_color = "#${color3}";
+    timeout = 8;
+  };
+
+  urgency_critical = {
+    foreground = "#${foreground}";
+    background = "#${background}";
+    frame_color = "#${color1}";
+  };
+}
diff --git a/home/profiles/gui/config/foot.nix b/home/profiles/gui/config/foot.nix
new file mode 100644
index 0000000..bcb3145
--- /dev/null
+++ b/home/profiles/gui/config/foot.nix
@@ -0,0 +1,37 @@
+{ neotheme }:
+
+with neotheme.colors;
+
+{
+  main = {
+    term = "foot";
+    font = "Dina:pixelsize=13,JetBrainsMono Nerd Font:pixelsize=12";
+    letter-spacing = 0;
+    line-height = 13;
+    dpi-aware = "yes";
+    pad = "16x16 center";
+  };
+
+  cursor.style = "beam";
+
+  colors = {
+    background = background;
+    foreground = foreground;
+    regular0 = color0;
+    regular1 = color1;
+    regular2 = color2;
+    regular3 = color3;
+    regular4 = color4;
+    regular5 = color5;
+    regular6 = color6;
+    regular7 = color7;
+    bright0 = bright0;
+    bright1 = bright1;
+    bright2 = bright2;
+    bright3 = bright3;
+    bright4 = bright4;
+    bright5 = bright5;
+    bright6 = bright6;
+    bright7 = bright7;
+  };
+}
diff --git a/home/profiles/gui/config/sway.nix b/home/profiles/gui/config/sway.nix
new file mode 100644
index 0000000..5e4de04
--- /dev/null
+++ b/home/profiles/gui/config/sway.nix
@@ -0,0 +1,226 @@
+{ pkgs, neotheme }:
+
+with neotheme.colors;
+
+''
+  # disable power key
+  exec systemd-inhibit --what=handle-power-key --who="sway" --why="Sway manages power key behaviour" sleep infinity
+
+  exec autotiling
+
+  # set modifiers
+  set $mod Mod4
+  set $alt Mod1
+  set $floating_modifier $mod
+  set $left  h
+  set $down  j
+  set $up    k
+  set $right l
+
+  # set terminal
+
+  set $term foot
+  bindsym $mod+Return exec $term
+
+  # set menu
+    set $menu "${pkgs.bemenu}/bin/bemenu-run -H 18 -l 5 --fn 'Dina 13px' -p 'run::' --tb '$primary' --tf '$color0' --hb '$primary' --hf '$color0'"
+  bindsym $mod+d exec $menu
+
+  # set screenshot util
+  bindsym $mod+Ctrl+Return exec grimshot copy area
+
+  # change focus
+  # vim-style
+  bindsym $mod+$left  focus left
+  bindsym $mod+$down  focus down
+  bindsym $mod+$up    focus up
+  bindsym $mod+$right focus right
+  # arrows
+  bindsym $mod+Left  focus left
+  bindsym $mod+Down  focus down
+  bindsym $mod+Up    focus up
+  bindsym $mod+Right focus right
+
+  # move focused window
+  # vim-style
+  bindsym $mod+Shift+$left move left
+  bindsym $mod+Shift+$down move down
+  bindsym $mod+Shift+$up move up
+  bindsym $mod+Shift+$right move right
+  # arrows
+  bindsym $mod+Shift+Left move left
+  bindsym $mod+Shift+Down move down
+  bindsym $mod+Shift+Up move up
+  bindsym $mod+Shift+Right move right
+
+  # split
+  bindsym $mod+c split h # horizontal
+  bindsym $mod+v split v # vertical
+
+  # fullscreen
+  bindsym $mod+e fullscreen toggle
+
+  # floating
+  bindsym $mod+f floating toggle
+
+  # kill focused
+  bindsym $mod+w kill
+
+  font "pango:Dina 10"
+
+  # window rules
+  for_window [window_role="pop-up"]      floating enable
+  for_window [window_role="bubble"]      floating enable
+  for_window [window_role="task_dialog"] floating enable
+  for_window [window_role="Preferences"] floating enable
+  for_window [window_type="dialog"]      floating enable
+  for_window [window_type="menu"]        floating enable
+  for_window [class="mpv"]               floating enable
+  for_window [class=".*"]                inhibit_idle fullscreen
+  for_window [app_id=".*"]               title_format ""
+  for_window [class=".*"]                title_format ""
+
+  titlebar_border_thickness 0
+  titlebar_padding 0 0
+
+  # workspace names
+  set $ws1 1:I
+  set $ws2 2:II
+  set $ws3 3:III
+  set $ws4 4:IV
+  set $ws5 5:V
+  set $ws6 6:VI
+  set $ws7 7:VII
+  set $ws8 8:VIII
+  set $ws9 9:IX
+  set $ws10 10:X
+
+  # switch to named ws
+  bindsym $mod+1 workspace $ws1
+  bindsym $mod+2 workspace $ws2
+  bindsym $mod+3 workspace $ws3
+  bindsym $mod+4 workspace $ws4
+  bindsym $mod+5 workspace $ws5
+  bindsym $mod+6 workspace $ws6
+  bindsym $mod+7 workspace $ws7
+  bindsym $mod+8 workspace $ws8
+  bindsym $mod+9 workspace $ws9
+  bindsym $mod+0 workspace $ws10
+
+  # switch to prev/next ws
+  bindsym $mod+z workspace prev
+  bindsym $mod+x workspace next
+
+  # move focused container to ws
+  bindsym $mod+Shift+1 move container to workspace $ws1
+  bindsym $mod+Shift+2 move container to workspace $ws2
+  bindsym $mod+Shift+3 move container to workspace $ws3
+  bindsym $mod+Shift+4 move container to workspace $ws4
+  bindsym $mod+Shift+5 move container to workspace $ws5
+  bindsym $mod+Shift+6 move container to workspace $ws6
+  bindsym $mod+Shift+7 move container to workspace $ws7
+  bindsym $mod+Shift+8 move container to workspace $ws8
+  bindsym $mod+Shift+9 move container to workspace $ws9
+  bindsym $mod+Shift+0 move container to workspace $ws10
+  bindsym $mod+Shift+z move container to workspace prev
+  bindsym $mod+Shift+x move container to workspace next
+
+  # ws back-and-forth
+  workspace_auto_back_and_forth no
+
+  # reload
+  bindsym $mod+q reload
+
+  # application shortcuts
+  bindsym $mod+a exec qutebrowser
+  # bindsym $mod+Shift+a
+
+  # Volume control
+  bindsym XF86AudioRaiseVolume exec ~/.local/bin/volume up
+  bindsym XF86AudioLowerVolume exec ~/.local/bin/volume down
+  bindsym XF86AudioMute        exec ~/.local/bin/volume toggle
+  # HHKB
+  bindsym $mod+equal           exec ~/.local/bin/volume up
+  bindsym $mod+minus           exec ~/.local/bin/volume down
+  bindsym $mod+backslash       exec ~/.local/bin/volume toggle
+
+  # Brightness
+  bindsym XF86MonBrightnessDown exec brightnessctl -q set 10%-
+  bindsym XF86MonBrightnessUp   exec brightnessctl -q set 10%+
+
+  # Screenshot
+  bindsym $mod+Print exec grimshot copy area
+  bindsym Print      exec grimshot copy active
+  bindsym $alt+Print exec grimshot save screen
+
+  # Toggle waybar
+  bindsym $mod+b exec pkill -USR1 waybar
+
+  # Exit
+  bindsym $mod+Shift+q exec swaynag -t warning -m 'Do you really want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'
+
+  # Power
+  bindsym XF86PowerOff   exec swaynag -t error -m 'Confirm poweroff?' -b 'Confirm' 'shutdown now'
+
+  # Aesthetics
+  default_border pixel 3
+  hide_edge_borders --i3 smart
+  gaps inner 8
+  smart_borders on
+
+  set $color0 #${color0}
+  set $color1 #${color1}
+  set $color2 #${color2}
+  set $color3 #${color3}
+  set $color4 #${color4}
+  set $color5 #${color5}
+  set $color6 #${color6}
+  set $color7 #${color7}
+  set $color8 #${bright0}
+  set $color9 #${bright1}
+  set $color10 #${bright2}
+  set $color11 #${bright3}
+  set $color12 #${bright4}
+  set $color13 #${bright5}
+  set $color14 #${bright6}
+  set $color15 #${bright7}
+
+  set $primary $color4
+  set $muted #36486a
+
+  # class                 border    backgr    text    indicator
+  client.focused          $primary $primary $color0 $primary
+  client.focused_inactive $muted $muted $color0 $muted
+  client.unfocused        $muted $muted $color7 $muted
+  client.urgent           $color10 $color10 $color0 $color10
+  output "*" bg ${../../../../assets/annie-spratt-arctic.jpg} fill
+  output "*" scale 1
+  output "*" scale_filter nearest
+
+  input type:touchpad {
+    tap enabled
+    natural_scroll enabled
+  }
+
+
+  input "1452:641:Apple_Internal_Keyboard_/_Trackpad" {
+    dwt enabled                 #Disable while typing
+    tap enabled                 #Tap registers as a click
+    accel_profile adaptive      #adaptive/flat cursor acceleration
+    pointer_accel 0             #From -1 to 1: Speed of cursor
+    natural_scroll enabled      #Direction of Scroll
+    scroll_factor 0.3           #Speed of Scrolling gets multiplied by this factor
+    scroll_method two_finger    #none|two_finger|edge|on_button_down
+    middle_emulation enabled    #Enables middle click
+    tap_button_map lmr          #1Finger > Left Click , 2Finger > Right Click, 3Fingers > MiddleClick
+  }
+
+  input type:keyboard {
+    repeat_rate 40
+    repeat_delay 350
+    xkb_layout us
+    # xkb_variant ,dvorak
+    xkb_options 'grp:alt_shift_toggle,caps:escape'
+    # xkb_options ctrl:swapcaps
+  }
+''
diff --git a/home/profiles/gui/config/waybar/settings.nix b/home/profiles/gui/config/waybar/settings.nix
new file mode 100644
index 0000000..86e865a
--- /dev/null
+++ b/home/profiles/gui/config/waybar/settings.nix
@@ -0,0 +1,64 @@
+{ neotheme }:
+
+with neotheme.colors;
+{
+  layer = "bottom";
+  position = "top";
+  height = 22;
+  modules-left = [ "pulseaudio" "custom/separator" "cpu" "custom/separator" "memory" "custom/separator" "idle_inhibitor" ];
+  modules-center = [ "sway/workspaces" ];
+  modules-right = [ "battery" "custom/separator" "clock" ];
+
+  "sway/workspaces" = {
+    all-outputs = true;
+    disable-scroll = false;
+    format = "{name}";
+    persistent_workspaces = {
+      "1:I" = [ ];
+      "2:II" = [ ];
+      "3:III" = [ ];
+      "4:IV" = [ ];
+      "5:V" = [ ];
+      "6:VI" = [ ];
+      "7:VII" = [ ];
+      "8:VIII" = [ ];
+      "9:IX" = [ ];
+      "10:X" = [ ];
+    };
+  };
+
+  "clock" = {
+    interval = 10;
+    format = "<span foreground='#${color5}'>TIME</span> {:%A, %b %d %H:%M}";
+  };
+
+  "cpu" = {
+    interval = 5;
+    format = "<span foreground='#${color2}'>CPU</span> {usage:2}%";
+  };
+
+  "pulseaudio" = {
+    format = "<span foreground='#${color4}'>VOL</span> {volume}%";
+    format-muted = "<span foreground='#${color4}'>VOL</span> Muted";
+  };
+
+  "memory" = {
+    interval = 5;
+    format = "<span foreground='#${color3}'>MEM</span> {used:0.2f}GiB";
+  };
+
+  "battery" = {
+    format = "<span foreground='#${color6}'>BATT</span> {capacity}%";
+    format-alt = "<span foreground='#${color6}'>PWR</span> {power}Wh";
+  };
+
+  "idle_inhibitor" = {
+    format = "<span foreground='#a89984'>CAFFEINE</span> {status}";
+  };
+
+  "custom/separator" = {
+    format = "|";
+    interval = "once";
+    tooltip = false;
+  };
+}
diff --git a/home/profiles/gui/config/waybar/style.nix b/home/profiles/gui/config/waybar/style.nix
new file mode 100644
index 0000000..d8714ed
--- /dev/null
+++ b/home/profiles/gui/config/waybar/style.nix
@@ -0,0 +1,80 @@
+{ neotheme }:
+
+with neotheme.colors;
+
+''
+  * {
+    border: none;
+    border-radius: 0;
+    font-family: "Dina, JetBrainsMono Nerd Font";
+    font-size: 12px;
+    min-height: 0;
+  }
+
+  window#waybar {
+    background: #${background};
+    color: #${foreground};
+    border-bottom: 1px solid #${bright0};
+  }
+
+  #workspaces button {
+    min-width: 0;
+    padding: 0 8px;
+    background: #${background};
+    color: #${foreground};
+    border-bottom: 1px solid #${bright0};
+  }
+
+  #workspaces button.focused {
+    color: #${foreground};
+    background-color: #${alt0};
+  }
+
+  #workspaces button.urgent {
+    color: #${color1};
+  }
+
+  #workspaces button.persistent {
+    color: #${alt1};
+  }
+
+  #workspaces button:hover {
+    color: #${foreground};
+    background: #${alt1};
+    box-shadow: inherit;
+    text-shadow: inherit;
+  }
+
+  #clock,
+  #cpu,
+  #temperature,
+  #backlight,
+  #battery,
+  #network,
+  #memory,
+  #idle_inhibitor,
+  #language,
+  #pulseaudio,
+  #tray,
+  #mode,
+  #mpd {
+    padding: 0.2rem 0.6rem;
+    margin: 0 2px;
+    color: #${foreground};
+    background-color: #${background};
+    border-bottom: 1px solid #${bright0};
+  }
+
+  @keyframes blink {
+    to {
+      background-color: #${color4};
+      color: #${background};
+    }
+  }
+
+  #custom-separator {
+    color: #${alt1};
+    background-color: #${background};
+    border-bottom: 1px solid #${bright0};
+  }
+''
diff --git a/home/profiles/gui/default.nix b/home/profiles/gui/default.nix
new file mode 100644
index 0000000..ac7b55b
--- /dev/null
+++ b/home/profiles/gui/default.nix
@@ -0,0 +1,142 @@
+{ config, lib, inputs, pkgs, self, ... }:
+let
+  cfg = config.profiles.gui;
+
+  neotheme = config.neotheme;
+in
+{
+  imports = [
+    ../../modules/misc/neotheme
+  ];
+
+  options.profiles.gui.enable = lib.mkEnableOption
+    "The gui profile, sets up sway and related applications.";
+
+  config = lib.mkIf cfg.enable {
+    gtk.enable = true;
+    gtk.iconTheme.package = pkgs.papirus-icon-theme;
+    gtk.iconTheme.name = "Papirus-Dark";
+    gtk.theme.package = (pkgs.orchis-theme.override { tweaks = [ "primary" "compact" ]; });
+    gtk.theme.name = "Orchis-dark-compact";
+    gtk.font.name = "Dina 10";
+
+    home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ-AA";
+
+    neotheme = {
+      name = "Softjelly";
+      identifier = "softjelly";
+
+      colors = {
+        background = "151515";
+        foreground = "cbc0ab";
+        alt0 = "404040";
+        alt1 = "606060";
+        color0 = "3c3c3c";
+        color1 = "cf6a4c";
+        color2 = "99ad6a";
+        color3 = "dfa358";
+        color4 = "8197bf";
+        color5 = "b3a3ff";
+        color6 = "8fbfdc";
+        color7 = "cbc0ab";
+        bright0 = "4c4c4c";
+        bright1 = "d98870";
+        bright2 = "adbd88";
+        bright3 = "e5b579";
+        bright4 = "9aaccc";
+        bright5 = "c2b5ff";
+        bright6 = "a5cce3";
+        bright7 = "d5cdbc";
+      };
+    };
+
+    home.packages = [
+      # Sway
+      pkgs.autotiling
+      pkgs.swaylock-effects
+      pkgs.swaybg
+      pkgs.wayland-utils
+      pkgs.wl-clipboard
+      pkgs.grim
+      pkgs.slurp
+      pkgs.sway-contrib.grimshot
+      pkgs.waybar
+      pkgs.bemenu
+      pkgs.qt5.qtwayland
+      pkgs.xdg-utils
+
+      # Fix gpg not recognizing foot terminfo
+      pkgs.foot.terminfo
+    ];
+
+    wayland.windowManager.sway = {
+      enable = true;
+
+      wrapperFeatures = {
+        base = true;
+        gtk = true;
+      };
+
+      config = {
+        bars = [{ command = "${pkgs.waybar}/bin/waybar"; }];
+        keybindings = { };
+      };
+
+      extraSessionCommands = ''
+        export XDG_CURRENT_DESKTOP=sway;
+      '';
+
+      extraConfig = import ./config/sway.nix { inherit pkgs neotheme; };
+    };
+
+    programs = {
+      foot = {
+        enable = true;
+
+        settings = import ./config/foot.nix { inherit neotheme; };
+      };
+
+      waybar = {
+        enable = config.wayland.windowManager.sway.enable;
+
+        settings = [ (import ./config/waybar/settings.nix { inherit neotheme; }) ];
+
+        style = import ./config/waybar/style.nix { inherit neotheme; };
+      };
+    };
+
+    services = {
+      dunst = {
+        enable = true;
+        settings = import ./config/dunst.nix { inherit neotheme; };
+      };
+
+      swayidle = {
+        enable = true;
+        events = [
+          { event = "before-sleep"; command = "${pkgs.swaylock-effects}/bin/swaylock -fFc ${neotheme.colors.background} --indicator --grace 2 --fade-in 0.2"; }
+          { event = "lock"; command = "${pkgs.swaylock-effects}/bin/swaylock -fFc ${neotheme.colors.background} --indicator --grace 2 --fade-in 0.2"; }
+        ];
+        timeouts = [
+          { timeout = 270; command = "${pkgs.libnotify}/bin/notify-send -t 30000 'Locking screen in 30 seconds'"; }
+          { timeout = 300; command = "${pkgs.swaylock-effects}/bin/swaylock -fFc ${neotheme.colors.background} --indicator --grace 2 --fade-in 0.2"; }
+          {
+            timeout = 600;
+            command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'";
+            resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'";
+          }
+          {
+            timeout = 900;
+            command = "${pkgs.systemd}/bin/systemctl suspend";
+          }
+        ];
+      };
+
+      wlsunset = {
+        enable = true;
+        latitude = "36.5";
+        longitude = "127.2";
+      };
+    };
+  };
+}