basic river configuration

This commit is contained in:
Rouven Seifert 2023-06-26 23:04:01 +02:00
parent 3b3736c0d3
commit ca8ac0f517
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
11 changed files with 150 additions and 57 deletions

View file

@ -0,0 +1,127 @@
{ config, pkgs, lib, ... }:
{
imports = [
./sway.nix
./river.nix
./waybar.nix
./shikane.nix
];
home.packages = with pkgs; [
swaylock-effects
wl-clipboard
swaynotificationcenter
playerctl
wdisplays
];
services.swayidle = {
enable = true;
events = [
{ event = "before-sleep"; command = lib.getExe pkgs.swaylock-effects; }
{ event = "lock"; command = lib.getExe pkgs.swaylock-effects; }
];
timeouts = [
{ timeout = 300; command = lib.getExe pkgs.swaylock-effects; }
];
systemdTarget = "river-session.target";
};
systemd.user.services.swaync = {
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart = "${pkgs.swaynotificationcenter}/bin/swaync";
Restart = "on-failure";
};
Unit = {
After = "graphical-session-pre.target";
Description = "Simple notification daemon with a GUI built for Sway";
Documentation = "https://github.com/ErikReider/SwayNotificationCenter";
PartOf = "graphical-session.target";
};
};
xdg.configFile = {
"swaync".source = ./swaync;
"fuzzel/fuzzel.ini".text = ''
[main]
icon-theme=${config.gtk.iconTheme.name}
show-actions=yes
width=80
terminal=${lib.getExe pkgs.foot}
[colors]
background=${config.colorScheme.colors.base00}ff
text=${config.colorScheme.colors.base05}ff
match=${config.colorScheme.colors.base08}ff
selection=${config.colorScheme.colors.base02}ff
selection-text=${config.colorScheme.colors.base04}ff
border=${config.colorScheme.colors.base01}ff
'';
"swappy/config".text = ''
[Default]
save_dir = ~/Pictures/Screenshots/
early_exit = true
'';
"swaylock/config".text = ''
indicator-radius=200
indicator-thickness=3
inside-color=00000000
inside-ver-color=${config.colorScheme.colors.base0D}
inside-clear-color=${config.colorScheme.colors.base0B}
ring-color=${config.colorScheme.colors.base03}
ring-wrong-color=${config.colorScheme.colors.base08}
screenshot
effect-blur=7x5
'';
"wlogout/style.css".text = ''
* {
background-image: none;
}
window {
background-color: rgba(12, 12, 12, 0);
}
button {
color: #${config.colorScheme.colors.base05};
background-color: #${config.colorScheme.colors.base00};
border-style: solid;
border-width: 2px;
border-radius: 30px;
margin: 5px;
background-repeat: no-repeat;
background-position: center;
background-size: 25%;
}
button:active, button:hover {
background-color: #${config.colorScheme.colors.base03};
outline-style: none;
}
#lock {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/lock.png"));
}
#logout {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/logout.png"));
}
#suspend {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/suspend.png"));
}
#hibernate {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/hibernate.png"));
}
#shutdown {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/shutdown.png"));
}
#reboot {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/reboot.png"));
}
'';
};
}

View file

@ -0,0 +1,88 @@
{ pkgs, lib, ... }:
{
home.packages = with pkgs; [
river
];
systemd.user.targets.river-session = {
Unit = {
After = "graphical-session-pre.target";
BindsTo = "graphical-session.target";
Description = "river compositor session";
Wants = "graphical-session-pre.target";
};
};
xdg.configFile = {
"river/init" = {
source =
pkgs.writeShellScript "river-init.sh" ''
riverctl focus-follows-cursor always
riverctl spawn rivertile
riverctl default-layout rivertile
riverctl output-layout rivertile
riverctl keyboard-layout -variant dvorak-alt-intl us
riverctl input pointer-2-7-SynPS/2_Synaptics_TouchPad tap enabled
riverctl input pointer-2-7-SynPS/2_Synaptics_TouchPad drag enabled
riverctl input pointer-2-7-SynPS/2_Synaptics_TouchPad middle-emulation enabled
riverctl spawn "${lib.getExe pkgs.swaybg} -i ${../../../../images/wallpaper.png}"
systemctl --user start river-session.target
${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL
riverctl map normal Super Return spawn footclient
riverctl map normal Super+Shift Q close
riverctl map normal Super F toggle-fullscreen
riverctl map normal Super S send-to-output next
riverctl map normal Super+Shift K send-layout-cmd rivertile "main-count +1"
riverctl map normal Super+Shift J send-layout-cmd rivertile "main-count -1"
riverctl map normal Super+Shift L send-layout-cmd rivertile "main-ratio +0.05"
riverctl map normal Super+Shift H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal Super K focus-view next
riverctl map normal Super J focus-view previous
riverctl map normal Super L focus-output next
riverctl map normal Super H focus-output previous
riverctl map normal Super O send-to-output next
# riverctl map-pointer normal Super BTN_LEFT move-view
# riverctl map-pointer normal Super BTN_RIGHT resize-view
riverctl map normal Alt Space spawn ${lib.getExe pkgs.fuzzel}
for i in $(seq 1 9)
do
tags=$((1 << ($i - 1)))
# Super+[1-9] to focus tag [0-8]
riverctl map normal Super $i set-focused-tags $tags
# Super+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal Super+Shift $i set-view-tags $tags
# Super+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal Super+Control $i toggle-focused-tags $tags
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map normal Super+Shift+Control $i toggle-view-tags $tags
done
riverctl map normal None Print spawn "${lib.getExe pkgs.sway-contrib.grimshot} copy area"
riverctl map normal None XF86Launch2 spawn "${lib.getExe pkgs.sway-contrib.grimshot} save area - | ${lib.getExe pkgs.swappy} -f -"
riverctl map normal None XF86MonBrightnessUp spawn "${lib.getExe pkgs.light} -A 10"
riverctl map normal None XF86MonBrightnessDown spawn "${lib.getExe pkgs.light} -U 10"
riverctl map normal None XF86AudioMute spawn "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"
riverctl map normal None XF86AudioMicMute spawn "${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle"
riverctl map normal None XF86AudioRaiseVolume spawn "${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%"
riverctl map normal None XF86AudioLowerVolume spawn "${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%"
riverctl map normal Shift XF86AudioRaiseVolume spawn "${pkgs.pulseaudio}/bin/pactl set-source-volume @DEFAULT_SOURCE@ +5%"
riverctl map normal Shift XF86AudioLowerVolume spawn "${pkgs.pulseaudio}/bin/pactl set-source-volume @DEFAULT_SOURCE@ -5%"
riverctl map normal None XF86Favorites spawn "${pkgs.systemd}/bin/loginctl lock-session"
# riverctl map normal None XF86PowerOff spawn "${lib.getExe pkgs.wlogout}"
riverctl map normal None XF86Messenger spawn "${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel"
riverctl map normal None Cancel spawn "${pkgs.swaynotificationcenter}/bin/swaync-client --hide-latest"
riverctl map normal Shift Cancel spawn "${pkgs.swaynotificationcenter}/bin/swaync-client --cloes-all"
'';
};
};
}

View file

@ -0,0 +1,35 @@
{
services.shikane = {
enable = true;
settings = {
profile = [
{
name = "external-monitor-default";
output = [
{
match = "eDP-1";
enable = true;
}
{
match = "HDMI-A-1";
enable = true;
position = {
x = 1920;
y = 0;
};
}
];
}
{
name = "builtin";
output = [
{
match = "eDP-1";
enable = true;
}
];
}
];
};
};
}

View file

@ -0,0 +1,58 @@
{ config, pkgs, lib, ... }:
{
wayland.windowManager.sway = {
enable = true;
config = rec {
startup = [
{
command = "${lib.getExe pkgs.swaybg} -i ${../../../../images/wallpaper.png}";
}
{
command = lib.getExe pkgs.autotiling-rs;
}
];
modifier = "Mod4";
menu = lib.getExe pkgs.fuzzel;
terminal = "${pkgs.foot}/bin/footclient";
bars = [ ];
gaps = {
outer = 5;
inner = 12;
};
input = {
"*" = {
xkb_layout = "us";
xkb_variant = "dvorak-alt-intl";
};
"2:7:SynPS/2_Synaptics_TouchPad" = {
tap = "enabled";
drag = "enabled";
middle_emulation = "enabled";
};
};
keybindings =
lib.mkOptionDefault {
"Mod1+space" = "exec ${menu}";
"Print" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy area";
"XF86Launch2" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} save area - | ${lib.getExe pkgs.swappy} -f -";
"XF86MonBrightnessUp" = "exec ${lib.getExe pkgs.light} -A 10";
"XF86MonBrightnessDown" = "exec ${lib.getExe pkgs.light} -U 10";
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
"Shift+XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-volume @DEFAULT_SOURCE@ +5%";
"Shift+XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-volume @DEFAULT_SOURCE@ -5%";
"XF86Favorites" = "exec ${pkgs.systemd}/bin/loginctl lock-session";
"XF86PowerOff" = "exec ${lib.getExe pkgs.wlogout}";
"XF86Messenger" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel";
"Cancel" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client --hide-latest";
"Shift+Cancel" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client --cloes-all";
};
};
};
}

View file

@ -0,0 +1,54 @@
{
"$schema": "/etc/xdg/swaync/configSchema.json",
"positionX": "right",
"positionY": "top",
"control-center-margin-top": 20,
"control-center-margin-bottom": 0,
"control-center-margin-right": 20,
"control-center-margin-left": 0,
"control-center-width": 500,
"control-center-height": 600,
"fit-to-screen": false,
"layer": "top",
"cssPriority": "user",
"notification-icon-size": 64,
"notification-body-image-height": 100,
"notification-body-image-width": 200,
"timeout": 10,
"timeout-low": 5,
"timeout-critical": 0,
"notification-window-width": 500,
"keyboard-shortcuts": true,
"image-visibility": "when-available",
"transition-time": 200,
"hide-on-clear": true,
"hide-on-action": true,
"script-fail-notify": true,
"widgets": [
"title",
"dnd",
"mpris",
"notifications"
],
"widget-config": {
"title": {
"text": "Notifications",
"clear-all-button": true,
"button-text": "Clear All"
},
"dnd": {
"text": "Do Not Disturb"
},
"label": {
"max-lines": 5,
"text": "Label Text"
},
"mpris": {
"image-size": 96,
"image-radius": 12
}
}
}

View file

@ -0,0 +1,297 @@
/* Dracula Theme */
@define-color foreground rgb(248, 248, 242);
@define-color background rgb(40, 42, 54);
@define-color background-alpha rgba(40, 42, 54, 0.8);
@define-color accent rgba(189, 147, 249, 0.8);
@define-color current-line rgb(68, 71, 90);
@define-color comment rgb(98, 114, 164);
.notification-row {
transition: all 200ms ease;
outline: none;
margin-bottom: 4px;
margin-right: 13px;
margin-top: 8px;
border-radius: 80px;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 1;
background: transparent;
}
.notification-row:focus .notification,
.notification-row:hover .notification {
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.5);
border: 0px solid @accent;
background: @current-line;
}
.control-center .notification {
box-shadow: none;
}
.control-center .notification-row {
opacity: 0.5;
margin: -5px;
}
.notification {
transition: all 200ms ease;
border-radius: 8px;
margin: 12px 7px 0px 7px;
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.5);
padding: 0;
}
/* Uncomment to enable specific urgency colors
.low {
background: yellow;
padding: 6px;
border-radius: 12px;
}
.normal {
background: green;
padding: 6px;
border-radius: 12px;
}
.critical {
background: red;
padding: 6px;
border-radius: 12px;
}
*/
.notification-content {
background: transparent;
padding: 6px;
border-radius: 8px;
}
.close-button {
background: @current-line;
color: @foreground;
text-shadow: none;
padding: 0;
border-radius: 100%;
margin-top: 17px;
margin-right: 10px;
box-shadow: none;
border: none;
min-width: 24px;
min-height: 24px;
}
.close-button:hover {
box-shadow: none;
background: @comment;
transition: all 0.15s ease-in-out;
border: none;
}
.notification-default-action,
.notification-action {
padding: 4px;
margin: 0;
box-shadow: none;
background: @current-line;
border: 2px solid @accent;
color: @foreground;
}
.notification-default-action:hover,
.notification-action:hover {
-gtk-icon-effect: none;
background: @current-line;
}
.notification-default-action {
border-radius: 8px;
}
/* When alternative actions are visible */
.notification-default-action:not(:only-child) {
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
.notification-action {
border-radius: 0px;
border-top: none;
border-right: none;
}
/* add bottom border radius to eliminate clipping */
.notification-action:first-child {
border-bottom-left-radius: 8px;
}
.notification-action:last-child {
border-bottom-right-radius: 8px;
border-right: 1px solid @accent;
}
.image {
}
.body-image {
margin-top: 6px;
background-color: @foreground;
border-radius: 8px;
}
.summary {
font-size: 16px;
font-weight: bold;
background: transparent;
color: @foreground;
text-shadow: none;
}
.time {
font-size: 16px;
font-weight: bold;
background: transparent;
color: @foreground;
text-shadow: none;
margin-right: 18px;
}
.body {
font-size: 15px;
font-weight: normal;
background: transparent;
color: @foreground;
text-shadow: none;
}
/* The "Notifications" and "Do Not Disturb" text widget */
.top-action-title {
color: @foreground;
text-shadow: none;
}
.control-center-clear-all {
color: @foreground;
text-shadow: none;
background: @background;
border: 2px solid @accent;
box-shadow: none;
border-radius: 8px;
}
.control-center-clear-all:hover {
background: @background;
}
.control-center-dnd {
border-radius: 8px;
background: @background;
border: 1px solid @accent;
box-shadow: none;
}
.control-center-dnd:checked {
background: @accent;
}
.control-center-dnd slider {
background: @background;
border-radius: 8px;
}
.control-center {
background: @background-alpha;
border-radius: 10px;
background-clip: border-box;
padding: 4px;
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.7),
0 2px 6px 2px rgba(0, 0, 0, 0.3);
color: @foreground;
border: 2px solid @accent;
}
.control-center-list {
background: transparent;
}
.floating-notifications {
background: transparent;
}
/* Window behind control center and on all other monitors */
.blank-window {
background: transparent;
}
/*** Widgets ***/
/* Title widget */
.widget-title {
margin: 8px;
font-size: 1.5rem;
}
.widget-title > button {
font-size: initial;
color: @foreground;
text-shadow: none;
background: @background;
border: 2px solid @accent;
box-shadow: none;
border-radius: 8px;
}
.widget-title > button:hover {
background: @background;
}
/* DND widget */
.widget-dnd {
margin: 8px;
font-size: 1.1rem;
}
.widget-dnd > switch {
font-size: initial;
border-radius: 8px;
background: @background;
border: 1px solid @accent;
box-shadow: none;
}
.widget-dnd > switch:checked {
background: @accent;
}
.widget-dnd > switch slider {
background: @background;
border-radius: 8px;
border: 1px solid @foreground;
}
/* Label widget */
.widget-label {
margin: 8px;
}
.widget-label > label {
font-size: 1.1rem;
}
/* Mpris widget */
.widget-mpris {
/* The parent to all players */
}
.widget-mpris-player {
padding: 8px;
margin: 8px;
background-color: @background;
border-radius: 8px;
border: 2px solid @accent;
color: @foreground;
}
.widget-mpris-title {
font-weight: bold;
font-size: 1.25rem;
}
.widget-mpris-subtitle {
font-size: 1.1rem;
}

View file

@ -0,0 +1,230 @@
{ config, pkgs, lib, ... }:
{
systemd.user.services.waybar.Service.Environment = "PATH=${pkgs.swaynotificationcenter}/bin";
programs.waybar = {
enable = true;
systemd.enable = true;
# package = hyprland.packages.x86_64-linux.waybar-hyprland;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 26;
# modules-left = [ "wlr/workspaces" "custom/spotifytitle" "hyprland/window" ];
modules-left = [ "river/tags" "custom/spotifytitle" "river/window" ];
modules-right = [ "network" "cpu" "temperature" "pulseaudio" "battery" "tray" "custom/notification" "clock" ];
network = {
format-wifi = " {essid} ({signalStrength}%)";
format-ethernet = "󰈀 {ipaddr}/{cidr}";
tooltip-format = "󰈀 {ifname} via {gwaddr}";
format-linked = "󰈀 {ifname} (No IP)";
format-disconnected = "Disconnected ";
format-alt = "{ifname}: {ipaddr}/{cidr}";
};
"river/tags" = {
format = "{icon}";
on-click = "activate";
};
"river/window" = {
format = " {}";
# separate-outputs = true;
};
"custom/notification" = {
tooltip = false;
format = "{icon} ";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
# exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
};
"custom/spotifytitle" = {
format = " {}";
max-length = 80;
return-type = "json";
exec = "${lib.getExe pkgs.pww} -w spotifyd:title -p None 2> /dev/null";
};
cpu = {
format = "{usage}% ";
};
temperature = {
hwmon-path = "/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon4/temp1_input";
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [ "" ];
};
pulseaudio = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source} ";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = "󰝟 {format_source}";
format-source = " {volume}% ";
format-source-muted = " ";
format-icons = {
headphone = "";
headset = "󰋎";
default = [ "󰕿" "󰖀" "󰕾" ];
};
on-click = "pavucontrol";
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% {icon} ";
format-charging = "{capacity}% 󱊦";
format-plugged = "{capacity}% ";
format-icons = [ "" "" "" "" "" ];
};
tray = {
spacing = 10;
};
};
};
};
xdg.configFile."waybar/style.css".text = ''
* {
font-family: Roboto, Helvetica, Arial, sans-serif, Iosevka Nerd Font;
font-size: 13px;
}
window#waybar {
background-color: transparent;
color: #${config.colorScheme.colors.base05};
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
background-color: transparent;
}
#tags button {
padding: 0 5px;
background-color: transparent;
color: #${config.colorScheme.colors.base05};
}
#tags button.occupied {
box-shadow: inset 0 -3px #${config.colorScheme.colors.base05};
}
#tags button.focused {
background-color: #${config.colorScheme.colors.base04};
box-shadow: inset 0 -3px #${config.colorScheme.colors.base05};
}
#tags button.urgent {
background-color: #eb4d4b;
}
#custom-spotifytitle,
#custom-notification,
#clock,
#battery,
#cpu,
#memory,
#temperature,
#network,
#pulseaudio,
#window,
#tray{
border-radius: 30px;
padding: 0 10px;
color: #${config.colorScheme.colors.base05};
}
#window,
#workspaces {
margin: 0 4px;
}
#window {
background-color: #${config.colorScheme.colors.base00};
}
#clock {
background-color: #${config.colorScheme.colors.base00};
}
#custom-spotifytitle {
background: #1db954;
color: #191414;
opacity: 1;
transition-property: opacity;
transition-duration: 0.25s;
}
#custom-spotifytitle.Paused,
#custom-spotifytitle.Inactive {
opacity: 0.5;
}
#battery {
background-color: #${config.colorScheme.colors.base02};
color: #${config.colorScheme.colors.base05};
}
#battery.charging, #battery.plugged {
color: #${config.colorScheme.colors.base05};
background-color: #${config.colorScheme.colors.base02};
}
#battery.critical:not(.charging) {
background-color: #${config.colorScheme.colors.base08};
color: #${config.colorScheme.colors.base01};
}
#cpu {
background-color: #${config.colorScheme.colors.base06};
color: #${config.colorScheme.colors.base01};
}
#network {
background-color: #${config.colorScheme.colors.base07};
color: #${config.colorScheme.colors.base01};
}
#network.disconnected {
background-color: #${config.colorScheme.colors.base08};
}
#pulseaudio {
background-color: #${config.colorScheme.colors.base03};
color: #${config.colorScheme.colors.base05};
}
#temperature {
background-color: #${config.colorScheme.colors.base05};
color: #${config.colorScheme.colors.base01};
}
#temperature.critical {
background-color: #${config.colorScheme.colors.base08};
color: #${config.colorScheme.colors.base01};
}
#custom-notification,
#tray {
background-color: #${config.colorScheme.colors.base01};
color: #${config.colorScheme.colors.base05};
}
'';
}