fix swaync

This commit is contained in:
DACHXY 2024-12-31 00:52:33 +08:00
parent 64499a5e90
commit 2b6381ec57
15 changed files with 234 additions and 223 deletions

View file

@ -1,50 +0,0 @@
{
"$schema": "/etc/xdg/swaync/configSchema.json",
"positionX": "right",
"positionY": "top",
"layer": "overlay",
"control-center-margin-top": 20,
"control-center-margin-bottom": 20,
"control-center-margin-right": 20,
"control-center-margin-left": 20,
"notification-icon-size": 64,
"notification-body-image-height": 100,
"notification-body-image-width": 200,
"timeout": 3,
"timeout-low": 2,
"timeout-critical": 0,
"fit-to-screen": false,
"control-center-width": 500,
"control-center-height": 900,
"notification-window-width": 490,
"keyboard-shortcuts": true,
"image-visibility": "when-available",
"transition-time": 200,
"hide-on-clear": true,
"hide-on-action": true,
"script-fail-notify": true,
"widgets": [
"title",
"notifications",
"mpris"
],
"widget-config": {
"title": {
"text": "Notification Center",
"clear-all-button": true,
"button-text": "󰆴 Clear All"
},
"dnd": {
"text": "Leave me alone!!"
},
"label": {
"max-lines": 1,
"text": "Notification Center"
},
"mpris": {
"image-size": 96,
"image-radius": 7
}
}
}

View file

@ -1,145 +0,0 @@
@define-color bgc rgba(0, 0, 0, 0.1);
@define-color borderc #ebdbb2;
@define-color textc #282828;
* {
font-family: JetBrainsMonoNerdFontMono;
font-weight: bold;
font-size: 15px;
border-width: 3px;
border-color: #ebdbb2;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 1;
background: @bgc;
}
.notification-row {
outline: none;
margin: 20px;
padding: 0;
}
.notification {
background: @textc;
margin: 0px;
border-radius: 0px;
border-width: 3px;
border-color: #ebdbb2;
}
.notification-content {
background: @textc;
padding: 7px;
margin: 0;
}
.close-button {
background: @textc;
color: @borderc;
text-shadow: none;
padding: 0;
border-radius: 20px;
margin-top: 9px;
margin-right: 5px;
}
.close-button:hover {
box-shadow: none;
background: @borderc;
color: @textc;
transition: all 0.15s ease-in-out;
border: none;
}
.notification-action {
color: @bgc;
background: @textc;
}
.summary {
padding-top: 7px;
font-size: 13px;
color: @borderc;
}
.time {
font-size: 11px;
color: @borderc;
margin-right: 40px;
}
.body {
font-size: 12px;
color: @borderc;
}
.control-center {
background-color: @bgc;
border-radius: 20px;
}
.control-center-list {
background: transparent;
}
.control-center-list-placeholder {
opacity: 0.5;
}
.floating-notifications {
background: transparent;
}
.blank-window {
background: alpha(black, 0.1);
}
.widget-title {
color: @borderc;
padding: 10px 10px;
margin: 10px 10px 5px 10px;
font-size: 1.5rem;
}
.widget-title > button {
font-size: 1rem;
color: @borderc;
padding: 10px;
text-shadow: none;
background: @bgc;
box-shadow: none;
border-radius: 5px;
}
.widget-title > button:hover {
background: @borderc;
color: #282828;
}
.widget-label {
margin: 10px 10px 10px 10px;
}
.widget-label > label {
font-size: 1rem;
color: @textc;
}
.widget-mpris {
color: @borderc;
padding: 5px 5px 5px 5px;
margin: 10px;
border-radius: 20px;
}
.widget-mpris > box > button {
border-radius: 20px;
}
.widget-mpris-player {
padding: 5px 5px;
margin: 10px;
}

View file

@ -1,4 +1,4 @@
{ ... }: { pkgs, ... }:
let configDir = ../config; let configDir = ../config;
in in
{ {
@ -10,7 +10,6 @@ in
".config/wallpapers".source = "${configDir}/wallpapers"; ".config/wallpapers".source = "${configDir}/wallpapers";
".config/kitty".source = "${configDir}/kitty"; ".config/kitty".source = "${configDir}/kitty";
".config/neofetch".source = "${configDir}/neofetch"; ".config/neofetch".source = "${configDir}/neofetch";
# ".config/hypr".source = "${configDir}/hypr";
".config/swayidle".source = "${configDir}/swayidle"; ".config/swayidle".source = "${configDir}/swayidle";
".config/swaylock".source = "${configDir}/swaylock"; ".config/swaylock".source = "${configDir}/swaylock";
".config/wlogout".source = "${configDir}/wlogout"; ".config/wlogout".source = "${configDir}/wlogout";
@ -19,11 +18,9 @@ in
source = "${configDir}/waybar"; source = "${configDir}/waybar";
}; };
".config/btop".source = "${configDir}/btop"; ".config/btop".source = "${configDir}/btop";
".config/wofi".source = "${configDir}/wofi";
".config/rofi".source = "${configDir}/rofi"; ".config/rofi".source = "${configDir}/rofi";
".config/mako".source = "${configDir}/mako"; ".config/mako".source = "${configDir}/mako";
".config/scripts".source = "${configDir}/scripts"; ".config/scripts".source = "${configDir}/scripts";
".config/swaync".source = "${configDir}/swaync";
".config/starship.toml".source = "${configDir}/starship/starship.toml"; ".config/starship.toml".source = "${configDir}/starship/starship.toml";
".config/macchiato.toml".source = "${configDir}/starship/macchiato.toml"; ".config/macchiato.toml".source = "${configDir}/starship/macchiato.toml";
".config/gh" = { ".config/gh" = {

View file

@ -10,6 +10,7 @@
./environment.nix ./environment.nix
./virtualization.nix ./virtualization.nix
./hyprland.nix ./hyprland.nix
./swaync.nix
inputs.hyprland.homeManagerModules.default inputs.hyprland.homeManagerModules.default
]; ];

View file

@ -2,7 +2,7 @@
home.sessionVariables = { home.sessionVariables = {
BROWSER = "firefox"; BROWSER = "firefox";
EDITOR = "nvim"; EDITOR = "nvim";
TERMINAL = "kitty"; TERMINAL = "ghostty";
NIXOS_OZONE_WL = "1"; NIXOS_OZONE_WL = "1";
QT_QPA_PLATFORMTHEME = "gtk3"; QT_QPA_PLATFORMTHEME = "gtk3";
QT_SCALE_FACTOR = "1"; QT_SCALE_FACTOR = "1";
@ -16,8 +16,6 @@
WLR_NO_HARDWARE_CURSORS = "1"; WLR_NO_HARDWARE_CURSORS = "1";
CLUTTER_BACKEND = "wayland"; CLUTTER_BACKEND = "wayland";
WLR_RENDERER = "vulkan"; WLR_RENDERER = "vulkan";
XCURSOR_THEME = "catppuccin-macchiato-lavender-cursors";
XCURSOR_SIZE = "24";
XDG_CURRENT_DESKTOP = "Hyprland"; XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland"; XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland"; XDG_SESSION_TYPE = "wayland";
@ -30,7 +28,7 @@
GTK_IM_MODULE = ""; GTK_IM_MODULE = "";
XDG_DATA_DIRS = "\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share"; XDG_DATA_DIRS = "\${XDG_DATA_DIRS}:/usr/share:/var/lib/flatpak/exports/share:\${HOME}/.local/share/flatpak/exports/share";
ELECTRON_OZONE_PLATFORM_HINT = "auto"; ELECTRON_OZONE_PLATFORM_HINT = "auto";
# GDK_BACKEND = "wayland"; GDK_BACKEND = "wayland";
# GPU # GPU
LIBVA_DRIVER_NAME = "nvidia"; LIBVA_DRIVER_NAME = "nvidia";

View file

@ -1,15 +1,33 @@
{ pkgs, ... }: { pkgs, ... }:
let
cursorName = "catppuccin-macchiato-lavender-cursors";
themeName = "catppuccin-macchiato-lavender-compact";
cursorSize = "24";
in
{ {
home.sessionVariables = {
XCURSOR_THEME = cursorName;
XCURSOR_SIZE = cursorSize;
HYPERCURSOR_SIZE = cursorSize;
};
home.pointerCursor = {
gtk.enable = true;
package = pkgs.catppuccin-cursors.macchiatoLavender;
name = cursorName;
size = 24;
};
gtk = { gtk = {
enable = true; enable = true;
cursorTheme = { cursorTheme = {
name = "catppuccin-macchiato-lavender-cursors"; name = cursorName;
package = pkgs.catppuccin-cursors.macchiatoLavender; package = pkgs.catppuccin-cursors.macchiatoLavender;
}; };
theme = { theme = {
name = "catppuccin-macchiato-lavender-compact"; name = themeName;
package = pkgs.catppuccin-gtk.override { package = pkgs.catppuccin-gtk.override {
accents = [ "lavender" ]; accents = [ "lavender" ];
size = "compact"; size = "compact";
@ -24,13 +42,13 @@
gtk3 = { gtk3 = {
extraConfig = { extraConfig = {
gtk-application-prefer-dark-theme = 1; gtk-application-prefer-dark-theme = true;
}; };
}; };
gtk4 = { gtk4 = {
extraConfig = { extraConfig = {
gtk-application-prefer-dark-theme = 1; gtk-application-prefer-dark-theme = true;
}; };
}; };
}; };

View file

@ -1,5 +1,6 @@
{ mainMod }: { mainMod }:
let let
uwsm = "uwsm app --";
browser = "firefox"; browser = "firefox";
terminal = "ghostty"; terminal = "ghostty";
filemanager = "thunar"; filemanager = "thunar";
@ -19,7 +20,7 @@ in
''${mainMod}, E, exec, ${filemanager}'' ''${mainMod}, E, exec, ${filemanager}''
''${mainMod}, V, togglefloating, '' ''${mainMod}, V, togglefloating, ''
''ALT, SPACE, exec, rofi -config ~/.config/rofi/apps.rasi -show drun'' ''ALT, SPACE, exec, rofi -config ~/.config/rofi/apps.rasi -show drun''
''${mainMod} ALT, W, exec, ${scripts}/waybarRestart.sh'' ''${mainMod} ALT, W, exec, ${uwsm} ${scripts}/waybarRestart.sh''
''${mainMod}, P, pseudo, # dwindle'' ''${mainMod}, P, pseudo, # dwindle''
''${mainMod}, S, togglesplit, # dwindle'' ''${mainMod}, S, togglesplit, # dwindle''
''CTRL ${mainMod} SHIFT, L, exec, swaylock'' ''CTRL ${mainMod} SHIFT, L, exec, swaylock''
@ -30,8 +31,7 @@ in
''${mainMod}, X, exec, sleep 0.1 && swaync-client -t -sw'' ''${mainMod}, X, exec, sleep 0.1 && swaync-client -t -sw''
''${mainMod} SHIFT, C, centerwindow'' ''${mainMod} SHIFT, C, centerwindow''
'',F11, fullscreen'' '',F11, fullscreen''
''${mainMod}, F, exec, ${browser}'' ''${mainMod}, C, exec, code''
''${mainMod}, C, exec, NIXOS_OZONE_WL=1 code''
# Cycle windows # Cycle windows
''ALT, TAB, cyclenext'' ''ALT, TAB, cyclenext''

View file

@ -1,15 +1,21 @@
{ pkgs, lib, inputs, system, ... }: { pkgs, lib, inputs, system, ... }:
let let
swayncScript = pkgs.pkgs.writeShellScriptBin "swaync-start" ''
XDG_CONFIG_HOME="$HOME/.dummy" # Prevent swaync use default gtk theme
swaync -c "$HOME/.config/swaync/config.json" -s "$HOME/.config/swaync/style.css"
'';
startupScript = pkgs.pkgs.writeShellScriptBin "start" '' startupScript = pkgs.pkgs.writeShellScriptBin "start" ''
swaync -s ~/.config/swaync/style.css -c ~/.config/swaync/config.json & uwsm app -- ${swayncScript}/bin/swaync-start &
dbus-update-activation-environment --systemd --all & dbus-update-activation-environment --systemd --all &
systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP & systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
waybar -c ~/.config/waybar/config.json -s ~/.config/waybar/style.css & uwsm app -- hyprpaper &
swayidle -w & uwsm app -- waybar -c ~/.config/waybar/config.json -s ~/.config/waybar/style.css &
sway-audio-idle-inhibit & uwsm app -- swayidle -w &
fcitx5 -d -r & uwsm app -- sway-audio-idle-inhibit &
fcitx5-remote -r & fcitx5 -rd &
hyprsunset -t 3000k & uwsm app -- fcitx5-remote -r &
uwsm app -- hyprsunset -t 3000k
''; '';
in in
''${startupScript}/bin/start'' ''${startupScript}/bin/start''

View file

@ -9,6 +9,11 @@ let
plugins = import ./hypr/plugin.nix; plugins = import ./hypr/plugin.nix;
in in
{ {
home.packages = with pkgs; [
hyprpaper
];
systemd.user.targets.hyprland-session.Unit.Wants = [ systemd.user.targets.hyprland-session.Unit.Wants = [
"xdg-desktop-autostart.target" "xdg-desktop-autostart.target"
]; ];
@ -16,6 +21,7 @@ in
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
xwayland.enable = true; xwayland.enable = true;
systemd.enable = false;
package = inputs.hyprland.packages.${system}.hyprland; package = inputs.hyprland.packages.${system}.hyprland;
plugins = (with inputs.hyprland-plugins.packages.${system}; [ plugins = (with inputs.hyprland-plugins.packages.${system}; [
@ -40,7 +46,7 @@ in
settings = { settings = {
preload = [ "~/.config/wallpapers/wall.png" ]; preload = [ "~/.config/wallpapers/wall.png" ];
wallpaper = [ ", ~/.config/wallpapers/wall.png" ]; wallpaper = [ ", ~/.config/wallpapers/wall.png" ];
splash = true; splash = false;
ipc = "on"; ipc = "on";
}; };
}; };

View file

@ -10,7 +10,7 @@
vscode = { vscode = {
enable = true; enable = true;
package = pkgs.vscode.fhs; package = pkgs.vscode;
}; };
obs-studio = { obs-studio = {

View file

@ -3,7 +3,6 @@
cat = "bat"; cat = "bat";
y = "yazi"; y = "yazi";
g = "git"; g = "git";
cd = "z"; # Zoxide
t = "tmux"; t = "tmux";
vim = "nvim"; vim = "nvim";
vi = "nvim"; vi = "nvim";

182
home/user/swaync.nix Normal file
View file

@ -0,0 +1,182 @@
{ pkgs, ... }:
{
services.swaync = {
enable = true;
settings = {
"positionX" = "right";
"positionY" = "top";
"layer" = "overlay";
"control-center-margin-top" = 20;
"control-center-margin-bottom" = 20;
"control-center-margin-right" = 20;
"control-center-margin-left" = 20;
"notification-icon-size" = 64;
"notification-body-image-height" = 100;
"notification-body-image-width" = 200;
"timeout" = 3;
"timeout-low" = 2;
"timeout-critical" = 0;
"fit-to-screen" = false;
"control-center-width" = 500;
"control-center-height" = 900;
"notification-window-width" = 490;
"keyboard-shortcuts" = true;
"image-visibility" = "when-available";
"transition-time" = 200;
"hide-on-clear" = true;
"hide-on-action" = true;
"script-fail-notify" = true;
"widgets" = [
"title"
"notifications"
"mpris"
];
};
style = ''
@define-color bgc rgba(0, 0, 0, 0.1);
@define-color borderc #ebdbb2;
@define-color textc #282828;
.SwayNotificationCenterNotificationWindow {
background: @bgc;
background-color: @bgc;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 1;
background: @bgc;
}
.notification-row {
outline: none;
margin: 20px;
padding: 0;
}
.notification {
background: @textc;
margin: 0px;
border-radius: 0px;
border-width: 3px;
border-color: #ebdbb2;
}
.notification-content {
background: @textc;
padding: 7px;
margin: 0;
}
.close-button {
background: @textc;
color: @borderc;
text-shadow: none;
padding: 0;
border-radius: 20px;
margin-top: 9px;
margin-right: 5px;
}
.close-button:hover {
box-shadow: none;
background: @borderc;
color: @textc;
transition: all 0.15s ease-in-out;
border: none;
}
.notification-action {
color: @bgc;
background: @textc;
}
.summary {
padding-top: 7px;
font-size: 13px;
color: @borderc;
}
.time {
font-size: 11px;
color: @borderc;
margin-right: 40px;
}
.body {
font-size: 12px;
color: @borderc;
}
.control-center {
background-color: @bgc;
border-radius: 20px;
}
.control-center-list {
background: transparent;
}
.control-center-list-placeholder {
opacity: 0.5;
}
.floating-notifications {
background: transparent;
}
.blank-window {
background: alpha(black, 0.1);
}
.widget-title {
color: @borderc;
padding: 10px 10px;
margin: 10px 10px 5px 10px;
font-size: 1.5rem;
}
.widget-title > button {
font-size: 1rem;
color: @borderc;
padding: 10px;
text-shadow: none;
background: @bgc;
box-shadow: none;
border-radius: 5px;
}
.widget-title > button:hover {
background: @borderc;
color: #282828;
}
.widget-label {
margin: 10px 10px 10px 10px;
}
.widget-label > label {
font-size: 1rem;
color: @textc;
}
.widget-mpris {
color: @borderc;
padding: 5px 5px 5px 5px;
margin: 10px;
border-radius: 20px;
}
.widget-mpris > box > button {
border-radius: 20px;
}
.widget-mpris-player {
padding: 5px 5px;
margin: 10px;
}
'';
};
}

View file

@ -15,7 +15,7 @@
system.stateVersion = nix-version; system.stateVersion = nix-version;
home-manager = { home-manager = {
backupFileExtension = "backup"; backupFileExtension = "hm-backup";
useUserPackages = true; useUserPackages = true;
useGlobalPkgs = true; useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs system nix-version; }; extraSpecialArgs = { inherit inputs system nix-version; };

View file

@ -16,5 +16,6 @@ in
environment.variables = { environment.variables = {
ELECTRON_OZONE_PLATFORM_HINT = "auto"; ELECTRON_OZONE_PLATFORM_HINT = "auto";
GSETTINGS_SCHEMA_DIR = "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas"; GSETTINGS_SCHEMA_DIR = "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas";
HYPERCURSOR_SIZE = 24;
}; };
} }

View file

@ -5,7 +5,5 @@
adwaita-icon-theme # default gnome cursors adwaita-icon-theme # default gnome cursors
glib glib
gsettings-desktop-schemas gsettings-desktop-schemas
nwg-look
]; ];
} }