feat: replace waybar/mako/anyrun/wlogout/swaylock with noctolia-shell, remove hyprland (#240)

This commit is contained in:
Ryan Yin
2026-01-03 23:36:54 +08:00
committed by GitHub
parent 847adc7d63
commit fb7a0cd178
74 changed files with 684 additions and 1721 deletions

View File

@@ -1,66 +0,0 @@
{
pkgs,
anyrun,
...
}:
let
anyrunPackages = anyrun.packages.${pkgs.stdenv.hostPlatform.system};
in
{
imports = [
(
{ modulesPath, ... }:
{
# Important! We disable home-manager's module to avoid option
# definition collisions
disabledModules = [ "${modulesPath}/programs/anyrun.nix" ];
}
)
anyrun.homeManagerModules.default
];
programs.anyrun = {
enable = true;
# The package should come from the same flake as all the plugins to avoid breakage.
package = anyrunPackages.anyrun;
config = {
# The horizontal position.
# when using `fraction`, it sets a fraction of the width or height of the screen
x.fraction = 0.5; # at the middle of the screen
# The vertical position.
y.fraction = 0.05; # at the top of the screen
# The width of the runner.
width.fraction = 0.3; # 30% of the screen
hideIcons = false;
ignoreExclusiveZones = false;
layer = "overlay";
hidePluginInfo = false;
closeOnClick = true;
showResultsImmediately = true;
maxEntries = null;
# https://github.com/anyrun-org/anyrun/tree/master/plugins
plugins = with anyrunPackages; [
applications # Launch applications
dictionary # Look up word definitions using the Free Dictionary API.
nix-run # search & run graphical apps from nixpkgs via `nix run`, without installing it.
# randr # quickly change monitor configurations on the fly
rink # A simple calculator plugin
symbols # Look up unicode symbols and custom user defined symbols.
translate # ":zh <text to translate>" Quickly translate text using the Google Translate API.
niri-focus # Search for & focus the window via title/appid on Niri
];
};
extraConfigFiles = {
"symbols.ron".source = ./conf/anyrun/symbols.ron;
"applications.ron".source = ./conf/anyrun/applications.ron;
};
};
# https://github.com/anyrun-org/anyrun/discussions/179
xdg.configFile."anyrun/style.css".source = ./conf/anyrun/style.css;
}

View File

@@ -1,16 +0,0 @@
Config(
// Also show the Desktop Actions defined in the desktop files, e.g. "New Window" from LibreWolf
desktop_actions: true,
max_entries: 5,
// The terminal used for running terminal based desktop entries, if left as `None` a static list of terminals is used
// to determine what terminal to use.
terminal: Some(Terminal(
// The main terminal command
command: "alacritty",
// What arguments should be passed to the terminal process to run the command correctly
// {} is replaced with the command in the desktop entry
args: "-e {}",
)),
)

View File

@@ -1,101 +0,0 @@
/* ===== Color variables ===== */
:root {
--bg-color: #313244;
--fg-color: #cdd6f4;
--primary-color: #89b4fa;
--secondary-color: #cba6f7;
--border-color: var(--primary-color);
--selected-bg-color: var(--primary-color);
--selected-fg-color: var(--bg-color);
}
/* ===== Global reset ===== */
* {
all: unset;
font-family: "JetBrainsMono Nerd Font", monospace;
}
/* ===== Transparent window ===== */
window {
background: transparent;
}
/* ===== Main container ===== */
box.main {
border-radius: 16px;
background-color: color-mix(in srgb, var(--bg-color) 80%, transparent);
border: 0.5px solid color-mix(in srgb, var(--fg-color) 25%, transparent);
padding: 12px; /* add uniform padding around the whole box */
}
/* ===== Input field ===== */
text {
font-size: 1.3rem;
background: transparent;
border: 1px solid var(--border-color);
border-radius: 16px;
margin-bottom: 12px;
padding: 5px 10px;
min-height: 44px;
caret-color: var(--primary-color);
}
/* ===== List container ===== */
.matches {
background-color: transparent;
}
/* ===== Single match row ===== */
.match {
font-size: 1.1rem;
padding: 4px 10px; /* tight vertical spacing */
border-radius: 6px;
}
/* Remove default label margins */
.match * {
margin: 0;
padding: 0;
line-height: 1;
}
/* Selected / hover state */
.match:selected,
.match:hover {
background-color: var(--selected-bg-color);
color: var(--selected-fg-color);
}
.match:selected label.plugin.info,
.match:hover label.plugin.info {
color: var(--selected-fg-color);
}
.match:selected label.match.description,
.match:hover label.match.description {
color: color-mix(in srgb, var(--selected-fg-color) 90%, transparent);
}
/* ===== Plugin info label ===== */
label.plugin.info {
color: var(--fg-color);
font-size: 1rem;
min-width: 160px;
text-align: left;
}
/* ===== Description label ===== */
label.match.description {
font-size: 0rem;
color: var(--fg-color);
}
/* ===== Fade-in animation ===== */
@keyframes fade {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}

View File

@@ -1,10 +0,0 @@
Config(
// The prefix that the search needs to begin with to yield symbol results
prefix: "",
// Custom user defined symbols to be included along the unicode symbols
symbols: {
// "name": "text to be copied"
"shrug": "¯\\_(ツ)_/¯",
},
max_entries: 3,
)

View File

@@ -1,51 +0,0 @@
## Mako configuration file
# GLOBAL CONFIGURATION OPTIONS
max-history=100
sort=-time
# BINDING OPTIONS
on-button-left=dismiss
on-button-middle=none
on-button-right=dismiss-all
on-touch=dismiss
on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga
# STYLE OPTIONS
font=Maple Mono NF CN
width=300
height=100
margin=10
padding=15
border-size=2
border-radius=0
icons=1
max-icon-size=48
icon-location=left
markup=1
actions=1
history=1
text-alignment=left
default-timeout=5000
ignore-timeout=0
max-visible=5
layer=overlay
anchor=top-right
background-color=#1e1e2e
text-color=#d9e0ee
border-color=#313244
progress-color=over #89b4fa
[urgency=low]
border-color=#313244
default-timeout=2000
[urgency=normal]
border-color=#313244
default-timeout=5000
[urgency=high]
border-color=#f38ba8
text-color=#f38ba8
default-timeout=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,159 +0,0 @@
{
"position": "top",
"layer": "top",
"modules-left": ["custom/launcher", "temperature", "backlight", "network"],
"modules-center": ["custom/playerctl"],
"modules-right": [
"wireplumber",
"wireplumber#source",
"cpu",
"memory",
"clock",
"battery",
"idle_inhibitor",
"custom/powermenu",
"tray",
],
"hyprland/workspaces": {
"format": "{icon}",
"on-click": "activate",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"8": "",
"9": "",
"10": "",
"focused": "",
"default": "",
},
},
"clock": {
"interval": 60,
"align": 0,
"rotate": 0,
"tooltip-format": "<big>{:%B %Y}</big>\n<tt><small>{calendar}</small></tt>",
"format": " {:%H:%M}",
"format-alt": " {:%a %b %d, %G}",
},
"cpu": {
"format": "CPU {usage}%",
"interval": 1,
"on-click-middle": "foot btop",
"on-click-right": "foot btop",
},
"memory": {
"format": "MEM {percentage}%",
"interval": 1,
"states": {
"warning": 85,
},
},
"custom/launcher": {
"format": "\uf313 ",
"on-click": "anyrun",
"on-click-middle": "exec default_wall",
"on-click-right": "exec wallpaper_random",
"tooltip": false,
},
"custom/powermenu": {
"format": "\uf011",
"on-click": "wlogout",
"tooltip": false,
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "\uf06e",
"deactivated": "\uf070",
},
"tooltip": false,
},
"custom/playerctl": {
"format": "{icon} <span>{}</span>",
"return-type": "json",
"max-length": 55,
"exec": "playerctl -a metadata --format '{\"text\": \" {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F",
"on-click-middle": "playerctl previous",
"on-click": "playerctl play-pause",
"on-click-right": "playerctl next",
"format-icons": {
"Paused": "<span foreground='#6dd9d9'></span>",
"Playing": "<span foreground='#82db97'></span>",
},
},
"network": {
"interval": 5,
"format": "{ifname}",
"format-wifi": " {signalStrength}% Down: {bandwidthDownBytes} Up: {bandwidthUpBytes} {essid}",
"format-ethernet": " {ifname} Down: {bandwidthDownBytes} Up: {bandwidthUpBytes}",
"format-disconnected": "Disconnected ⚠",
"tooltip-format": " {ifname} via {gwaddri}",
"tooltip-format-wifi": " {ifname} @ {essid}\nIP: {ipaddr}\nStrength: {signalStrength}%\nFreq: {frequency}MHz\nDown: {bandwidthDownBytes} Up: {bandwidthUpBytes}",
"tooltip-format-ethernet": " {ifname}\nIP: {ipaddr}\n Down: {bandwidthDownBytes} Up: {bandwidthUpBytes}",
"tooltip-format-disconnected": "Disconnected",
"max-length": 50,
"on-click-middle": "nm-connection-editor",
"on-click-right": "foot nmtui",
},
"wireplumber": {
"format": "{icon} {volume}%",
"format-muted": " Mute",
"format-bluetooth": " {volume}%",
"format-bluetooth-muted": " Mute",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""],
},
"scroll-step": 5.0,
"on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
"on-click-right": "GSK_RENDERER=opengl pavucontrol",
"smooth-scrolling-threshold": 1,
},
"wireplumber#source": {
"node-type": "Audio/Source",
"format": " {volume}%",
"format-muted": " Muted",
"tooltip": false,
"on-click": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle",
"on-click-right": "GSK_RENDERER=opengl pavucontrol",
"scroll-step": 5,
},
"temperature": {
"format": "\uf2c9 {temperatureC}\u00b0C",
"tooltip": false,
},
"backlight": {
"format": "{icon} {percent}%",
"format-icons": ["", "", "", "", "", "", "", "", ""],
},
"tray": {
"icon-size": 15,
"spacing": 5,
},
"battery": {
"interval": 60,
"states": {
"warning": 30,
"critical": 15,
},
"max-length": 20,
"format": "{icon} {capacity}%",
"format-warning": "{icon} {capacity}%",
"format-critical": "{icon} {capacity}%",
"format-charging": "<span font-family='Font Awesome 6 Free'></span> {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{icon} {time}",
"format-full": " {capacity}%",
"format-icons": [" ", " ", " ", " ", " "],
},
}

View File

@@ -1,38 +0,0 @@
/*
* https://github.com/catppuccin/waybar/blob/main/themes/mocha.css
*
* Catppuccin Mocha palette
* Maintainer: rubyowo
*
*/
@define-color base #1e1e2e;
@define-color mantle #181825;
@define-color crust #11111b;
@define-color text #cdd6f4;
@define-color subtext0 #a6adc8;
@define-color subtext1 #bac2de;
@define-color surface0 #313244;
@define-color surface1 #45475a;
@define-color surface2 #585b70;
@define-color overlay0 #6c7086;
@define-color overlay1 #7f849c;
@define-color overlay2 #9399b2;
@define-color blue #89b4fa;
@define-color lavender #b4befe;
@define-color sapphire #74c7ec;
@define-color sky #89dceb;
@define-color teal #94e2d5;
@define-color green #a6e3a1;
@define-color yellow #f9e2af;
@define-color peach #fab387;
@define-color maroon #eba0ac;
@define-color red #f38ba8;
@define-color mauve #cba6f7;
@define-color pink #f5c2e7;
@define-color flamingo #f2cdcd;
@define-color rosewater #f5e0dc;

View File

@@ -1,156 +0,0 @@
@import "mocha.css";
* {
/* https://docs.gtk.org/gtk3/css-overview.html#colors */
color: @text;
font-family: "Maple Mono NF CN";
font-size: 12pt;
font-weight: bold;
border-radius: 8px;
transition-property: background-color;
transition-duration: 0.5s;
}
@keyframes blink_red {
to {
background-color: rgb(242, 143, 173);
color: rgb(26, 24, 38);
}
}
.warning,
.critical,
.urgent {
animation-name: blink_red;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
window#waybar {
background-color: transparent;
border: 2px solid alpha(@crust, 0.3);
}
window > box {
margin-left: 5px;
margin-right: 5px;
margin-top: 5px;
background-color: shade(@base, 0.9);
padding: 3px;
padding-left: 8px;
border: 2px none #33ccff;
}
#workspaces {
padding-left: 0px;
padding-right: 4px;
}
#workspaces button {
padding-top: 5px;
padding-bottom: 5px;
padding-left: 6px;
padding-right: 6px;
}
#workspaces button.active {
background-color: rgb(181, 232, 224);
color: rgb(26, 24, 38);
}
#workspaces button.urgent {
color: rgb(26, 24, 38);
}
#workspaces button:hover {
background-color: rgb(248, 189, 150);
color: rgb(26, 24, 38);
}
tooltip {
background: rgb(48, 45, 65);
}
tooltip label {
color: rgb(217, 224, 238);
}
#custom-launcher {
font-size: 20px;
padding-left: 8px;
padding-right: 6px;
color: #7ebae4;
}
#mode,
#clock,
#memory,
#temperature,
#cpu,
#custom-playerctl,
#backlight,
#wireplumber,
#wireplumber.source,
#network,
#battery,
#custom-powermenu {
padding-left: 10px;
padding-right: 10px;
}
/* #mode { */
/* margin-left: 10px; */
/* background-color: rgb(248, 189, 150); */
/* color: rgb(26, 24, 38); */
/* } */
#memory {
color: rgb(181, 232, 224);
}
#cpu {
color: rgb(245, 194, 231);
}
#clock {
color: rgb(217, 224, 238);
}
#idle_inhibitor {
color: rgb(221, 182, 242);
padding-right: 8px;
}
#battery {
min-width: 55px;
color: rgb(126, 186, 244);
}
#battery.charging,
#battery.full,
#battery.plugged {
color: #26a65b;
}
#battery.critical:not(.charging) {
color: #f53c3c;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#temperature {
color: rgb(150, 205, 251);
}
#backlight {
color: rgb(248, 189, 150);
}
#wireplumber {
color: rgb(245, 224, 220);
}
#wireplumber.source {
color: rgb(181, 232, 224);
}
#custom-playerctl {
color: rgb(166, 227, 161);
}
#network {
color: #abe9b3;
}
#network.disconnected {
color: rgb(255, 255, 255);
}
#custom-powermenu {
color: rgb(242, 143, 173);
padding-right: 8px;
}
#tray {
padding-right: 8px;
padding-left: 10px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -1,36 +0,0 @@
{
"label" : "lock",
"action" : "~/.config/hypr/scripts/lockscreen",
"text" : "Lock",
"keybind" : "l"
}
{
"label" : "hibernate",
"action" : "systemctl hibernate",
"text" : "Hibernate",
"keybind" : "h"
}
{
"label" : "logout",
"action" : "loginctl terminate-user $USER",
"text" : "Logout",
"keybind" : "e"
}
{
"label" : "shutdown",
"action" : "systemctl poweroff",
"text" : "Shutdown",
"keybind" : "s"
}
{
"label" : "suspend",
"action" : "systemctl suspend",
"text" : "Suspend",
"keybind" : "u"
}
{
"label" : "reboot",
"action" : "systemctl reboot",
"text" : "Reboot",
"keybind" : "r"
}

View File

@@ -1,57 +0,0 @@
/** ********** Fonts ********** **/
* {
font-family: "Maple Mono NF CN", sans-serif;
font-size: 14px;
font-weight: bold;
}
/** ********** Main Window ********** **/
window {
background-color: #1e1e2e;
}
/** ********** Buttons ********** **/
button {
background-color: #242434;
color: #ffffff;
border: 2px solid #282838;
border-radius: 20px;
background-repeat: no-repeat;
background-position: center;
background-size: 35%;
}
button:focus,
button:active,
button:hover {
background-color: #89b4fa;
outline-style: none;
}
/** ********** Icons ********** **/
#lock {
background-image: image(url("icons/lock.png"), url("/usr/share/wlogout/icons/lock.png"));
}
#logout {
background-image: image(url("icons/logout.png"), url("/usr/share/wlogout/icons/logout.png"));
}
#suspend {
background-image: image(url("icons/suspend.png"), url("/usr/share/wlogout/icons/suspend.png"));
}
#hibernate {
background-image: image(
url("icons/hibernate.png"),
url("/usr/share/wlogout/icons/hibernate.png")
);
}
#shutdown {
background-image: image(url("icons/shutdown.png"), url("/usr/share/wlogout/icons/shutdown.png"));
}
#reboot {
background-image: image(url("icons/reboot.png"), url("/usr/share/wlogout/icons/reboot.png"));
}

View File

@@ -1,13 +1,6 @@
{ mylib, pkgs, ... }:
{
config,
pkgs,
...
}:
{
imports = [
./anyrun.nix
./nvidia.nix
];
imports = mylib.scanPaths ./.;
# wayland related
home.sessionVariables = {
@@ -39,37 +32,9 @@
wf-recorder # screen recording
];
xdg.configFile =
let
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
confPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/base/desktop/conf";
in
{
"mako".source = mkSymlink "${confPath}/mako";
"waybar".source = mkSymlink "${confPath}/waybar";
"wlogout".source = mkSymlink "${confPath}/wlogout";
"hypr/hypridle.conf".source = mkSymlink "${confPath}/hypridle.conf";
};
# status bar
programs.waybar = {
enable = true;
systemd.enable = true;
};
# Disable catppuccin to avoid conflict with my non-nix config.
catppuccin.waybar.enable = false;
# screen locker
programs.swaylock.enable = true;
# Logout Menu
programs.wlogout.enable = true;
catppuccin.wlogout.enable = false;
# Hyprland idle daemon
services.hypridle.enable = true;
# notification daemon, the same as dunst
services.mako.enable = true;
catppuccin.mako.enable = false;
}

View File

@@ -0,0 +1,9 @@
{
...
}:
{
xdg.configFile."hypr/hypridle.conf".source = ./hypridle.conf;
# Hyprland idle daemon
services.hypridle.enable = true;
}

View File

@@ -1,7 +1,7 @@
general {
lock_cmd = pidof swaylock || swaylock # avoid starting multiple instances
lock_cmd = noctalia-shell ipc call lockScreen lock # avoid starting multiple instances
before_sleep_cmd = loginctl lock-session # lock before suspend
after_sleep_cmd = hyprctl dispatch dpms on # resume dpms after suspend
# after_sleep_cmd = hyprctl dispatch dpms on # resume dpms after suspend
ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests
}
@@ -20,16 +20,14 @@ listener {
# }
listener {
timeout = 1600 # 20 minutes
on-timeout = pidof swaylock || swaylock # lock screen
on-resume = hyprctl dispatch dpms on # monitor wake up
timeout = 1200 # 20 minutes
on-timeout = noctalia-shell ipc call lockScreen lock # lock screen
}
listener {
timeout = 1660 # 31 minutes
on-timeout = hyprctl dispatch dpms off # screen off
on-resume = hyprctl dispatch dpms on && brightnessctl -r # monitor wake up & screen on
}
# listener {
# timeout = 1660 # 31 minutes
# on-resume = brightnessctl -r # monitor wake up & screen on
# }
# listener {
# timeout = 1800 # 30min

View File

@@ -0,0 +1,54 @@
{
lib,
config,
pkgs,
wallpapers,
...
}:
{
home.packages =
with pkgs;
[
noctalia-shell
qt6Packages.qt6ct # for icon theme
app2unit # Launch Desktop Entries (or arbitrary commands) as Systemd user units
]
++ (lib.optionals pkgs.stdenv.isx86_64 [
gpu-screen-recorder # recoding screen
]);
home.file."Pictures/Wallpapers".source = wallpapers;
xdg.configFile =
let
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
confPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/base/desktop/noctalia";
in
{
"noctalia/settings.json".source = mkSymlink "${confPath}/settings.json";
};
systemd.user.services.noctalia-shell = {
Unit = {
Description = "Noctalia Shell - Wayland desktop shell";
Documentation = "https://docs.noctalia.dev/docs";
PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ];
};
Service = {
ExecStart = lib.getExe pkgs.noctalia-shell;
Restart = "on-failure";
Environment = [
"QT_QPA_PLATFORM=wayland;xcb"
"QT_QPA_PLATFORMTHEME=qt6ct"
"QT_AUTO_SCREEN_SCALE_FACTOR=1"
];
};
Install.WantedBy = [ config.wayland.systemd.target ];
};
}

View File

@@ -0,0 +1,517 @@
{
"appLauncher": {
"customLaunchPrefix": "",
"customLaunchPrefixEnabled": false,
"enableClipPreview": true,
"enableClipboardHistory": false,
"iconMode": "native",
"pinnedExecs": [],
"position": "center",
"showCategories": true,
"sortByMostUsed": true,
"terminalCommand": "xterm -e",
"useApp2Unit": true,
"viewMode": "list"
},
"audio": {
"cavaFrameRate": 30,
"externalMixer": "pwvucontrol || pavucontrol",
"mprisBlacklist": [],
"preferredPlayer": "",
"visualizerType": "linear",
"volumeOverdrive": false,
"volumeStep": 1
},
"bar": {
"capsuleOpacity": 1,
"density": "comfortable",
"exclusive": true,
"floating": false,
"marginHorizontal": 0.25,
"marginVertical": 0.25,
"monitors": [],
"outerCorners": true,
"position": "top",
"showCapsule": true,
"showOutline": false,
"transparent": true,
"widgets": {
"center": [
{
"characterCount": 2,
"colorizeIcons": false,
"enableScrollWheel": true,
"followFocusedScreen": false,
"hideUnoccupied": false,
"id": "Workspace",
"labelMode": "index",
"showApplications": false,
"showLabelsOnlyWhenOccupied": true
}
],
"left": [
{
"hideMode": "alwaysExpanded",
"icon": "rocket",
"id": "CustomButton",
"leftClickExec": "noctalia-shell ipc call launcher toggle",
"leftClickUpdateText": true,
"maxTextLength": {
"horizontal": 10,
"vertical": 10
},
"middleClickExec": "",
"middleClickUpdateText": false,
"parseJson": false,
"rightClickExec": "",
"rightClickUpdateText": false,
"showIcon": true,
"textCollapse": "",
"textCommand": "",
"textIntervalMs": 3000,
"textStream": false,
"wheelDownExec": "",
"wheelDownUpdateText": false,
"wheelExec": "",
"wheelMode": "unified",
"wheelUpExec": "",
"wheelUpUpdateText": false,
"wheelUpdateText": false
},
{
"customFont": "",
"formatHorizontal": "HH:mm ddd, MMM dd",
"formatVertical": "HH mm - dd MM",
"id": "Clock",
"useCustomFont": false,
"usePrimaryColor": false
},
{
"diskPath": "/persistent",
"id": "SystemMonitor",
"showCpuTemp": true,
"showCpuUsage": true,
"showDiskUsage": true,
"showGpuTemp": false,
"showMemoryAsPercent": true,
"showMemoryUsage": true,
"showNetworkStats": true,
"usePrimaryColor": false
},
{
"colorizeIcons": false,
"hideMode": "hidden",
"id": "ActiveWindow",
"maxWidth": 145,
"scrollingMode": "hover",
"showIcon": true,
"useFixedWidth": false
},
{
"hideMode": "hidden",
"hideWhenIdle": false,
"id": "MediaMini",
"maxWidth": 145,
"scrollingMode": "hover",
"showAlbumArt": false,
"showArtistFirst": true,
"showProgressRing": true,
"showVisualizer": false,
"useFixedWidth": false,
"visualizerType": "linear"
}
],
"right": [
{
"id": "ScreenRecorder"
},
{
"hideWhenZero": false,
"id": "NotificationHistory",
"showUnreadBadge": true
},
{
"deviceNativePath": "",
"displayMode": "alwaysShow",
"hideIfNotDetected": true,
"id": "Battery",
"showNoctaliaPerformance": true,
"showPowerProfiles": true,
"warningThreshold": 30
},
{
"displayMode": "alwaysShow",
"id": "Volume"
},
{
"displayMode": "alwaysShow",
"id": "Brightness"
},
{
"blacklist": [],
"colorizeIcons": false,
"drawerEnabled": true,
"hidePassive": false,
"id": "Tray",
"pinned": []
},
{
"colorizeDistroLogo": false,
"colorizeSystemIcon": "none",
"customIconPath": "",
"enableColorization": false,
"icon": "noctalia",
"id": "ControlCenter",
"useDistroLogo": true
}
]
}
},
"brightness": {
"brightnessStep": 2,
"enableDdcSupport": true,
"enforceMinimum": true
},
"calendar": {
"cards": [
{
"enabled": true,
"id": "calendar-header-card"
},
{
"enabled": true,
"id": "calendar-month-card"
},
{
"enabled": true,
"id": "timer-card"
},
{
"enabled": true,
"id": "weather-card"
}
]
},
"colorSchemes": {
"darkMode": true,
"generateTemplatesForPredefined": true,
"manualSunrise": "06:30",
"manualSunset": "18:30",
"matugenSchemeType": "scheme-rainbow",
"predefinedScheme": "Noctalia (default)",
"schedulingMode": "off",
"useWallpaperColors": true
},
"controlCenter": {
"cards": [
{
"enabled": true,
"id": "profile-card"
},
{
"enabled": true,
"id": "shortcuts-card"
},
{
"enabled": true,
"id": "audio-card"
},
{
"enabled": true,
"id": "brightness-card"
},
{
"enabled": true,
"id": "weather-card"
},
{
"enabled": true,
"id": "media-sysmon-card"
}
],
"position": "close_to_bar_button",
"shortcuts": {
"left": [
{
"id": "WiFi"
},
{
"id": "Bluetooth"
},
{
"id": "ScreenRecorder"
},
{
"id": "WallpaperSelector"
}
],
"right": [
{
"id": "Notifications"
},
{
"id": "PowerProfile"
},
{
"id": "KeepAwake"
},
{
"id": "NightLight"
}
]
}
},
"desktopWidgets": {
"enabled": false,
"gridSnap": false,
"monitorWidgets": []
},
"dock": {
"animationSpeed": 1,
"backgroundOpacity": 1,
"colorizeIcons": false,
"deadOpacity": 0.6,
"displayMode": "auto_hide",
"enabled": false,
"floatingRatio": 1,
"inactiveIndicators": false,
"monitors": [],
"onlySameOutput": true,
"pinnedApps": [],
"pinnedStatic": false,
"size": 1
},
"general": {
"allowPanelsOnScreenWithoutBar": true,
"animationDisabled": false,
"animationSpeed": 1,
"avatarImage": "/home/ryan/codes/thiscute.world/static/avatar/myself.jpg",
"boxRadiusRatio": 1,
"compactLockScreen": false,
"dimmerOpacity": 0.2,
"enableShadows": true,
"forceBlackScreenCorners": false,
"iRadiusRatio": 1,
"language": "",
"lockOnSuspend": true,
"radiusRatio": 1,
"scaleRatio": 1,
"screenRadiusRatio": 1,
"shadowDirection": "bottom_right",
"shadowOffsetX": 2,
"shadowOffsetY": 3,
"showHibernateOnLockScreen": false,
"showScreenCorners": false,
"showSessionButtonsOnLockScreen": true
},
"hooks": {
"darkModeChange": "",
"enabled": false,
"performanceModeDisabled": "",
"performanceModeEnabled": "",
"screenLock": "",
"screenUnlock": "",
"wallpaperChange": ""
},
"location": {
"analogClockInCalendar": false,
"firstDayOfWeek": 1,
"name": "Changsha",
"showCalendarEvents": true,
"showCalendarWeather": true,
"showWeekNumberInCalendar": false,
"use12hourFormat": false,
"useFahrenheit": false,
"weatherEnabled": true,
"weatherShowEffects": true
},
"network": {
"wifiEnabled": true
},
"nightLight": {
"autoSchedule": true,
"dayTemp": "6500",
"enabled": true,
"forced": false,
"manualSunrise": "06:30",
"manualSunset": "18:30",
"nightTemp": "4000"
},
"notifications": {
"backgroundOpacity": 1,
"criticalUrgencyDuration": 15,
"enableKeyboardLayoutToast": true,
"enabled": true,
"location": "top_right",
"lowUrgencyDuration": 3,
"monitors": [],
"normalUrgencyDuration": 8,
"overlayLayer": true,
"respectExpireTimeout": false,
"sounds": {
"criticalSoundFile": "",
"enabled": true,
"excludedApps": "discord,firefox,chrome,chromium,edge",
"lowSoundFile": "",
"normalSoundFile": "",
"separateSounds": false,
"volume": 0.5
}
},
"osd": {
"autoHideMs": 2000,
"backgroundOpacity": 1,
"enabled": true,
"enabledTypes": [0, 1, 2, 4],
"location": "top_right",
"monitors": [],
"overlayLayer": true
},
"screenRecorder": {
"audioCodec": "opus",
"audioSource": "default_output",
"colorRange": "limited",
"directory": "/home/ryan/Videos",
"frameRate": 30,
"quality": "high",
"showCursor": true,
"videoCodec": "h264",
"videoSource": "portal"
},
"sessionMenu": {
"countdownDuration": 10000,
"enableCountdown": true,
"largeButtonsStyle": true,
"position": "center",
"powerOptions": [
{
"action": "lock",
"command": "",
"countdownEnabled": true,
"enabled": true
},
{
"action": "suspend",
"command": "",
"countdownEnabled": true,
"enabled": true
},
{
"action": "hibernate",
"command": "",
"countdownEnabled": true,
"enabled": true
},
{
"action": "reboot",
"command": "",
"countdownEnabled": true,
"enabled": true
},
{
"action": "logout",
"command": "",
"countdownEnabled": true,
"enabled": true
},
{
"action": "shutdown",
"command": "",
"countdownEnabled": true,
"enabled": true
}
],
"showHeader": true
},
"settingsVersion": 32,
"systemMonitor": {
"cpuCriticalThreshold": 95,
"cpuPollingInterval": 10000,
"cpuWarningThreshold": 80,
"criticalColor": "",
"diskCriticalThreshold": 90,
"diskPollingInterval": 250,
"diskWarningThreshold": 80,
"enableDgpuMonitoring": false,
"gpuCriticalThreshold": 90,
"gpuPollingInterval": 3000,
"gpuWarningThreshold": 80,
"memCriticalThreshold": 90,
"memPollingInterval": 250,
"memWarningThreshold": 80,
"networkPollingInterval": 3000,
"tempCriticalThreshold": 90,
"tempPollingInterval": 3000,
"tempWarningThreshold": 80,
"useCustomColors": false,
"warningColor": ""
},
"templates": {
"alacritty": false,
"cava": false,
"code": false,
"discord": false,
"emacs": false,
"enableUserTemplates": false,
"foot": false,
"fuzzel": false,
"ghostty": false,
"gtk": false,
"helix": false,
"hyprland": false,
"kcolorscheme": false,
"kitty": false,
"mango": false,
"niri": false,
"pywalfox": false,
"qt": false,
"spicetify": false,
"telegram": false,
"vicinae": false,
"walker": false,
"wezterm": false,
"yazi": false,
"zed": false
},
"ui": {
"bluetoothDetailsViewMode": "grid",
"bluetoothHideUnnamedDevices": false,
"fontDefault": "Maple Mono NF CN",
"fontDefaultScale": 1,
"fontFixed": "Maple Mono NF CN",
"fontFixedScale": 1,
"panelBackgroundOpacity": 0.85,
"panelsAttachedToBar": true,
"settingsPanelMode": "attached",
"tooltipsEnabled": true,
"wifiDetailsViewMode": "grid"
},
"wallpaper": {
"directory": "/home/ryan/Pictures/Wallpapers",
"enableMultiMonitorDirectories": false,
"enabled": true,
"fillColor": "#000000",
"fillMode": "crop",
"hideWallpaperFilenames": false,
"monitorDirectories": [],
"overviewEnabled": true,
"panelPosition": "follow_bar",
"randomEnabled": true,
"randomIntervalSec": 600,
"recursiveSearch": false,
"setWallpaperOnAllMonitors": true,
"transitionDuration": 1500,
"transitionEdgeSmoothness": 0.05,
"transitionType": "random",
"useWallhaven": false,
"wallhavenCategories": "111",
"wallhavenOrder": "desc",
"wallhavenPurity": "100",
"wallhavenQuery": "",
"wallhavenRatios": "",
"wallhavenResolutionHeight": "",
"wallhavenResolutionMode": "atleast",
"wallhavenResolutionWidth": "",
"wallhavenSorting": "relevance"
}
}

View File

@@ -18,7 +18,7 @@
vulkan-tools
mesa-demos
nvitop
(pkgs-x64.zoom-us.override { hyprlandXdgDesktopPortalSupport = true; })
(pkgs-x64.zoom-us)
];
programs.mpv = {

View File

@@ -1,41 +0,0 @@
{
pkgs,
config,
lib,
wallpapers,
...
}:
{
systemd.user.services.wallpaper = {
Unit = {
Description = "Wallpaper Switcher daemon";
After = [
"graphical-session.target"
];
Wants = [ "graphical-session-pre.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart = lib.getExe (
pkgs.writeShellApplication {
name = "wallpaper";
runtimeInputs = with pkgs; [
procps
feh
swaybg
python3
];
text = ''
export WALLPAPERS_DIR="${wallpapers}"
export WALLPAPERS_STATE_FILEPATH="${config.xdg.stateHome}/wallpaper-switcher/switcher_state"
export WALLPAPER_WAIT_MIN=60
export WALLPAPER_WAIT_MAX=180
exec ${./wallpaper-switcher.py}
'';
}
);
RestartSec = 3;
Restart = "on-failure";
};
};
}

View File

@@ -1,169 +0,0 @@
#!/usr/bin/env python3
"""
This script will randomly select a wallpaper from the wallpapers directory.
It will skip the last wallpaper used, so that you don't get the same wallpaper.
It will also set the wallpaper using `feh` for X11, or `swaybg` for Wayland.
Maintainer: ryan4yin [xiaoyin_c@qq.com]
"""
import os
import time
import random
import json
from pathlib import Path
from typing import Union
import subprocess
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class WallpaperSwitcher:
def __init__(
self,
wait_min,
wait_max,
wallpapers_dir: Path,
state_filepath: Path,
image_extensions: Union[tuple, list],
) -> None:
self.wallpapers_dir = wallpapers_dir
self.image_extensions = image_extensions
self.state_filepath = state_filepath
self.wait_min = wait_min
self.wait_max = wait_max
# initialize the state file
self.state_filepath.parent.mkdir(parents=True, exist_ok=True)
self.current_state = self.state_filepath.open("a+", encoding="utf-8")
self.current_wallpaper_list = list()
def run(self):
"""
Iterate on all wallpapers in the wallpapers directory, cycling through them in a random order.
"""
self.initialize_state()
while True:
for i, w in enumerate(self.current_wallpaper_list):
if i < self.current_wallpaper_index:
continue
logger.info(
f"Setting wallpaper {i+1}/{len(self.current_wallpaper_list)}: {w}"
)
self.set_wallpaper(w)
# update the state
self.current_wallpaper_index = i
self.save_state()
wait_time = random.randint(self.wait_min, self.wait_max)
logger.info(f"Waiting {wait_time} seconds...")
time.sleep(wait_time)
# reset the state
self.reset_state()
def save_state(self):
wallpaper_list = [w.as_posix() for w in self.current_wallpaper_list]
state = {
"current_wallpaper_list": wallpaper_list,
"current_wallpaper_index": self.current_wallpaper_index,
}
self.current_state.truncate(0)
self.current_state.write(json.dumps(state, indent=4))
self.current_state.flush()
def initialize_state(self):
self.current_state.seek(0)
data = self.current_state.read()
if not data:
logger.info("No state found, resetting...")
self.reset_state()
else:
logger.info("State found, reloading...")
state = json.loads(data)
wallpapers = [Path(w) for w in state["current_wallpaper_list"]]
self.current_wallpaper_list = wallpapers
self.current_wallpaper_index = state["current_wallpaper_index"]
def reset_state(self):
logger.info(f"Rescanning & shuffle wallpapers in {self.wallpapers_dir} ...")
wallpapers = list(
filter(
lambda x: x.suffix in self.image_extensions,
self.wallpapers_dir.iterdir(),
)
)
random.shuffle(wallpapers)
self.current_wallpaper_list = wallpapers
self.current_wallpaper_index = 0
def set_wallpaper(self, path: Path):
# check if we are running under x11 or wayland
if (
"WAYLAND_DISPLAY" in os.environ
or os.environ.get("XDG_SESSION_TYPE") == "wayland"
):
self.set_wallpaper_wayland(path)
else:
self.set_wallpaper_x11(path)
def set_wallpaper_x11(self, path: Path):
subprocess.run(["feh", "--bg-fill", path])
def set_wallpaper_wayland(self, path: Path):
# find all swaybg processes
swaybg_pids = subprocess.run(
["pgrep", "-f", "swaybg"], stdout=subprocess.PIPE
).stdout.decode("utf-8")
# run swaybg in the background, and make it running even after the parent process exits
subprocess.Popen(
["swaybg", "--output", "*", "--mode", "fill", "--image", path],
start_new_session=True,
)
time.sleep(1)
# kill all old swaybg processes
for pid in swaybg_pids.splitlines():
try:
os.kill(int(pid), 9)
except ProcessLookupError:
pass
def main():
wallpapers_dir = os.getenv("WALLPAPERS_DIR")
state_filepath = os.getenv("WALLPAPERS_STATE_FILEPATH")
if not wallpapers_dir:
raise Exception("WALLPAPERS_DIR not set")
if not state_filepath:
raise Exception("WALLPAPERS_STATE_FILEPATH not set")
image_postfix = (
".jpg",
".jpeg",
".png",
# ".gif",
# ".webp"
)
wait_min = int(os.getenv("WALLPAPER_WAIT_MIN", 60))
wait_max = int(os.getenv("WALLPAPER_WAIT_MAX", 300))
wallpaper_switcher = WallpaperSwitcher(
wait_min,
wait_max,
Path(wallpapers_dir).expanduser(),
Path(state_filepath).expanduser(),
image_postfix,
)
wallpaper_switcher.run()
if __name__ == "__main__":
main()