From c4acd805405314ea2ec1baa093b15b7a22d1f141 Mon Sep 17 00:00:00 2001 From: Adrian G L Date: Fri, 14 Jun 2024 14:35:25 +0200 Subject: [PATCH] updated hm sway --- home/fonts.nix | 33 ++++ home/foot.nix | 42 +++++ home/kanshi.nix | 35 +++++ home/sway.nix | 359 +++++++++++++++++++------------------------ home/wofi.nix | 71 +++++++++ packages/vim.nix | 2 +- profiles/desktop.nix | 15 +- 7 files changed, 347 insertions(+), 210 deletions(-) create mode 100644 home/fonts.nix create mode 100644 home/foot.nix create mode 100644 home/kanshi.nix create mode 100644 home/wofi.nix diff --git a/home/fonts.nix b/home/fonts.nix new file mode 100644 index 0000000..d0a8310 --- /dev/null +++ b/home/fonts.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, ... }: +{ + + home.packages = with pkgs; [ + nerdfonts + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + liberation_ttf + fira-code + fira-code-symbols + nerdfonts + ubuntu_font_family + zpix-pixel-font + _0xproto + font-awesome + font-awesome_5 + font-awesome_4 + + ]; + + fonts.fontconfig.enable = true; + fonts.fontconfig.defaultFonts = { + emoji = ["noto-fonts-emoji font-awesome"]; + monospace = ["0xproto" "zpix" "fira-code"]; + serif = [ "Noto Serif" "Source Han Serif" ]; + sansSerif = [ "Noto Sans" "Source Han Sans" ]; + }; + + + +} + diff --git a/home/foot.nix b/home/foot.nix new file mode 100644 index 0000000..8b10694 --- /dev/null +++ b/home/foot.nix @@ -0,0 +1,42 @@ +{ pkgs, lib, ... }: +{ + home.packages = with pkgs; [ + foot + ]; + + programs.foot.enable = true; + programs.foot.settings = { + colors = { + alpha="0.9"; + foreground="ffffff"; + background="000000"; + regular0="2e3436"; + regular1="cc0000"; + regular2="c4e9a06"; + regular3="cc4a000"; + regular4="c3465a4"; + regular5="c75507b"; + regular6="c06989a"; + regular7="cd3d7cf"; + bright0="555753"; + bright1="5ef2929"; + bright2="58ae234"; + bright3="5fce94f"; + bright4="5729fcf"; + bright5="5ad7fa8"; + bright6="534e2e2"; + bright7="5eeeeec"; + }; + main = { + term = "xterm-256color"; + font = "0xproto:size=16"; + dpi-aware = "yes"; + }; + mouse = { + hide-when-typing = "yes"; + }; + }; + + +} + diff --git a/home/kanshi.nix b/home/kanshi.nix new file mode 100644 index 0000000..f8254be --- /dev/null +++ b/home/kanshi.nix @@ -0,0 +1,35 @@ +{ pkgs, lib, ... }: +{ + home.packages = with pkgs; [ + ]; + + services.kanshi = { + enable = true; + settings = [ + { profile.name = "undocked"; + profile.outputs = [ + { + criteria = "eDP-1"; + } + ]; + profile.exec = [ + "\${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 2, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 3, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 4, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 5, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 6, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 7, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 8, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 9, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 10, move workspace to eDP-1" + "\${pkg.sway}/bin/swaymsg workspace 0, move workspace to eDP-1" + + ]; + } + ]; + + }; + +} + diff --git a/home/sway.nix b/home/sway.nix index 74bd0f9..9464be0 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -1,7 +1,10 @@ -{ pkgs, lib, ... }: +{ pkgs, config, lib, ... }: { imports = [ - + ./wofi.nix + ./foot.nix + ./fonts.nix + ./kanshi.nix ]; @@ -74,134 +77,6 @@ qt.enable = true; qt.style.name = "breeze"; - programs.wofi = { - enable = true; - settings = { - location = "center"; - allow_markup = true; - width = "80%"; - }; - style = '' - * { - font-family: monospace; - font-size: 1.5em; - } - - window { - margin: 0px; - border: 1px solid #c0c0c0; - background-color: #282a36; - } - - #input { - margin: 2 px; - border: none; - color: #222222; - background-color: #eeeeee; - } - - #inner-box { - margin: 2px; - border: none; - background-color: #282a36; - } - - #outer-box { - margin: 2px; - border: none; - background-color: #282a36; - } - - #scroll { - margin: 0px; - border: none; - } - - #text { - margin: 2px; - border: none; - color: #f8f8f2; - } - - #entry:selected { - background-color: #44475a; - } - #entry { - border-bottom-style: solid; - border-width: 1px; - border-color: #d4af37; - } - ''; - }; - - services.kanshi = { - enable = true; - settings = [ - { profile.name = "undocked"; - profile.outputs = [ - { - criteria = "eDP-1"; - } - ]; - profile.exec = [ - "\${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 2, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 3, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 4, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 5, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 6, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 7, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 8, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 9, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 10, move workspace to eDP-1" - "\${pkg.sway}/bin/swaymsg workspace 0, move workspace to eDP-1" - - ]; - } - ]; - - }; - - programs.foot.settings = { - colors = { - alpha="0.9"; - foreground="ffffff"; - background="000000"; - regular0="2e3436"; - regular1="cc0000"; - regular2="c4e9a06"; - regular3="cc4a000"; - regular4="c3465a4"; - regular5="c75507b"; - regular6="c06989a"; - regular7="cd3d7cf"; - bright0="555753"; - bright1="5ef2929"; - bright2="58ae234"; - bright3="5fce94f"; - bright4="5729fcf"; - bright5="5ad7fa8"; - bright6="534e2e2"; - bright7="5eeeeec"; - }; - main = { - term = "xterm-256color"; - font = "0xproto:size=16"; - dpi-aware = "yes"; - }; - mouse = { - hide-when-typing = "yes"; - }; - }; - - - fonts.fontconfig.enable = true; - fonts.fontconfig.defaultFonts = { - emoji = ["noto-fonts-emoji font-awesome"]; - monospace = ["0xproto" "zpix" "fira-code"]; - serif = [ "Noto Serif" "Source Han Serif" ]; - sansSerif = [ "Noto Sans" "Source Han Sans" ]; - }; home.sessionVariables = { MOZ_ENABLE_WAYLAND = "1"; @@ -224,89 +99,173 @@ }; - - wayland.windowManager.sway = { - wrapperFeatures.gtk = true; - enable = true; - config = rec { - modifier = "Mod4"; - # Use kitty as default terminal - terminal = "footclient"; - menu = "wofi --show run"; - bars = [{ - fonts.size = 16.0; - command = "waybar"; - position = "top"; - }]; - startup = [ - # Launch Firefox on start - {command = "foot --server";} - {command = "firefox";} - {command = "nm-applet";} - {command = "autotiling-rs";} - {command = "sworkstyle";} - ]; - floating.border = 0; - window.border = 0; - focus.followMouse = true; - modes.resize = { - Escape = "mode default"; - Return = "mode default"; - "h" = "resize shrink width 10 px or 10 ppt"; - "j" = "resize grow height 10 px or 10 ppt"; - "k" = "resize shrink height 10 px or 10 ppt"; - "l" = "resize grow width 10 px or 10 ppt"; - }; - +wayland.windowManager.sway = let + cfg = config.wayland.windowManager.sway; +in { + wrapperFeatures.gtk = true; + enable = true; + config = rec { + modifier = "Mod4"; + terminal = "footclient"; + menu = "wofi --show run"; + bars = [{ + fonts.size = 16.0; + command = "waybar"; + position = "top"; + }]; + startup = [ + {command = "foot --server";} + {command = "firefox";} + {command = "nm-applet";} + {command = "autotiling-rs";} + {command = "sworkstyle";} + ]; + floating.border = 0; + window.border = 0; + focus.followMouse = true; + modes.resize = { + Escape = "mode default"; + Return = "mode default"; + "${cfg.config.left}" = "resize shrink width 10 px or 10 ppt"; + "${cfg.config.down}" = "resize grow height 10 px or 10 ppt"; + "${cfg.config.up}" = "resize shrink height 10 px or 10 ppt"; + "${cfg.config.right}" = "resize grow width 10 px or 10 ppt"; }; + }; + keybindings = mkOption { + type = types.attrsOf (types.nullOr types.str); + default = mapAttrs (n: mkOptionDefault) { + "${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}"; + "${cfg.config.modifier}+Shift+q" = "kill"; + "${cfg.config.modifier}+d" = "exec ${cfg.config.menu}"; - extraConfig = '' - set $mod Mod4 + "${cfg.config.modifier}+${cfg.config.left}" = "focus left"; + "${cfg.config.modifier}+${cfg.config.down}" = "focus down"; + "${cfg.config.modifier}+${cfg.config.up}" = "focus up"; + "${cfg.config.modifier}+${cfg.config.right}" = "focus right"; - #startup - input type:keyboard xkb_capslock disabled - input type:keyboard xkb_numlock enabled - xwayland enable - - #autostart to selected workspace classes - assign [class="autostart1"] workspace 1 - assign [class="autostart2"] workspace 2 - assign [class="autostart3"] workspace 3 - assign [class="autostart4"] workspace 4 + "${cfg.config.modifier}+Left" = "focus left"; + "${cfg.config.modifier}+Down" = "focus down"; + "${cfg.config.modifier}+Up" = "focus up"; + "${cfg.config.modifier}+Right" = "focus right"; + "${cfg.config.modifier}+Shift+${cfg.config.left}" = "move left"; + "${cfg.config.modifier}+Shift+${cfg.config.down}" = "move down"; + "${cfg.config.modifier}+Shift+${cfg.config.up}" = "move up"; + "${cfg.config.modifier}+Shift+${cfg.config.right}" = "move right"; - bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% - bindsym F3 exec pactl set-sink-volume @DEFAULT_SINK@ +5% - bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% - bindsym F2 exec pactl set-sink-volume @DEFAULT_SINK@ -5% - bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle - bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle - bindsym XF86MonBrightnessDown exec brightnessctl set 5%- - bindsym XF86MonBrightnessUp exec brightnessctl set 5%+ - bindsym XF86AudioPlay exec playerctl play-pause - bindsym XF86AudioNext exec playerctl next - bindsym XF86AudioPrev exec playerctl previous - bindsym XF86Search exec $menu + "${cfg.config.modifier}+Shift+Left" = "move left"; + "${cfg.config.modifier}+Shift+Down" = "move down"; + "${cfg.config.modifier}+Shift+Up" = "move up"; + "${cfg.config.modifier}+Shift+Right" = "move right"; - #shortcuts for applications - #bindsym $mod+Shift+f exec firefox - #bindsym $mod+Shift+c exec code - + "${cfg.config.modifier}+b" = "splith"; + "${cfg.config.modifier}+v" = "splitv"; + "${cfg.config.modifier}+f" = "fullscreen toggle"; + "${cfg.config.modifier}+a" = "focus parent"; + "${cfg.config.modifier}+s" = "layout stacking"; + "${cfg.config.modifier}+w" = "layout tabbed"; + "${cfg.config.modifier}+e" = "layout toggle split"; - #screenshot - bindsym $mod+f11 exec grim -g "$(slurp)" ~/Pictures/screenshots/"screenshot-`date +%F-%T`".png - bindsym $mod+Print exec grim -g "$(slurp)" ~/Pictures/screenshots/"screenshot-`date +%F-%T`".png + "${cfg.config.modifier}+Shift+space" = "floating toggle"; + "${cfg.config.modifier}+space" = "focus mode_toggle"; - # Alt tab window switching. - #bindsym $mod+tab workspace next_on_output - #bindsym $mod+Shift+tab workspace prev_on_output - bindsym Mod1+tab workspace back_and_forth - ''; + "${cfg.config.modifier}+1" = "workspace number 1"; + "${cfg.config.modifier}+2" = "workspace number 2"; + "${cfg.config.modifier}+3" = "workspace number 3"; + "${cfg.config.modifier}+4" = "workspace number 4"; + "${cfg.config.modifier}+5" = "workspace number 5"; + "${cfg.config.modifier}+6" = "workspace number 6"; + "${cfg.config.modifier}+7" = "workspace number 7"; + "${cfg.config.modifier}+8" = "workspace number 8"; + "${cfg.config.modifier}+9" = "workspace number 9"; + "${cfg.config.modifier}+0" = "workspace number 10"; + "${cfg.config.modifier}+Shift+1" = "move container to workspace number 1"; + "${cfg.config.modifier}+Shift+2" = "move container to workspace number 2"; + "${cfg.config.modifier}+Shift+3" = "move container to workspace number 3"; + "${cfg.config.modifier}+Shift+4" = "move container to workspace number 4"; + "${cfg.config.modifier}+Shift+5" = "move container to workspace number 5"; + "${cfg.config.modifier}+Shift+6" = "move container to workspace number 6"; + "${cfg.config.modifier}+Shift+7" = "move container to workspace number 7"; + "${cfg.config.modifier}+Shift+8" = "move container to workspace number 8"; + "${cfg.config.modifier}+Shift+9" = "move container to workspace number 9"; + "${cfg.config.modifier}+Shift+0" = "move container to workspace number 10"; + "${cfg.config.modifier}+Shift+minus" = "move scratchpad"; + "${cfg.config.modifier}+minus" = "scratchpad show"; + + "${cfg.config.modifier}+Shift+r" = "reload"; + "${cfg.config.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'"; + + "${cfg.config.modifier}+r" = "mode resize"; + + "XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "F3" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; + "XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "F2" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; + "XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioMicMute" = "exec pactl set-source-mute @DEFAULT_SOURCE@ toggle"; + "XF86MonBrightnessDown" = "exec brightnessctl set 5%-"; + "XF86MonBrightnessUp" = "exec brightnessctl set 5%+"; + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioPrev" = "exec playerctl previous"; + "XF86Search" = "exec ${cfg.config.menu}"; + + "${cfg.config.modifier}+Shift+f" = "exec firefox"; + "${cfg.config.modifier}+Shift+c" = "exec code"; + "${cfg.config.modifier}+f11" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshots/\"screenshot-`date +%F-%T`\".png"; + "${cfg.config.modifier}+Print" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshots/\"screenshot-`date +%F-%T`\".png"; + "Mod1+tab" = "workspace back_and_forth"; + }; }; + extraConfig = '' + set $mod Mod4 + input type:keyboard xkb_capslock disabled + input type:keyboard xkb_numlock enabled + xwayland enable + + assign [class="autostart1"] workspace 1 + assign [class="autostart2"] workspace 2 + assign [class="autostart3"] workspace 3 + assign [class="autostart4"] workspace 4 + + smart_borders no_gaps + smart_gaps on + gaps inner 5 + default_border pixel 1 + default_floating_border pixel 2 + titlebar_border_thickness 1 + client.focused #80a0ff #303030 #c6c6c6 #80a0ff #80a0ff + client.focused_inactive #80a0ff #303030 #c6c6c6 #80a0ff #80a0ff + client.unfocused #80a0ff #080808 #c6c6c6 #80a0ff #303030 + client.urgent #80a0ff #80a0ff #080808 #80a0ff + + for_window [title="(?:Open|Save) (?:File|Folder|As)"] floating enable + for_window [title="(?:Open|Save) (?:File|Folder|As)"] resize set 1920 1080 + 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 [app_id="xdg-desktop-portal-gtk"] floating enable + for_window [app_id="xdg-desktop-portal-gtk"] resize set 1920 1080 + for_window [app_id="bitwarden"] floating enable + for_window [app_id="dolphin"] floating enable + for_window [app_id="file-manager"] floating enable + + client.focused $accent $accent #000000 #00ffcc $accent + client.focused_inactive #000000 #000000 #ff9900 #000000 #000000 + client.unfocused #000000 #000000 #00ffcc #000000 #000000 + client.urgent #ff0000 #ff0000 #00ffcc #ff0000 #ff0000 + client.placeholder #000000 #000000 #00ffcc #000000 #000000 + client.background #000000 + ''; +}; } diff --git a/home/wofi.nix b/home/wofi.nix new file mode 100644 index 0000000..f5ea6d7 --- /dev/null +++ b/home/wofi.nix @@ -0,0 +1,71 @@ +{ pkgs, lib, ... }: +{ + home.packages = with pkgs; [ + wofi + wofi-emoji + bemoji + ]; + + programs.wofi = { + enable = true; + settings = { + location = "center"; + allow_markup = true; + width = "80%"; + }; + style = '' + * { + font-family: monospace; + } + + window { + margin: 0px; + border: 1px solid #c0c0c0; + background-color: #282a36; + border-radius: 10%; + } + + #input { + margin: 2 px; + border: none; + color: #222222; + background-color: #eeeeee; + } + + #inner-box { + margin: 2px; + border: none; + background-color: #282a36; + } + + #outer-box { + margin: 2px; + border: none; + background-color: #282a36; + } + + #scroll { + margin: 0px; + border: none; + } + + #text { + margin: 2px; + border: none; + color: #f8f8f2; + } + + #entry:selected { + background-color: #44475a; + } + #entry { + border-bottom-style: solid; + border-width: 1px; + border-color: #d4af37; + } + ''; + }; + + +} + diff --git a/packages/vim.nix b/packages/vim.nix index 66966b1..16427ef 100644 --- a/packages/vim.nix +++ b/packages/vim.nix @@ -15,7 +15,7 @@ set backspace=indent,eol,start " Turn on syntax highlighting by default syntax on - set tabstop=4 softtabstop=0 autoindent expandtab shiftwidth=4 smarttab + set tabstop=2 softtabstop=0 autoindent expandtab shiftwidth=2 smarttab " ... ''; packages.myplugins = with pkgs.vimPlugins; { diff --git a/profiles/desktop.nix b/profiles/desktop.nix index 167c04c..1ba7123 100644 --- a/profiles/desktop.nix +++ b/profiles/desktop.nix @@ -3,13 +3,11 @@ imports = [ ./base.nix - ./sound.nix #all i would ever need in sound. - ./video.nix #all i would ever need in sound. - ./office.nix #all i would ever need in sound. + ./sound.nix + ./video.nix + ./office.nix ../packages/vim.nix - #../home/home-full.nix - #./sway.nix ../packages/steam.nix ]; @@ -18,8 +16,8 @@ imports = openscad cura - libsForQt5.qt5ct - qt6Packages.qt6ct + #libsForQt5.qt5ct + #qt6Packages.qt6ct ]; fonts.packages = with pkgs; [ @@ -42,12 +40,11 @@ imports = security.polkit.enable = true; - services.displayManager.sddm.enable = true; services.desktopManager.plasma6.enable = true; services.desktopManager.plasma6.enableQt5Integration = true; - qt.platformTheme = "qt5ct"; + qt.platformTheme = "kde"; # Configure keymap in X11 services.xserver.xkb = {