From 1dc093de596d8d335a0ce91be5b127a9bb47993f Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 6 Jul 2025 23:24:44 +0200 Subject: [PATCH] starting with plasma manager --- flake.lock | 26 ++++- flake.nix | 9 +- plasma.nix | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 321 insertions(+), 3 deletions(-) create mode 100644 plasma.nix diff --git a/flake.lock b/flake.lock index 417de1c..c029846 100644 --- a/flake.lock +++ b/flake.lock @@ -37,10 +37,34 @@ "type": "github" } }, + "plasma-manager": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748196248, + "narHash": "sha256-1iHjsH6/5UOerJEoZKE+Gx1BgAoge/YcnUsOA4wQ/BU=", + "owner": "nix-community", + "repo": "plasma-manager", + "rev": "b7697abe89967839b273a863a3805345ea54ab56", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "plasma-manager", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "plasma-manager": "plasma-manager" } } }, diff --git a/flake.nix b/flake.nix index c0004d4..d558ac2 100755 --- a/flake.nix +++ b/flake.nix @@ -7,19 +7,24 @@ url = "github:nix-community/home-manager/release-25.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + plasma-manager = { + url = "github:nix-community/plasma-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; }; - outputs = { self, nixpkgs, home-manager, ... }@inputs: { + outputs = { self, nixpkgs, home-manager, plasma-manager, ... }@inputs: { nixosConfigurations = { Felix-Desktop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./configuration.nix - home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.felix = import ./home.nix; + home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; } ]; }; diff --git a/plasma.nix b/plasma.nix new file mode 100644 index 0000000..d58d56f --- /dev/null +++ b/plasma.nix @@ -0,0 +1,289 @@ +{ config, pkgs, ... }: +{ + imports = [ + + ]; + + programs.plasma = { + enable = true; + + # + # Some high-level settings: + # + workspace = { + clickItemTo = "open"; # If you liked the click-to-open default from plasma 5 + lookAndFeel = "org.kde.breezedark.desktop"; + cursor = { + theme = "Bibata-Modern-Ice"; + size = 32; + }; + iconTheme = "Papirus-Dark"; + wallpaper = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers/Patak/contents/images/1080x1920.png"; + }; + + hotkeys.commands."alacritty-full" = { + name = "Launch Alacritty"; + key = "Meta+Enter"; + command = "alacritty --config-file ${config.users.users.username.home}/.config/alacritty/alacritty-full.toml"; + }; + + fonts = { + general = { + family = "JetBrains Mono"; + pointSize = 12; + }; + }; + + panels = [ + # Windows-like panel at the bottom + { + location = "bottom"; + widgets = [ + # We can configure the widgets by adding the name and config + # attributes. For example to add the the kickoff widget and set the + # icon to "nix-snowflake-white" use the below configuration. This will + # add the "icon" key to the "General" group for the widget in + # ~/.config/plasma-org.kde.plasma.desktop-appletsrc. + { + name = "org.kde.plasma.kickoff"; + config = { + General = { + icon = "nix-snowflake-white"; + alphaSort = true; + }; + }; + } + # Or you can configure the widgets by adding the widget-specific options for it. + # See modules/widgets for supported widgets and options for these widgets. + # For example: + { + kickoff = { + sortAlphabetically = true; + icon = "nix-snowflake-white"; + }; + } + # Adding configuration to the widgets can also for example be used to + # pin apps to the task-manager, which this example illustrates by + # pinning dolphin and konsole to the task-manager by default with widget-specific options. + { + iconTasks = { + launchers = [ + "applications:org.kde.dolphin.desktop" + "applications:org.kde.konsole.desktop" + ]; + }; + } + # Or you can do it manually, for example: + { + name = "org.kde.plasma.icontasks"; + config = { + General = { + launchers = [ + "applications:org.kde.dolphin.desktop" + "applications:org.kde.konsole.desktop" + ]; + }; + }; + } + # If no configuration is needed, specifying only the name of the + # widget will add them with the default configuration. + "org.kde.plasma.marginsseparator" + # If you need configuration for your widget, instead of specifying the + # the keys and values directly using the config attribute as shown + # above, plasma-manager also provides some higher-level interfaces for + # configuring the widgets. See modules/widgets for supported widgets + # and options for these widgets. The widgets below shows two examples + # of usage, one where we add a digital clock, setting 12h time and + # first day of the week to Sunday and another adding a systray with + # some modifications in which entries to show. + { + digitalClock = { + calendar.firstDayOfWeek = "sunday"; + time.format = "12h"; + }; + } + { + systemTray.items = { + # We explicitly show bluetooth and battery + shown = [ + "org.kde.plasma.battery" + "org.kde.plasma.bluetooth" + ]; + # And explicitly hide networkmanagement and volume + hidden = [ + "org.kde.plasma.networkmanagement" + "org.kde.plasma.volume" + ]; + }; + } + ]; + hiding = "autohide"; + } + # Application name, Global menu and Song information and playback controls at the top + { + location = "top"; + height = 26; + widgets = [ + { + applicationTitleBar = { + behavior = { + activeTaskSource = "activeTask"; + }; + layout = { + elements = [ "windowTitle" ]; + horizontalAlignment = "left"; + showDisabledElements = "deactivated"; + verticalAlignment = "center"; + }; + overrideForMaximized.enable = false; + titleReplacements = [ + { + type = "regexp"; + originalTitle = "^Brave Web Browser$"; + newTitle = "Brave"; + } + { + type = "regexp"; + originalTitle = ''\\bDolphin\\b''; + newTitle = "File manager"; + } + ]; + windowTitle = { + font = { + bold = false; + fit = "fixedSize"; + size = 12; + }; + hideEmptyTitle = true; + margins = { + bottom = 0; + left = 10; + right = 5; + top = 0; + }; + source = "appName"; + }; + }; + } + "org.kde.plasma.appmenu" + "org.kde.plasma.panelspacer" + { + plasmusicToolbar = { + panelIcon = { + albumCover = { + useAsIcon = false; + radius = 8; + }; + icon = "view-media-track"; + }; + preferredSource = "spotify"; + musicControls.showPlaybackControls = true; + songText = { + displayInSeparateLines = true; + maximumWidth = 640; + scrolling = { + behavior = "alwaysScroll"; + speed = 3; + }; + }; + }; + } + ]; + } + ]; + + window-rules = [ + { + description = "Dolphin"; + match = { + window-class = { + value = "dolphin"; + type = "substring"; + }; + window-types = [ "normal" ]; + }; + apply = { + noborder = { + value = true; + apply = "force"; + }; + # `apply` defaults to "apply-initially" + maximizehoriz = true; + maximizevert = true; + }; + } + ]; + + powerdevil = { + AC = { + powerButtonAction = "lockScreen"; + autoSuspend = { + action = "shutDown"; + idleTimeout = 1000; + }; + turnOffDisplay = { + idleTimeout = 1000; + idleTimeoutWhenLocked = "immediately"; + }; + }; + battery = { + powerButtonAction = "sleep"; + whenSleepingEnter = "standbyThenHibernate"; + }; + lowBattery = { + whenLaptopLidClosed = "hibernate"; + }; + }; + + kwin = { + edgeBarrier = 0; # Disables the edge-barriers introduced in plasma 6.1 + cornerBarrier = false; + + scripts.polonium.enable = true; + }; + + kscreenlocker = { + lockOnResume = true; + timeout = 10; + }; + + # + # Some mid-level settings: + # + shortcuts = { + ksmserver = { + "Lock Session" = [ + "Screensaver" + "Meta+Ctrl+Alt+L" + ]; + }; + + kwin = { + "Expose" = "Meta+,"; + "Switch Window Down" = "Meta+J"; + "Switch Window Left" = "Meta+H"; + "Switch Window Right" = "Meta+L"; + "Switch Window Up" = "Meta+K"; + }; + }; + + # + # Some low-level settings: + # + configFile = { + baloofilerc."Basic Settings"."Indexing-Enabled" = false; + kwinrc."org.kde.kdecoration2".ButtonsOnLeft = "SF"; + kwinrc.Desktops.Number = { + value = 8; + # Forces kde to not change this value (even through the settings app). + immutable = true; + }; + kscreenlockerrc = { + Greeter.WallpaperPlugin = "org.kde.potd"; + # To use nested groups use / as a separator. In the below example, + # Provider will be added to [Greeter][Wallpaper][org.kde.potd][General]. + "Greeter/Wallpaper/org.kde.potd/General".Provider = "bing"; + }; + }; + }; +} \ No newline at end of file