From ce1c48b4a44c55ca70040ac20885721d0e8afe71 Mon Sep 17 00:00:00 2001 From: tristan Date: Thu, 7 Sep 2023 16:17:35 +0100 Subject: [PATCH] style waybar, add mpd module, other fixes --- global/home.nix | 66 +++------------------------------- global/system.nix | 2 ++ hardware/zenix.nix | 11 +++--- lib/home.nix | 2 ++ lib/modules/mpd.nix | 32 +++++++++++++++++ lib/modules/personal.nix | 16 ++++++++- lib/modules/wayland.nix | 78 +++++++++++++++++++++++++++++----------- lib/scripts.nix | 6 ++-- 8 files changed, 121 insertions(+), 92 deletions(-) create mode 100644 lib/modules/mpd.nix diff --git a/global/home.nix b/global/home.nix index d46b955..c413f99 100644 --- a/global/home.nix +++ b/global/home.nix @@ -46,6 +46,8 @@ in obs-studio selectdefaultapplication input-leap + pwvucontrol + easyeffects inkscape libsForQt5.okular @@ -58,7 +60,6 @@ in bitwarden libsForQt5.kasts libreoffice - gimp (makeDesktopItem { name = "logseq"; desktopName = "Logseq"; @@ -97,23 +98,6 @@ in ]; }; - programs.ncmpcpp = { - enable = true; - settings.mpd_host = "music.local"; - bindings = [ - { key = "j"; command = "scroll_down"; } - { key = "k"; command = "scroll_up"; } - { key = "l"; command = "next_column"; } - { key = "h"; command = "previous_column"; } - { key = "J"; command = [ "select_item" "scroll_down" ]; } - { key = "K"; command = [ "select_item" "scroll_up" ]; } - ]; - }; - services.mpd-mpris.enable = true; - services.mpd-mpris.mpd = { - host = "music.local"; - }; - programs.mpv.enable = true; programs.mpv.bindings = { l = "seek 5"; @@ -340,6 +324,9 @@ in Service = { ExecStart = "${pkgs.snapcast}/bin/snapclient -h music.local"; }; + Install = { + WantedBy = ["graphical-session.target"]; + }; }; }; @@ -348,49 +335,6 @@ in indicator = true; }; - wayland.windowManager.sway = { - enable = true; - config = { - modifier = "Mod4"; - input = { - "type:keyboard" = { - xkb_layout = "gb"; - xkb_options = "caps:escape"; - xkb_numlock = "enable"; - }; - "type:touchpad" = { - natural_scroll = "enabled"; - tap = "enabled"; - }; - }; - gaps = { - inner = 10; - }; - keybindings = - let - modifier = config.wayland.windowManager.sway.config.modifier; - in - lib.mkOptionDefault { - "${modifier}+Shift+x" = "kill"; - "${modifier}+d" = "exec ${pkgs.wofi}/bin/wofi --show drun"; - "${modifier}+o" = "exec ${my-deps.fileman}"; - XF86AudioRaiseVolume = "exec ${ my-deps.amixer } sset Master 5%+ && ${ my-deps.amixer } sset Master unmute"; - XF86AudioLowerVolume = "exec ${ my-deps.amixer } sset Master 5%-"; - # XF86AudioPlay = "exec ${ my-scripts.play-pause }/bin/play-pause"; - XF86AudioNext = "exec ${ my-deps.playerctl } next"; - XF86AudioPrev = "exec ${ my-deps.playerctl } previous"; - # XF86MonBrightnessUp = "exec ${ my-scripts.brightness-up }/bin/brightness-up"; - # XF86MonBrightnessDown = "exec ${ my-scripts.brightness-down }/bin/brightness-down"; - # "${modifier}+P" = "exec ${ my-scripts.bwmenu }/bin/bwmenu"; - # "${modifier}+SHIFT+P" = "exec ${ my-scripts.bwotpmenu }/bin/bwotpmenu"; - # "${modifier}+SHIFT+S" = "exec ${ my-scripts.screenshot }/bin/screenshot"; - "${modifier}+M" = "exec ${ my-deps.terminal } -e ncmpcpp"; - "${modifier}+Z" = "exec ${pkgs.swaylock-effects}/bin/swaylock -f"; - }; - bars = [ ]; - }; - }; - programs.qutebrowser = { enable = true; searchEngines = { diff --git a/global/system.nix b/global/system.nix index 70a8793..3692ba9 100644 --- a/global/system.nix +++ b/global/system.nix @@ -74,6 +74,8 @@ user: { config, pkgs, ... }: layout = "gb"; xkbOptions = "caps:escape"; }; + + hardware.opentabletdriver.enable = true; qt.enable = true; qt.platformTheme = "gtk2"; diff --git a/hardware/zenix.nix b/hardware/zenix.nix index 6f6803f..14fd370 100644 --- a/hardware/zenix.nix +++ b/hardware/zenix.nix @@ -87,19 +87,18 @@ wayland.windowManager.hyprland = { extraConfig = '' workspace = DP-1, 1 - workspace = HDMI-A-1, 6 workspace = 1, monitor:DP-1 workspace = 2, monitor:DP-1 workspace = 3, monitor:DP-1 workspace = 4, monitor:DP-1 workspace = 5, monitor:DP-1 - workspace = 6, monitor:HDMI-A-1 - workspace = 7, monitor:HDMI-A-1 - workspace = 8, monitor:HDMI-A-1 - workspace = 9, monitor:HDMI-A-1 - workspace = 10,monitor:HDMI-A-1 ''; }; + programs.waybar.settings.mainBar."hyprland/workspaces".persistent_workspaces = { + DP-1 = 5; + }; + + home.packages = with pkgs; [ monado openxr-loader ]; }]; } diff --git a/lib/home.nix b/lib/home.nix index 10ea3df..0888779 100644 --- a/lib/home.nix +++ b/lib/home.nix @@ -17,6 +17,7 @@ (import ./modules/work.nix { inherit user; }) (import ./modules/menu.nix { inherit user; }) (import ./modules/email.nix { inherit user userName; }) + (import ./modules/mpd.nix { inherit user; }) (import ./modules/git.nix { inherit user userName; }) (import ./modules/laptop.nix { inherit user; }) (import ./modules/dev.nix { inherit user; }) @@ -33,5 +34,6 @@ programs.menu.enable = true; roles.work.enable = work; roles.personal.enable = !work; + roles.mpd.enable = true; } diff --git a/lib/modules/mpd.nix b/lib/modules/mpd.nix new file mode 100644 index 0000000..a30e957 --- /dev/null +++ b/lib/modules/mpd.nix @@ -0,0 +1,32 @@ +{ user }: { lib, pkgs, config, ... }: +with lib; +let + cfg = config.roles.mpd; +in +{ + options.roles.mpd = { + enable = mkEnableOption "setup mpd client"; + host = mkOption {default = "music.local";}; + }; + + config = mkIf cfg.enable { + home-manager.users.${user}.imports = [{ + programs.ncmpcpp = { + enable = true; + settings.mpd_host = cfg.host; + bindings = [ + { key = "j"; command = "scroll_down"; } + { key = "k"; command = "scroll_up"; } + { key = "l"; command = "next_column"; } + { key = "h"; command = "previous_column"; } + { key = "J"; command = [ "select_item" "scroll_down" ]; } + { key = "K"; command = [ "select_item" "scroll_up" ]; } + ]; + }; + services.mpd-mpris = { + enable = true; + mpd.host = cfg.host; + }; + }]; + }; +} diff --git a/lib/modules/personal.nix b/lib/modules/personal.nix index 463bd2d..25c3de4 100644 --- a/lib/modules/personal.nix +++ b/lib/modules/personal.nix @@ -18,8 +18,8 @@ with lib; home-manager.users.${user}.imports = [{ services.nextcloud-client.enable = true; + services.gnome-keyring.enable = true; home.packages = with pkgs; [ - nextcloud-client godot_4 ardour blender @@ -30,6 +30,20 @@ with lib; transmission-remote-gtk krita ]; + + accounts.calendar = { + basePath = "Calendars"; + accounts."tristan@files.tristans.cloud" = { + primary = true; + remote = { + type = "caldav"; + url = "https://files.tristans.cloud/remote.php/dav/"; + userName = "tristan"; + passwordCommand = [ "${pkgs.rbw}/bin/rbw" "get" "files.tristans.cloud" "tristan" ]; + }; + }; + }; + }]; }; } diff --git a/lib/modules/wayland.nix b/lib/modules/wayland.nix index 4791801..271453b 100644 --- a/lib/modules/wayland.nix +++ b/lib/modules/wayland.nix @@ -101,30 +101,30 @@ in submap = reset workspace = 11, default:true - bind = SUPER,1,workspace,11 - bind = SUPER,2,workspace,12 - bind = SUPER,3,workspace,13 - bind = SUPER,4,workspace,14 - bind = SUPER,5,workspace,15 - bind = SUPER,6,workspace,16 - bind = SUPER,7,workspace,17 - bind = SUPER,8,workspace,18 - bind = SUPER,9,workspace,19 - bind = SUPER,0,workspace,20 + bind = SUPER,1,workspace,1 + bind = SUPER,2,workspace,2 + bind = SUPER,3,workspace,3 + bind = SUPER,4,workspace,4 + bind = SUPER,5,workspace,5 + bind = SUPER,6,workspace,6 + bind = SUPER,7,workspace,7 + bind = SUPER,8,workspace,8 + bind = SUPER,9,workspace,9 + bind = SUPER,0,workspace,10 bind = SUPER,left,workspace,r-1 bind = SUPER,right,workspace,r+1 - bind = SUPER_SHIFT,1,movetoworkspace,11 - bind = SUPER_SHIFT,2,movetoworkspace,12 - bind = SUPER_SHIFT,3,movetoworkspace,13 - bind = SUPER_SHIFT,4,movetoworkspace,14 - bind = SUPER_SHIFT,5,movetoworkspace,15 - bind = SUPER_SHIFT,6,movetoworkspace,16 - bind = SUPER_SHIFT,7,movetoworkspace,17 - bind = SUPER_SHIFT,8,movetoworkspace,18 - bind = SUPER_SHIFT,9,movetoworkspace,19 - bind = SUPER_SHIFT,0,movetoworkspace,20 + bind = SUPER_SHIFT,1,movetoworkspace,1 + bind = SUPER_SHIFT,2,movetoworkspace,2 + bind = SUPER_SHIFT,3,movetoworkspace,3 + bind = SUPER_SHIFT,4,movetoworkspace,4 + bind = SUPER_SHIFT,5,movetoworkspace,5 + bind = SUPER_SHIFT,6,movetoworkspace,6 + bind = SUPER_SHIFT,7,movetoworkspace,7 + bind = SUPER_SHIFT,8,movetoworkspace,8 + bind = SUPER_SHIFT,9,movetoworkspace,9 + bind = SUPER_SHIFT,0,movetoworkspace,10 gestures { workspace_swipe = yes @@ -149,6 +149,7 @@ in } general { + gaps_out = 10 resize_on_border = yes layout = master col.active_border = rgb(FFFF00) rgb(00FFFF) rgb(FF00FF) @@ -209,7 +210,7 @@ in layer = "top"; position = "top"; height = 36; - modules-left = [ "hyprland/window" ]; + modules-left = [ "hyprland/workspaces" "hyprland/window" ]; modules-right = [ "mpris" "pulseaudio" "clock" "tray" "battery" ]; clock = { format = "πŸ“… {:%a %b-%d %I:%M %p}"; @@ -231,6 +232,9 @@ in paused = "⏸️"; }; }; + mpd = { + server = "music.local"; + }; battery = { format = "{icon} {capacity}%"; format-icons = [ "🀏" "πŸͺ«" "πŸ”‹" "πŸ”‹" ]; @@ -245,6 +249,38 @@ in enable = true; target = "graphical-session.target"; }; + style = '' + + * { + min-height: 0; + text-shadow: 0 0 3px #080C39, 1px 1px black; + } + + window#waybar { + font-size: small; + background: none; + } + + #workspaces button { + border-radius: 1rem; + padding: 0px .5rem; + margin: 0px .5rem 0px 0px; + } + + #workspaces button.active { + background: rgba(155,155,155,0.3); + } + + .modules-right widget label { + padding: 0 1rem; + margin: 0 .5rem; + } + + #tray { + min-width: 5rem; + } + + ''; }; diff --git a/lib/scripts.nix b/lib/scripts.nix index 4538c1b..b124b8f 100644 --- a/lib/scripts.nix +++ b/lib/scripts.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: let my-deps = { notify-send = "${pkgs.libnotify}/bin/notify-send"; @@ -122,7 +122,7 @@ in key = "G"; }]; } - { + (lib.mkIf config.roles.mpd.enable { name = "ncmpcpp"; text = '' ${my-deps.terminal} -e ncmpcpp @@ -131,7 +131,7 @@ in key = "M"; }]; install = false; - } + }) { name = "menu"; text = ''