Working on dwlb

This commit is contained in:
2025-09-19 11:44:17 -04:00
parent 24725fcdb8
commit e745c93495
18 changed files with 5504 additions and 136 deletions

8
flake.lock generated
View File

@@ -609,11 +609,11 @@
"neovim-config": { "neovim-config": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1758129669, "lastModified": 1758245901,
"narHash": "sha256-JrWvWU1dzEK57xfvDGGYYRZypxxcgU9Va8Ip6fErBP4=", "narHash": "sha256-chPeDqDeTMhEJib9kwyNq28vjL4QvX6rhig7aVe1Ark=",
"ref": "New-Master", "ref": "New-Master",
"rev": "20165cfee159465cf243999372531dbe20161663", "rev": "239149d1d3897cbefc5cf3d09f17d045f807ee91",
"revCount": 40, "revCount": 44,
"type": "git", "type": "git",
"url": "https://git.th3r00t.net/th3r00t/nvim-config.git" "url": "https://git.th3r00t.net/th3r00t/nvim-config.git"
}, },

View File

@@ -46,12 +46,17 @@
}); });
}) })
(final: prev: { (final: prev: {
dwl = prev.dwl.overrideAttrs { dwl = prev.dwl.overrideAttrs (old: {
src = ./modules/dwl/source; src = ./modules/dwl/source;
patches = [ # Force rebuild when config.def.h changes by including its content
./modules/dwl/patches/focusdir.patch configContent = builtins.readFile ./modules/dwl/source/config.def.h;
]; postPatch = ''
}; # Copy the current config.def.h to config.h
cp config.def.h config.h
'';
buildInputs = old.buildInputs or[] ++ [ final.wlroots ];
nativeBuildInputs = old.nativeBuildInputs or[] ++ [ final.pkg-config final.wayland-scanner final.wayland-protocols ];
});
}) })
]; ];
in { in {

View File

@@ -0,0 +1,60 @@
#!/bin/sh
# dwlb status script for system information
# This script runs in a loop and updates the dwlb status bar
# Get all available outputs
get_outputs() {
wlr-randr | grep '^[^ ]' | cut -d' ' -f1
}
while true; do
# Get current time
TIME=$(date '+%H:%M:%S')
DATE=$(date '+%a %b %d')
# Get battery info if available
BATTERY=""
if [ -f /sys/class/power_supply/BAT*/capacity ]; then
BAT_LEVEL=$(cat /sys/class/power_supply/BAT*/capacity 2>/dev/null | head -1)
BAT_STATUS=$(cat /sys/class/power_supply/BAT*/status 2>/dev/null | head -1)
if [ -n "$BAT_LEVEL" ]; then
case "$BAT_STATUS" in
"Charging") BAT_ICON="🔌" ;;
"Discharging") BAT_ICON="🔋" ;;
"Full") BAT_ICON="🔋" ;;
*) BAT_ICON="🔋" ;;
esac
BATTERY=" ${BAT_ICON}${BAT_LEVEL}%"
fi
fi
# Get CPU usage
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}' 2>/dev/null || echo "")
if [ -n "$CPU_USAGE" ]; then
CPU=" 💻${CPU_USAGE}"
else
CPU=""
fi
# Get memory usage
MEM_INFO=$(free | grep Mem)
if [ -n "$MEM_INFO" ]; then
MEM_USED=$(echo $MEM_INFO | awk '{printf "%.1f", $3/1024/1024}')
MEM_TOTAL=$(echo $MEM_INFO | awk '{printf "%.1f", $2/1024/1024}')
MEMORY=" 🧠${MEM_USED}/${MEM_TOTAL}GB"
else
MEMORY=""
fi
# Combine status
STATUS="${BATTERY}${CPU}${MEMORY} 📅 ${DATE} 🕒 ${TIME}"
# Send to dwlb for all outputs
for output in $(get_outputs); do
dwlb -status "$output" "$STATUS" 2>/dev/null
done
# Update every 5 seconds
sleep 5
done

8
home/.local/usr/bin/dwlb.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
for output in $(wlr-randr | grep '^[^ ]' | cut -d' ' -f1); do
dwlb -middle-bg-color '#16181a' -active-fg-color '#ffffff' \
-active-bg-color '#5ea1ff' -inactive-fg-color '#ffffff' \
-inactive-bg-color '#3c4048' -urgent-fg-color '#ffffff' \
-urgent-bg-color '#ff6e5e' -font 'FiraCode Nerd Font Mono:size=10' &
done

View File

@@ -35,6 +35,7 @@
autossh autossh
elinks elinks
fastfetch fastfetch
htop
ranger ranger
mpv mpv
zip zip
@@ -93,8 +94,8 @@
syncthing syncthing
lazygit lazygit
gopls gopls
# pyright
ncurses ncurses
clang-tools
rustup rustup
wayvnc wayvnc
gvfs gvfs

View File

@@ -100,6 +100,11 @@
dunst dunst
dwl dwl
dwlb dwlb
swaybg
simulide
arduino-cli
rpi-imager
wlr-randr
]; ];
programs = { programs = {
ghostty = { ghostty = {
@@ -171,32 +176,34 @@
width = 400; width = 400;
}; };
style = '' style = ''
/* Base */ /* Cyberdream theme for wofi */
window { window {
background-color: rgba(17, 24, 39, 0.6); background-color: rgba(22, 24, 26, 0.95);
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -4px rgba(0,0,0,0.2);
border-radius: 1rem; border-radius: 1rem;
border: 1px solid rgba(94, 161, 255, 0.3);
font-size: 1rem; font-size: 1rem;
font-family: "FiraCode Nerd Font Mono";
} }
window #outer-box { } window #outer-box { }
window #outer-box #input { window #outer-box #input {
background-color: rgba(17,24,39,0.6); background-color: rgba(60, 64, 72, 0.8);
color: #c0caf5; color: #ffffff;
border: none; border: none;
border-bottom: 1px solid rgba(17,24,39,0.2); border-bottom: 1px solid rgba(94, 161, 255, 0.5);
padding: 0.8rem 1rem; padding: 0.8rem 1rem;
font-size: 1rem; font-size: 1rem;
border-radius: 1rem 1rem 0 0; border-radius: 1rem 1rem 0 0;
} }
/* focus states (no #window!) */ /* focus states */
window #outer-box #input:focus, window #outer-box #input:focus,
window #outer-box #input:focus-visible, window #outer-box #input:focus-visible,
window #outer-box #input:active { window #outer-box #input:active {
border: none; border: none;
outline: 2px solid transparent; outline: 2px solid rgba(94, 161, 255, 0.6);
outline-offset: 2px; outline-offset: 2px;
} }
@@ -204,8 +211,8 @@
window #outer-box #scroll #inner-box { } window #outer-box #scroll #inner-box { }
window #outer-box #scroll #inner-box #entry { window #outer-box #scroll #inner-box #entry {
color: #c0caf5; color: #ffffff;
background-color: rgba(17,24,39,0.1); background-color: rgba(22, 24, 26, 0.3);
padding: 0.6rem 1rem; padding: 0.6rem 1rem;
} }
@@ -215,8 +222,8 @@
} }
window #outer-box #scroll #inner-box #entry:selected { window #outer-box #scroll #inner-box #entry:selected {
color: #c0caf5; color: #ffffff;
background-color: rgba(38,50,56,0.1); background-color: rgba(94, 161, 255, 0.6);
outline: none; outline: none;
} }
''; '';

View File

@@ -12,7 +12,7 @@
users.users.th3r00t = { users.users.th3r00t = {
isNormalUser = true; isNormalUser = true;
description = "Mike 'th3r00t' Young"; description = "Mike 'th3r00t' Young";
extraGroups = [ "networkmanager" "wheel" "input" ]; extraGroups = [ "networkmanager" "wheel" "input" "disk" ];
packages = with pkgs; [ packages = with pkgs; [
# kdePackages.kate # kdePackages.kate
# thunderbird # thunderbird
@@ -67,6 +67,7 @@
"10.0.0.172" = [ "vault" "vault.lan" ]; "10.0.0.172" = [ "vault" "vault.lan" ];
"10.0.0.109" = [ "adguard" "adguard.lan" ]; "10.0.0.109" = [ "adguard" "adguard.lan" ];
"10.0.0.50" = [ "dashy" "dashy.lan" ]; "10.0.0.50" = [ "dashy" "dashy.lan" ];
"10.0.0.252" = [ "retropi" "retropi.lan" ];
}; };
}; };
} }

View File

@@ -27,12 +27,12 @@
options ath10k_core rawmode=1 options ath10k_core rawmode=1
''; '';
}; };
nixpkgs.overlays = [ # nixpkgs.overlays = [
(import (builtins.fetchTarball { # (import (builtins.fetchTarball {
url = "https://github.com/nix-community/emacs-overlay/archive/master.tar.gz"; # url = "https://github.com/nix-community/emacs-overlay/archive/master.tar.gz";
sha256 = "0d04az7ghk446k7wgrlia4rynanx8863xqfw7qzcwqplpzp8h10r"; # sha256 = "0d04az7ghk446k7wgrlia4rynanx8863xqfw7qzcwqplpzp8h10r";
})) # }))
]; # ];
security.rtkit.enable = true; security.rtkit.enable = true;
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).
fonts = { fonts = {
@@ -70,71 +70,71 @@
vim vim
curl curl
age age
(pkgs.emacsWithPackagesFromUsePackage { # (pkgs.emacsWithPackagesFromUsePackage {
# Your Emacs config file. Org mode babel files are also # # Your Emacs config file. Org mode babel files are also
# supported. # # supported.
# NB: Config files cannot contain unicode characters, since # # NB: Config files cannot contain unicode characters, since
# they're being parsed in nix, which lacks unicode # # they're being parsed in nix, which lacks unicode
# support. # # support.
# config = ./emacs.org; # # config = ./emacs.org;
config = ../../home/emacs.org; # config = ../../home/emacs.org;
# config = ./emacs.el; # # config = ./emacs.el;
#
# Whether to include your config as a default init file. # # Whether to include your config as a default init file.
# If being bool, the value of config is used. # # If being bool, the value of config is used.
# Its value can also be a derivation like this if you want to do some # # Its value can also be a derivation like this if you want to do some
# substitution: # # substitution:
# defaultInitFile = pkgs.substituteAll { # # defaultInitFile = pkgs.substituteAll {
# name = "default.el"; # # name = "default.el";
# src = ./emacs.el; # # src = ./emacs.el;
# inherit (config.xdg) configHome dataHome; # # inherit (config.xdg) configHome dataHomenjkasdjf ;
# # };
# defaultInitFile = true;
#
# # Package is optional, defaults to pkgs.emacs
# # package = pkgs.emacs-git;
# package = pkgs.emacs-unstable-pgtk;
# # By default emacsWithPackagesFromUsePackage will only pull in
# # packages with `:ensure`, `:ensure t` or `:ensure <package name>`.
# # Setting `alwaysEnsure` to `true` emulates `use-package-always-ensure`
# # and pulls in all use-package references not explicitly disabled via
# # `:ensure nil` or `:disabled`.
# # Note that this is NOT recommended unless you've actually set
# # `use-package-always-ensure` to `t` in your config.
# alwaysEnsure = true;
#
# # For Org mode babel files, by default only code blocks with
# # `:tangle yes` are considered. Setting `alwaysTangle` to `true`
# # will include all code blocks missing the `:tangle` argument,
# # defaulting it to `yes`.
# # Note that this is NOT recommended unless you have something like
# # `#+PROPERTY: header-args:emacs-lisp :tangle yes` in your config,
# # which defaults `:tangle` to `yes`.
# alwaysTangle = true;
#
# # Optionally provide extra packages not in the configuration file.
# # This can also include extra executables to be run by Emacs (linters,
# # language servers, formatters, etc)
# extraEmacsPackages = epkgs: [
# epkgs.cask
# pkgs.shellcheck
# # Additional packages needed by emacs.org config
# epkgs.s # string manipulation library used by vulpea functions
# # Language servers for lsp-mode
# # pkgs.basedpyright # Python LSP
# pkgs.typescript-language-server # TypeScript/JavaScript LSP
# pkgs.rust-analyzer # Rust LSP
# pkgs.zls # Zig LSP
# pkgs.nimlsp # Nim LSP
# ];
#
# # Optionally override derivations.
# override = final: prev: {
# weechat = prev.melpaPackages.weechat.overrideAttrs(old: {
# patches = [ ./weechat-el.patch ];
# });
# }; # };
defaultInitFile = true; # })
# Package is optional, defaults to pkgs.emacs
# package = pkgs.emacs-git;
package = pkgs.emacs-unstable-pgtk;
# By default emacsWithPackagesFromUsePackage will only pull in
# packages with `:ensure`, `:ensure t` or `:ensure <package name>`.
# Setting `alwaysEnsure` to `true` emulates `use-package-always-ensure`
# and pulls in all use-package references not explicitly disabled via
# `:ensure nil` or `:disabled`.
# Note that this is NOT recommended unless you've actually set
# `use-package-always-ensure` to `t` in your config.
alwaysEnsure = true;
# For Org mode babel files, by default only code blocks with
# `:tangle yes` are considered. Setting `alwaysTangle` to `true`
# will include all code blocks missing the `:tangle` argument,
# defaulting it to `yes`.
# Note that this is NOT recommended unless you have something like
# `#+PROPERTY: header-args:emacs-lisp :tangle yes` in your config,
# which defaults `:tangle` to `yes`.
alwaysTangle = true;
# Optionally provide extra packages not in the configuration file.
# This can also include extra executables to be run by Emacs (linters,
# language servers, formatters, etc)
extraEmacsPackages = epkgs: [
epkgs.cask
pkgs.shellcheck
# Additional packages needed by emacs.org config
epkgs.s # string manipulation library used by vulpea functions
# Language servers for lsp-mode
# pkgs.basedpyright # Python LSP
pkgs.typescript-language-server # TypeScript/JavaScript LSP
pkgs.rust-analyzer # Rust LSP
pkgs.zls # Zig LSP
pkgs.nimlsp # Nim LSP
];
# Optionally override derivations.
override = final: prev: {
weechat = prev.melpaPackages.weechat.overrideAttrs(old: {
patches = [ ./weechat-el.patch ];
});
};
})
]; ];
#media-session.enable = true; #media-session.enable = true;
@@ -171,10 +171,10 @@
pulseaudio.enable = false; pulseaudio.enable = false;
libinput.enable = true; libinput.enable = true;
# logmein-hamachi.enable = true; # logmein-hamachi.enable = true;
emacs = { # emacs = {
enable = true; # enable = true;
package = pkgs.emacs-unstable-pgtk; # package = pkgs.emacs-unstable-pgtk;
}; # };
}; };
# Open ports in the firewall. # Open ports in the firewall.

View File

@@ -0,0 +1,181 @@
From ba3172875d379ff4f2db69753f50067cecfc8293 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me>
Date: Tue, 25 Jul 2023 12:48:22 -0600
Subject: [PATCH] add default transparency for windows and rules for override
the transparency
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
---
config.def.h | 9 ++++++---
dwl.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 22d2171d..0eb86874 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,6 +13,7 @@ static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff);
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
+static const float default_opacity = 0.75;
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
@@ -22,10 +23,10 @@ static int log_level = WLR_ERROR;
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = {
- /* app_id title tags mask isfloating monitor */
+ /* app_id title tags mask isfloating alpha monitor */
/* examples: */
- { "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
- { "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
+ { "Gimp_EXAMPLE", NULL, 0, 1, default_opacity, -1 }, /* Start on currently visible tags floating, not tiled */
+ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 1.0, -1 }, /* Start on ONLY tag "9" */
};
/* layout(s) */
@@ -133,6 +134,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
+ { MODKEY, XKB_KEY_o, setopacity, {.f = +0.1f} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, setopacity, {.f = -0.1f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
diff --git a/dwl.c b/dwl.c
index ad21e1ba..0554fcdf 100644
--- a/dwl.c
+++ b/dwl.c
@@ -138,6 +138,7 @@ typedef struct {
unsigned int bw;
uint32_t tags;
int isfloating, isurgent, isfullscreen;
+ float opacity;
uint32_t resize; /* configure serial of a pending resize */
} Client;
@@ -227,6 +228,7 @@ typedef struct {
const char *title;
uint32_t tags;
int isfloating;
+ float opacity;
int monitor;
} Rule;
@@ -319,6 +321,7 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
static void requestmonstate(struct wl_listener *listener, void *data);
static void resize(Client *c, struct wlr_box geo, int interact);
static void run(char *startup_cmd);
+static void scenebuffersetopacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *user_data);
static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
@@ -326,6 +329,7 @@ static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags);
+static void setopacity(const Arg *arg);
static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data);
static void setup(void);
@@ -491,6 +495,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating;
+ c->opacity = r->opacity;
newtags |= r->tags;
i = 0;
wl_list_for_each(m, &mons, link) {
@@ -499,6 +504,8 @@ applyrules(Client *c)
}
}
}
+ if (c->scene_surface)
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
setmon(c, mon, newtags);
}
@@ -874,6 +881,9 @@ commitnotify(struct wl_listener *listener, void *data)
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
+ if (c->scene_surface)
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
+
/* mark a pending resize as completed */
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
c->resize = 0;
@@ -1120,6 +1130,7 @@ createnotify(struct wl_listener *listener, void *data)
c = toplevel->base->data = ecalloc(1, sizeof(*c));
c->surface.xdg = toplevel->base;
c->bw = borderpx;
+ c->opacity = default_opacity;
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
@@ -2285,6 +2296,15 @@ run(char *startup_cmd)
wl_display_run(dpy);
}
+void
+scenebuffersetopacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *data)
+{
+ Client *c = data;
+ /* xdg-popups are children of Client.scene, we do not have to worry about
+ messing with them. */
+ wlr_scene_buffer_set_opacity(buffer, c->isfullscreen ? 1 : c->opacity);
+}
+
void
setcursor(struct wl_listener *listener, void *data)
{
@@ -2353,6 +2373,7 @@ setfullscreen(Client *c, int fullscreen)
* client positions are set by the user and cannot be recalculated */
resize(c, c->prev, 0);
}
+ wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
arrange(c->mon);
printstatus();
}
@@ -2409,6 +2430,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
focusclient(focustop(selmon), 1);
}
+void
+setopacity(const Arg *arg)
+{
+ Client *sel = focustop(selmon);
+ if (!sel)
+ return;
+
+ sel->opacity += arg->f;
+ if (sel->opacity > 1.0)
+ sel->opacity = 1.0f;
+
+ if (sel->opacity < 0.1)
+ sel->opacity = 0.1f;
+
+ wlr_scene_node_for_each_buffer(&sel->scene_surface->node, scenebuffersetopacity, sel);
+}
+
void
setpsel(struct wl_listener *listener, void *data)
{
@@ -3120,6 +3158,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
c->surface.xwayland = xsurface;
c->type = X11;
c->bw = client_is_unmanaged(c) ? 0 : borderpx;
+ c->opacity = default_opacity;
/* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11);
--
2.48.0

View File

@@ -0,0 +1,227 @@
From da9861cf0448ca94011470634fd61c3ef2129a25 Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Fri, 21 Mar 2025 21:48:42 +0100
Subject: [PATCH] Add menu command
---
config.def.h | 8 +++
dwl.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 164 insertions(+)
diff --git a/config.def.h b/config.def.h
index 22d2171..a5914ca 100644
--- a/config.def.h
+++ b/config.def.h
@@ -20,6 +20,12 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
/* logging */
static int log_level = WLR_ERROR;
+static const Menu menus[] = {
+ /* command feed function action function */
+ { "wmenu -i -l 10 -p Windows", menuwinfeed, menuwinaction },
+ { "wmenu -i -p Layouts", menulayoutfeed, menulayoutaction },
+};
+
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
@@ -140,6 +146,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
+ { MODKEY, XKB_KEY_o, menu, {.v = &menus[0]} },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, menu, {.v = &menus[1]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
diff --git a/dwl.c b/dwl.c
index def2562..b0e8310 100644
--- a/dwl.c
+++ b/dwl.c
@@ -242,6 +242,12 @@ typedef struct {
struct wl_listener destroy;
} SessionLock;
+typedef struct {
+ const char *cmd; /* command to run a menu */
+ void (*feed)(FILE *f); /* feed input to menu */
+ void (*action)(char *line); /* do action based on menu output */
+} Menu;
+
/* function declarations */
static void applybounds(Client *c, struct wlr_box *bbox);
static void applyrules(Client *c);
@@ -302,6 +308,12 @@ static void killclient(const Arg *arg);
static void locksession(struct wl_listener *listener, void *data);
static void mapnotify(struct wl_listener *listener, void *data);
static void maximizenotify(struct wl_listener *listener, void *data);
+static void menu(const Arg *arg);
+static int menuread(int fd, uint32_t mask, void *data);
+static void menuwinfeed(FILE *f);
+static void menuwinaction(char *line);
+static void menulayoutfeed(FILE *f);
+static void menulayoutaction(char *line);
static void monocle(Monitor *m);
static void motionabsolute(struct wl_listener *listener, void *data);
static void motionnotify(uint32_t time, struct wlr_input_device *device, double sx,
@@ -413,6 +425,11 @@ static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
+static const Menu *menu_current;
+static int menu_fd;
+static pid_t menu_pid;
+static struct wl_event_source *menu_source;
+
#ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data);
@@ -1768,6 +1785,145 @@ maximizenotify(struct wl_listener *listener, void *data)
wlr_xdg_surface_schedule_configure(c->surface.xdg);
}
+void
+menu(const Arg *arg)
+{
+ FILE *f;
+ int fd_right[2], fd_left[2];
+
+ if (menu_current != NULL) {
+ wl_event_source_remove(menu_source);
+ close(menu_fd);
+ kill(menu_pid, SIGTERM);
+ menu_current = NULL;
+ if (!arg->v)
+ return;
+ }
+
+ if (pipe(fd_right) == -1 || pipe(fd_left) == -1)
+ return;
+ if ((menu_pid = fork()) == -1)
+ return;
+ if (menu_pid == 0) {
+ close(fd_right[1]);
+ close(fd_left[0]);
+ dup2(fd_right[0], STDIN_FILENO);
+ close(fd_right[0]);
+ dup2(fd_left[1], STDOUT_FILENO);
+ close(fd_left[1]);
+ execl("/bin/sh", "/bin/sh", "-c", ((Menu *)(arg->v))->cmd, NULL);
+ die("dwl: execl %s failed:", "/bin/sh");
+ }
+
+ close(fd_right[0]);
+ close(fd_left[1]);
+ menu_fd = fd_left[0];
+ if (fd_set_nonblock(menu_fd) == -1)
+ return;
+ if (!(f = fdopen(fd_right[1], "w")))
+ return;
+ menu_current = arg->v;
+ menu_current->feed(f);
+ fclose(f);
+ menu_source = wl_event_loop_add_fd(event_loop,
+ menu_fd, WL_EVENT_READABLE, menuread, NULL);
+}
+
+int
+menuread(int fd, uint32_t mask, void *data)
+{
+ char *s;
+ int n;
+ static char line[512];
+ static int i = 0;
+
+ if (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) {
+ i = 0;
+ menu(&(const Arg){ .v = NULL });
+ return 0;
+ }
+ if ((n = read(menu_fd, line + i, LENGTH(line) - 1 - i)) == -1) {
+ if (errno != EAGAIN) {
+ i = 0;
+ menu(&(const Arg){ .v = NULL });
+ }
+ return 0;
+ }
+ line[i + n] = '\0';
+ if (!(s = strchr(line + i, '\n'))) {
+ i += n;
+ return 0;
+ }
+ i = 0;
+ *s = '\0';
+ menu_current->action(line);
+ return 0;
+}
+
+void
+menuwinfeed(FILE *f)
+{
+ Client *c;
+ const char *title, *appid;
+
+ wl_list_for_each(c, &fstack, flink) {
+ if (!(title = client_get_title(c)))
+ continue;
+ fprintf(f, "%s", title);
+ if ((appid = client_get_appid(c)))
+ fprintf(f, " | %s", appid);
+ fputc('\n', f);
+ }
+}
+
+void
+menuwinaction(char *line)
+{
+ Client *c;
+ const char *appid, *title;
+ static char buf[512];
+
+ wl_list_for_each(c, &fstack, flink) {
+ if (!(title = client_get_title(c)))
+ continue;
+ appid = client_get_appid(c);
+ snprintf(buf, LENGTH(buf) - 1, "%s%s%s",
+ title, appid ? " | " : "", appid ? appid : "");
+ if (strcmp(line, buf) == 0)
+ goto found;
+ }
+ return;
+
+found:
+ if (!c->mon)
+ return;
+ wl_list_remove(&c->flink);
+ wl_list_insert(&fstack, &c->flink);
+ selmon = c->mon;
+ view(&(const Arg){ .ui = c->tags });
+}
+
+void
+menulayoutfeed(FILE *f)
+{
+ const Layout *l;
+ for (l = layouts; l < END(layouts); l++)
+ fprintf(f, "%s\n", l->symbol);
+}
+
+void
+menulayoutaction(char *line)
+{
+ const Layout *l;
+ for (l = layouts; l < END(layouts); l++)
+ if (strcmp(line, l->symbol) == 0)
+ goto found;
+ return;
+
+found:
+ setlayout(&(const Arg){ .v = l });
+}
+
void
monocle(Monitor *m)
{
--
2.49.0

View File

@@ -0,0 +1,357 @@
From 8d29d5cace06c97917fbc26c673fd37731ac4984 Mon Sep 17 00:00:00 2001
From: Bonicgamer <44382222+Bonicgamer@users.noreply.github.com>
Date: Mon, 17 Aug 2020 14:48:24 -0400
Subject: [PATCH 1/2] Implement vanitygaps
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
---
config.def.h | 21 ++++++++
dwl.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 160 insertions(+), 10 deletions(-)
diff --git a/config.def.h b/config.def.h
index 22d2171d..39e528b1 100644
--- a/config.def.h
+++ b/config.def.h
@@ -6,7 +6,12 @@
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const unsigned int borderpx = 1; /* border pixel of windows */
+static const unsigned int gappih = 10; /* horiz inner gap between windows */
+static const unsigned int gappiv = 10; /* vert inner gap between windows */
+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff);
@@ -133,6 +138,22 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
+ { MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } },
+ { MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_y, incohgaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_o, incohgaps, {.i = -1 } },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
diff --git a/dwl.c b/dwl.c
index ad21e1ba..fa823957 100644
--- a/dwl.c
+++ b/dwl.c
@@ -197,6 +197,10 @@ struct Monitor {
struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2];
+ int gappih; /* horizontal gap between windows */
+ int gappiv; /* vertical gap between windows */
+ int gappoh; /* horizontal outer gaps */
+ int gappov; /* vertical outer gaps */
unsigned int seltags;
unsigned int sellt;
uint32_t tagset[2];
@@ -271,6 +275,7 @@ static void createpopup(struct wl_listener *listener, void *data);
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void cursorframe(struct wl_listener *listener, void *data);
static void cursorwarptohint(void);
+static void defaultgaps(const Arg *arg);
static void destroydecoration(struct wl_listener *listener, void *data);
static void destroydragicon(struct wl_listener *listener, void *data);
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
@@ -290,6 +295,13 @@ static void fullscreennotify(struct wl_listener *listener, void *data);
static void gpureset(struct wl_listener *listener, void *data);
static void handlesig(int signo);
static void incnmaster(const Arg *arg);
+static void incgaps(const Arg *arg);
+static void incigaps(const Arg *arg);
+static void incihgaps(const Arg *arg);
+static void incivgaps(const Arg *arg);
+static void incogaps(const Arg *arg);
+static void incohgaps(const Arg *arg);
+static void incovgaps(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data);
@@ -323,6 +335,7 @@ static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen);
+static void setgaps(int oh, int ov, int ih, int iv);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags);
@@ -336,6 +349,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg);
+static void togglegaps(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data);
@@ -405,6 +419,7 @@ static struct wlr_output_layout *output_layout;
static struct wlr_box sgeom;
static struct wl_list mons;
static Monitor *selmon;
+static int enablegaps = 1; /* enables gaps, used by togglegaps */
/* global event handlers */
static struct wl_listener cursor_axis = {.notify = axisnotify};
@@ -1048,6 +1063,11 @@ createmon(struct wl_listener *listener, void *data)
for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
+ m->gappih = gappih;
+ m->gappiv = gappiv;
+ m->gappoh = gappoh;
+ m->gappov = gappov;
+
wlr_output_state_init(&state);
/* Initialize monitor state using configured rules */
m->tagset[0] = m->tagset[1] = 1;
@@ -1230,6 +1250,12 @@ cursorwarptohint(void)
}
}
+void
+defaultgaps(const Arg *arg)
+{
+ setgaps(gappoh, gappov, gappih, gappiv);
+}
+
void
destroydecoration(struct wl_listener *listener, void *data)
{
@@ -1566,6 +1592,83 @@ incnmaster(const Arg *arg)
arrange(selmon);
}
+void
+incgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh + arg->i,
+ selmon->gappov + arg->i,
+ selmon->gappih + arg->i,
+ selmon->gappiv + arg->i
+ );
+}
+
+void
+incigaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov,
+ selmon->gappih + arg->i,
+ selmon->gappiv + arg->i
+ );
+}
+
+void
+incihgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov,
+ selmon->gappih + arg->i,
+ selmon->gappiv
+ );
+}
+
+void
+incivgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov,
+ selmon->gappih,
+ selmon->gappiv + arg->i
+ );
+}
+
+void
+incogaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh + arg->i,
+ selmon->gappov + arg->i,
+ selmon->gappih,
+ selmon->gappiv
+ );
+}
+
+void
+incohgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh + arg->i,
+ selmon->gappov,
+ selmon->gappih,
+ selmon->gappiv
+ );
+}
+
+void
+incovgaps(const Arg *arg)
+{
+ setgaps(
+ selmon->gappoh,
+ selmon->gappov + arg->i,
+ selmon->gappih,
+ selmon->gappiv
+ );
+}
+
void
inputdevice(struct wl_listener *listener, void *data)
{
@@ -2357,6 +2460,16 @@ setfullscreen(Client *c, int fullscreen)
printstatus();
}
+void
+setgaps(int oh, int ov, int ih, int iv)
+{
+ selmon->gappoh = MAX(oh, 0);
+ selmon->gappov = MAX(ov, 0);
+ selmon->gappih = MAX(ih, 0);
+ selmon->gappiv = MAX(iv, 0);
+ arrange(selmon);
+}
+
void
setlayout(const Arg *arg)
{
@@ -2701,7 +2814,7 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int mw, my, ty;
+ unsigned int mw, my, ty, h, r, oe = enablegaps, ie = enablegaps;
int i, n = 0;
Client *c;
@@ -2711,22 +2824,31 @@ tile(Monitor *m)
if (n == 0)
return;
+ if (smartgaps == n) {
+ oe = 0; // outer gaps disabled
+ }
+
if (n > m->nmaster)
- mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
+ mw = m->nmaster ? (int)roundf((m->w.width + m->gappiv*ie) * m->mfact) : 0;
else
- mw = m->w.width;
- i = my = ty = 0;
+ mw = m->w.width - 2*m->gappov*oe + m->gappiv*ie;
+ i = 0;
+ my = ty = m->gappoh*oe;
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue;
if (i < m->nmaster) {
- resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
- .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
- my += c->geom.height;
+ r = MIN(n, m->nmaster) - i;
+ h = (m->w.height - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
+ resize(c, (struct wlr_box){.x = m->w.x + m->gappov*oe, .y = m->w.y + my,
+ .width = mw - m->gappiv*ie, .height = h}, 0);
+ my += c->geom.height + m->gappih*ie;
} else {
- resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
- ty += c->geom.height;
+ r = n - i;
+ h = (m->w.height - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
+ resize(c, (struct wlr_box){.x = m->w.x + mw + m->gappov*oe, .y = m->w.y + ty,
+ .width = m->w.width - mw - 2*m->gappov*oe, .height = h}, 0);
+ ty += c->geom.height + m->gappih*ie;
}
i++;
}
@@ -2749,6 +2871,13 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen);
}
+void
+togglegaps(const Arg *arg)
+{
+ enablegaps = !enablegaps;
+ arrange(selmon);
+}
+
void
toggletag(const Arg *arg)
{
--
2.48.0
From e3d10f01df9b7d6735ce9e43ebfdca35b8639f0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@protonmail.com>
Date: Wed, 20 Jul 2022 00:15:32 -0500
Subject: [PATCH 2/2] allow gaps in monocle layout if requested
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
---
config.def.h | 1 +
dwl.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h
index 39e528b1..f4d4095d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -7,6 +7,7 @@
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
+static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappih = 10; /* horiz inner gap between windows */
static const unsigned int gappiv = 10; /* vert inner gap between windows */
diff --git a/dwl.c b/dwl.c
index fa823957..59eabb54 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1922,8 +1922,12 @@ monocle(Monitor *m)
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue;
- resize(c, m->w, 0);
n++;
+ if (!monoclegaps)
+ resize(c, m->w, 0);
+ else
+ resize(c, (struct wlr_box){.x = m->w.x + gappoh, .y = m->w.y + gappov,
+ .width = m->w.width - 2 * gappoh, .height = m->w.height - 2 * gappov}, 0);
}
if (n)
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n);
--
2.48.0

View File

@@ -6,13 +6,20 @@
/* appearance */ /* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */ static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 1; /* border pixel of windows */
static const float rootcolor[] = COLOR(0x222222ff); static const unsigned int gappih = 10; /* horiz inner gap between windows */
static const float bordercolor[] = COLOR(0x444444ff); static const unsigned int gappiv = 10; /* vert inner gap between windows */
static const float focuscolor[] = COLOR(0x005577ff); static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
static const float urgentcolor[] = COLOR(0xff0000ff); static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
static const float rootcolor[] = COLOR(0x16181aff); /* cyberdream background */
static const float bordercolor[] = COLOR(0x3c4048ff); /* cyberdream inactive/dim */
static const float focuscolor[] = COLOR(0x5ea1ffff); /* cyberdream blue */
static const float urgentcolor[] = COLOR(0xff6e5eff); /* cyberdream red */
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */ static const float fullscreen_bg[] = {0.09f, 0.09f, 0.10f, 1.0f}; /* cyberdream background */
static const float default_opacity = 0.75;
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9) #define TAGCOUNT (9)
@@ -20,12 +27,28 @@ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You ca
/* logging */ /* logging */
static int log_level = WLR_ERROR; static int log_level = WLR_ERROR;
/* Autostart */
static const char *const autostart[] = {
"sh", "-c", "~/.local/usr/bin/dwlb.sh", NULL,
"swaybg", "-i", "/etc/nixos/home/Wallpapers/Star_Wars_Linux-1250471.jpg", "-m", "fill", NULL,
"dunst", NULL,
"sh", "-c", "~/.local/usr/bin/dwlb-status.sh &", NULL,
NULL /* terminate */
};
static const Menu menus[] = {
/* command feed function action function */
{ "wmenu -i -l 10 -p Windows", menuwinfeed, menuwinaction },
{ "wmenu -i -p Layouts", menulayoutfeed, menulayoutaction },
};
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */ /* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = { static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */ /* app_id title tags mask isfloating alpha monitor */
/* examples: */ /* examples: */
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */ { "Gimp_EXAMPLE", NULL, 0, 1, default_opacity, -1 }, /* Start on currently visible tags floating, not tiled */
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */ { "firefox_EXAMPLE", NULL, 1 << 8, 0, 1.0, -1 }, /* Start on ONLY tag "9" */
}; };
/* layout(s) */ /* layout(s) */
@@ -44,10 +67,9 @@ static const Layout layouts[] = {
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */ /* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = { static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect x y */ /* name mfact nmaster scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor: /* HiDPI laptop monitor with 2x scaling */
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, { "eDP-1", 0.55f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
*/ /* defaults for other monitors */
/* defaults */
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
}; };
@@ -57,7 +79,7 @@ static const struct xkb_rule_names xkb_rules = {
/* example: /* example:
.options = "ctrl:nocaps", .options = "ctrl:nocaps",
*/ */
.options = NULL, .options = "caps:escape",
}; };
static const int repeat_rate = 25; static const int repeat_rate = 25;
@@ -67,10 +89,10 @@ static const int repeat_delay = 600;
static const int tap_to_click = 1; static const int tap_to_click = 1;
static const int tap_and_drag = 1; static const int tap_and_drag = 1;
static const int drag_lock = 1; static const int drag_lock = 1;
static const int natural_scrolling = 0; static const int natural_scrolling = 1;
static const int disable_while_typing = 1; static const int disable_while_typing = 1;
static const int left_handed = 0; static const int left_handed = 0;
static const int middle_button_emulation = 0; static const int middle_button_emulation = 1;
/* You can choose between: /* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG LIBINPUT_CONFIG_SCROLL_2FG
@@ -107,7 +129,7 @@ LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM; static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */ /* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_ALT #define MODKEY WLR_MODIFIER_LOGO
#define TAGKEYS(KEY,SKEY,TAG) \ #define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
@@ -119,29 +141,112 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */ /* commands */
static const char *termcmd[] = { "foot", NULL }; static const char *termcmd[] = { "kitty", NULL };
static const char *menucmd[] = { "wmenu-run", NULL }; static const char *termtmuxcmd[] = { "kitty", "-e", "tmuxinator", "start", "Dashboard", NULL };
static const char *menucmd[] = { "rofi", "-show", "drun", NULL };
static const char *browsercmd[] = { "qutebrowser", NULL };
static const char *filecmd[] = { "kitty", "-T", "ranger", "-e", "ranger", NULL };
static const char *editorcmd[] = { "kitty", "-T", "Editor", "-e", "tmuxinator", "start", "Development", NULL };
static const char *syscmd[] = { "kitty", "-T", "system-monitor", "-e", "htop", NULL };
static const char *notescmd[] = { "kitty", "-T", "capture", "-e", "pytui", "-n", NULL };
static const char *manpagescmd[] = { "kitty", "-T", "capture", "-e", "pytui", "-m", NULL };
/* Audio control commands */
static const char *volup[] = { "wpctl", "set-volume", "-l", "1", "@DEFAULT_AUDIO_SINK@", "5%+", NULL };
static const char *voldown[] = { "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL };
static const char *volmute[] = { "wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL };
static const char *micmute[] = { "wpctl", "set-mute", "@DEFAULT_AUDIO_SOURCE@", "toggle", NULL };
/* Media control commands */
static const char *playpause[] = { "playerctl", "play-pause", NULL };
static const char *nexttrack[] = { "playerctl", "next", NULL };
static const char *prevtrack[] = { "playerctl", "previous", NULL };
/* Brightness control commands */
static const char *brightnessup[] = { "brightnessctl", "-e4", "-n2", "set", "5%+", NULL };
static const char *brightnessdown[] = { "brightnessctl", "-e4", "-n2", "set", "5%-", NULL };
/* Monitor switching commands */
static const char *laptop_only[] = { "wlr-randr", "--output", "eDP-1", "--on", "--output", "DP-1", "--off", NULL };
static const char *external_only[] = { "wlr-randr", "--output", "eDP-1", "--off", "--output", "DP-1", "--on", "--mode", "2560x1080@74.990997", NULL };
static const char *dual_monitor[] = { "wlr-randr", "--output", "eDP-1", "--on", "--output", "DP-1", "--on", "--pos", "0,-1080", "--mode", "2560x1080@74.990997", NULL };
static const Key keys[] = { static const Key keys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, /* Application launching - based on Hyprland config */
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, { MODKEY, XKB_KEY_r, spawn, {.v = menucmd} },
{ MODKEY, XKB_KEY_Return, spawn, {.v = termcmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termtmuxcmd} },
{ MODKEY, XKB_KEY_b, spawn, {.v = browsercmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, spawn, {.v = filecmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, spawn, {.v = editorcmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_M, spawn, {.v = syscmd} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_n, spawn, {.v = notescmd} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_m, spawn, {.v = manpagescmd} },
/* Monitor switching */
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F1, spawn, {.v = laptop_only} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F2, spawn, {.v = external_only} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F3, spawn, {.v = dual_monitor} },
/* Audio controls */
{ 0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volup} },
{ 0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = voldown} },
{ 0, XKB_KEY_XF86AudioMute, spawn, {.v = volmute} },
{ 0, XKB_KEY_XF86AudioMicMute, spawn, {.v = micmute} },
/* Media controls */
{ 0, XKB_KEY_XF86AudioPlay, spawn, {.v = playpause} },
{ 0, XKB_KEY_XF86AudioPause, spawn, {.v = playpause} },
{ 0, XKB_KEY_XF86AudioNext, spawn, {.v = nexttrack} },
{ 0, XKB_KEY_XF86AudioPrev, spawn, {.v = prevtrack} },
/* Brightness controls */
{ 0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = brightnessup} },
{ 0, XKB_KEY_XF86MonBrightnessDown, spawn, {.v = brightnessdown} },
/* Original dwl keybindings */
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_h, focusdir, {.ui = 0} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_l, focusdir, {.ui = 1} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_k, focusdir, {.ui = 2} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_j, focusdir, {.ui = 3} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
{ MODKEY, XKB_KEY_bracketleft, incihgaps, {.i = +1 } },
{ MODKEY, XKB_KEY_bracketright, incihgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_bracketleft, incivgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_bracketright, incivgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_bracketleft, incohgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_bracketright, incohgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_braceleft, incovgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_braceright, incovgaps, {.i = -1 } },
{ MODKEY, XKB_KEY_u, setopacity, {.f = +0.1f} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_U, setopacity, {.f = -0.1f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} }, { MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} }, { MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_T, setlayout, {.v = &layouts[2]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} }, { MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY, XKB_KEY_o, menu, {.v = &menus[0]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, menu, {.v = &menus[1]} },
{ MODKEY, XKB_KEY_v, togglefloating, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} }, { MODKEY, XKB_KEY_y, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} }, { MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },

View File

@@ -0,0 +1,197 @@
/* Taken from https://github.com/djpohly/dwl/issues/466 */
#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \
((hex >> 16) & 0xFF) / 255.0f, \
((hex >> 8) & 0xFF) / 255.0f, \
(hex & 0xFF) / 255.0f }
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x444444ff);
static const float focuscolor[] = COLOR(0x005577ff);
static const float urgentcolor[] = COLOR(0xff0000ff);
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
/* logging */
static int log_level = WLR_ERROR;
/* Autostart */
static const char *const autostart[] = {
"wbg", "/path/to/your/image", NULL,
NULL /* terminate */
};
static const Menu menus[] = {
/* command feed function action function */
{ "wmenu -i -l 10 -p Windows", menuwinfeed, menuwinaction },
{ "wmenu -i -p Layouts", menulayoutfeed, menulayoutaction },
};
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = {
/* app_id title tags mask isfloating alpha monitor */
/* examples: */
{ "Gimp_EXAMPLE", NULL, 0, 1, default_opacity, -1 }, /* Start on currently visible tags floating, not tiled */
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, 1.0, -1 }, /* Start on ONLY tag "9" */
};
/* layout(s) */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* monitors */
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899
*/
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor:
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
*/
/* defaults */
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
/* example:
.options = "ctrl:nocaps",
*/
.options = NULL,
};
static const int repeat_rate = 25;
static const int repeat_delay = 600;
/* Trackpad */
static const int tap_to_click = 1;
static const int tap_and_drag = 1;
static const int drag_lock = 1;
static const int natural_scrolling = 0;
static const int disable_while_typing = 1;
static const int left_handed = 0;
static const int middle_button_emulation = 0;
/* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG
LIBINPUT_CONFIG_SCROLL_EDGE
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
*/
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
/* You can choose between:
LIBINPUT_CONFIG_CLICK_METHOD_NONE
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
*/
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
/* You can choose between:
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
*/
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
/* You can choose between:
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
*/
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
static const double accel_speed = 0.0;
/* You can choose between:
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
*/
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_ALT
#define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static const char *termcmd[] = { "foot", NULL };
static const char *menucmd[] = { "wmenu-run", NULL };
static const Key keys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_h, focusdir, {.ui = 0} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_l, focusdir, {.ui = 1} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_k, focusdir, {.ui = 2} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_j, focusdir, {.ui = 3} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY, XKB_KEY_o, setopacity, {.f = +0.1f} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, setopacity, {.f = -0.1f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY, XKB_KEY_o, menu, {.v = &menus[0]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, menu, {.v = &menus[1]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
/* Ctrl-Alt-Fx is used to switch to another VT, if you don't know what a VT is
* do not remove them.
*/
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};

242
modules/dwl/source/config.h Normal file
View File

@@ -0,0 +1,242 @@
/* Taken from https://github.com/djpohly/dwl/issues/466 */
#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \
((hex >> 16) & 0xFF) / 255.0f, \
((hex >> 8) & 0xFF) / 255.0f, \
(hex & 0xFF) / 255.0f }
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappih = 10; /* horiz inner gap between windows */
static const unsigned int gappiv = 10; /* vert inner gap between windows */
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
static const float rootcolor[] = COLOR(0x16181aff); /* cyberdream background */
static const float bordercolor[] = COLOR(0x3c4048ff); /* cyberdream inactive/dim */
static const float focuscolor[] = COLOR(0x5ea1ffff); /* cyberdream blue */
static const float urgentcolor[] = COLOR(0xff6e5eff); /* cyberdream red */
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.09f, 0.09f, 0.10f, 1.0f}; /* cyberdream background */
static const float default_opacity = 0.75;
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
/* logging */
static int log_level = WLR_ERROR;
/* Autostart */
static const char *const autostart[] = {
"sh", "-c", "dwlb", "-middle-bg-color", "#16181a","-active-fg-color", "#ffffff","-active-bg-color","#5ea1ff","-inactive-fg-color", "#ffffff","-inactive-bg-color","#3c4048","-urgent-fg-color","#ffffff","-urgent-bg-color","#ff6e5e", "-font", "FiraCode Nerd Font Mono:size=9", NULL,
"swaybg", "-i", "/etc/nixos/home/Wallpapers/Star_Wars_Linux-1250471.jpg", "-m", "fill", NULL,
NULL /* terminate */
};
static const Menu menus[] = {
/* command feed function action function */
{ "wmenu -i -l 10 -p Windows", menuwinfeed, menuwinaction },
{ "wmenu -i -p Layouts", menulayoutfeed, menulayoutaction },
};
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
static const Rule rules[] = {
/* app_id title tags mask isfloating alpha monitor */
/* examples: */
{ "Gimp_EXAMPLE", NULL, 0, 1, default_opacity, -1 }, /* Start on currently visible tags floating, not tiled */
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, 1.0, -1 }, /* Start on ONLY tag "9" */
};
/* layout(s) */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* monitors */
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899
*/
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect x y */
/* HiDPI laptop monitor with 2x scaling */
{ "eDP-1", 0.55f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
/* defaults for other monitors */
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
/* example:
.options = "ctrl:nocaps",
*/
.options = "caps:escape",
};
static const int repeat_rate = 25;
static const int repeat_delay = 600;
/* Trackpad */
static const int tap_to_click = 1;
static const int tap_and_drag = 1;
static const int drag_lock = 1;
static const int natural_scrolling = 1;
static const int disable_while_typing = 1;
static const int left_handed = 0;
static const int middle_button_emulation = 1;
/* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG
LIBINPUT_CONFIG_SCROLL_EDGE
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
*/
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
/* You can choose between:
LIBINPUT_CONFIG_CLICK_METHOD_NONE
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
*/
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
/* You can choose between:
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
*/
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
/* You can choose between:
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
*/
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
static const double accel_speed = 0.0;
/* You can choose between:
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
*/
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_LOGO
#define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static const char *termcmd[] = { "kitty", NULL };
static const char *termtmuxcmd[] = { "kitty", "-e", "tmux", NULL };
static const char *menucmd[] = { "rofi", "-show", "drun", NULL };
static const char *browsercmd[] = { "qutebrowser", NULL };
static const char *filecmd[] = { "kitty", "-T", "ranger", "-e", "ranger", NULL };
static const char *editorcmd[] = { "kitty", "-T", "Editor", "-e", "tmuxinator", "start", "Development", NULL };
static const char *syscmd[] = { "kitty", "-T", "system-monitor", "-e", "htop", NULL };
static const char *notescmd[] = { "kitty", "-T", "capture", "-e", "pytui", "-n", NULL };
static const char *manpagescmd[] = { "kitty", "-T", "capture", "-e", "pytui", "-m", NULL };
static const char *externalMon[] = { "externalmon.py", NULL };
static const char *hyprvirtmon[] = { "hyptvirtmon.py", NULL };
static const Key keys[] = {
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
/* modifier key function argument */
/* Application launching - based on Hyprland config */
{ MODKEY, XKB_KEY_r, spawn, {.v = menucmd} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_Return, spawn, {.v = termcmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termtmuxcmd} },
{ MODKEY, XKB_KEY_b, spawn, {.v = browsercmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, spawn, {.v = filecmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, spawn, {.v = editorcmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_M, spawn, {.v = hyptvirtmon} },
{ MODKEY, XKB_KEY_M, spawn, {.v = syscmd} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_P, spawn, {.v = externalMon} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_n, spawn, {.v = notescmd} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_m, spawn, {.v = manpagescmd} },
/* Original dwl keybindings */
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_h, focusdir, {.ui = 0} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_l, focusdir, {.ui = 1} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_k, focusdir, {.ui = 2} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_j, focusdir, {.ui = 3} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
{ MODKEY, XKB_KEY_bracketleft, incihgaps, {.i = +1 } },
{ MODKEY, XKB_KEY_bracketright, incihgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_bracketleft, incivgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_bracketright, incivgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_bracketleft, incohgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_bracketright, incohgaps, {.i = -1 } },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_braceleft, incovgaps, {.i = +1 } },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_braceright, incovgaps, {.i = -1 } },
{ MODKEY, XKB_KEY_u, setopacity, {.f = +0.1f} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_U, setopacity, {.f = -0.1f} },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_T, setlayout, {.v = &layouts[2]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY, XKB_KEY_o, menu, {.v = &menus[0]} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, menu, {.v = &menus[1]} },
{ MODKEY, XKB_KEY_v, togglefloating, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_y, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
/* Ctrl-Alt-Fx is used to switch to another VT, if you don't know what a VT is
* do not remove them.
*/
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};

View File

@@ -1,6 +1,7 @@
/* /*
* See LICENSE file for copyright and license details. * See LICENSE file for copyright and license details.
*/ */
#include <limits.h>
#include <getopt.h> #include <getopt.h>
#include <libinput.h> #include <libinput.h>
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
@@ -138,6 +139,7 @@ typedef struct {
unsigned int bw; unsigned int bw;
uint32_t tags; uint32_t tags;
int isfloating, isurgent, isfullscreen; int isfloating, isurgent, isfullscreen;
float opacity;
uint32_t resize; /* configure serial of a pending resize */ uint32_t resize; /* configure serial of a pending resize */
} Client; } Client;
@@ -197,6 +199,10 @@ struct Monitor {
struct wlr_box w; /* window area, layout-relative */ struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface.link */ struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2]; const Layout *lt[2];
int gappih; /* horizontal gap between windows */
int gappiv; /* vertical gap between windows */
int gappoh; /* horizontal outer gaps */
int gappov; /* vertical outer gaps */
unsigned int seltags; unsigned int seltags;
unsigned int sellt; unsigned int sellt;
uint32_t tagset[2]; uint32_t tagset[2];
@@ -227,6 +233,7 @@ typedef struct {
const char *title; const char *title;
uint32_t tags; uint32_t tags;
int isfloating; int isfloating;
float opacity;
int monitor; int monitor;
} Rule; } Rule;
@@ -239,6 +246,12 @@ typedef struct {
struct wl_listener destroy; struct wl_listener destroy;
} SessionLock; } SessionLock;
typedef struct {
const char *cmd; /* command to run a menu */
void (*feed)(FILE *f); /* feed input to menu */
void (*action)(char *line); /* do action based on menu output */
} Menu;
/* function declarations */ /* function declarations */
static void applybounds(Client *c, struct wlr_box *bbox); static void applybounds(Client *c, struct wlr_box *bbox);
static void applyrules(Client *c); static void applyrules(Client *c);
@@ -246,6 +259,7 @@ static void arrange(Monitor *m);
static void arrangelayer(Monitor *m, struct wl_list *list, static void arrangelayer(Monitor *m, struct wl_list *list,
struct wlr_box *usable_area, int exclusive); struct wlr_box *usable_area, int exclusive);
static void arrangelayers(Monitor *m); static void arrangelayers(Monitor *m);
static void autostartexec(void);
static void axisnotify(struct wl_listener *listener, void *data); static void axisnotify(struct wl_listener *listener, void *data);
static void buttonpress(struct wl_listener *listener, void *data); static void buttonpress(struct wl_listener *listener, void *data);
static void chvt(const Arg *arg); static void chvt(const Arg *arg);
@@ -271,6 +285,7 @@ static void createpopup(struct wl_listener *listener, void *data);
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void cursorframe(struct wl_listener *listener, void *data); static void cursorframe(struct wl_listener *listener, void *data);
static void cursorwarptohint(void); static void cursorwarptohint(void);
static void defaultgaps(const Arg *arg);
static void destroydecoration(struct wl_listener *listener, void *data); static void destroydecoration(struct wl_listener *listener, void *data);
static void destroydragicon(struct wl_listener *listener, void *data); static void destroydragicon(struct wl_listener *listener, void *data);
static void destroyidleinhibitor(struct wl_listener *listener, void *data); static void destroyidleinhibitor(struct wl_listener *listener, void *data);
@@ -285,11 +300,19 @@ static Monitor *dirtomon(enum wlr_direction dir);
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
static void focusdir(const Arg *arg);
static Client *focustop(Monitor *m); static Client *focustop(Monitor *m);
static void fullscreennotify(struct wl_listener *listener, void *data); static void fullscreennotify(struct wl_listener *listener, void *data);
static void gpureset(struct wl_listener *listener, void *data); static void gpureset(struct wl_listener *listener, void *data);
static void handlesig(int signo); static void handlesig(int signo);
static void incnmaster(const Arg *arg); static void incnmaster(const Arg *arg);
static void incgaps(const Arg *arg);
static void incigaps(const Arg *arg);
static void incihgaps(const Arg *arg);
static void incivgaps(const Arg *arg);
static void incogaps(const Arg *arg);
static void incohgaps(const Arg *arg);
static void incovgaps(const Arg *arg);
static void inputdevice(struct wl_listener *listener, void *data); static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(uint32_t mods, xkb_keysym_t sym); static int keybinding(uint32_t mods, xkb_keysym_t sym);
static void keypress(struct wl_listener *listener, void *data); static void keypress(struct wl_listener *listener, void *data);
@@ -299,6 +322,12 @@ static void killclient(const Arg *arg);
static void locksession(struct wl_listener *listener, void *data); static void locksession(struct wl_listener *listener, void *data);
static void mapnotify(struct wl_listener *listener, void *data); static void mapnotify(struct wl_listener *listener, void *data);
static void maximizenotify(struct wl_listener *listener, void *data); static void maximizenotify(struct wl_listener *listener, void *data);
static void menu(const Arg *arg);
static int menuread(int fd, uint32_t mask, void *data);
static void menuwinfeed(FILE *f);
static void menuwinaction(char *line);
static void menulayoutfeed(FILE *f);
static void menulayoutaction(char *line);
static void monocle(Monitor *m); static void monocle(Monitor *m);
static void motionabsolute(struct wl_listener *listener, void *data); static void motionabsolute(struct wl_listener *listener, void *data);
static void motionnotify(uint32_t time, struct wlr_input_device *device, double sx, static void motionnotify(uint32_t time, struct wlr_input_device *device, double sx,
@@ -319,13 +348,16 @@ static void requeststartdrag(struct wl_listener *listener, void *data);
static void requestmonstate(struct wl_listener *listener, void *data); static void requestmonstate(struct wl_listener *listener, void *data);
static void resize(Client *c, struct wlr_box geo, int interact); static void resize(Client *c, struct wlr_box geo, int interact);
static void run(char *startup_cmd); static void run(char *startup_cmd);
static void scenebuffersetopacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *user_data);
static void setcursor(struct wl_listener *listener, void *data); static void setcursor(struct wl_listener *listener, void *data);
static void setcursorshape(struct wl_listener *listener, void *data); static void setcursorshape(struct wl_listener *listener, void *data);
static void setfloating(Client *c, int floating); static void setfloating(Client *c, int floating);
static void setfullscreen(Client *c, int fullscreen); static void setfullscreen(Client *c, int fullscreen);
static void setgaps(int oh, int ov, int ih, int iv);
static void setlayout(const Arg *arg); static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg); static void setmfact(const Arg *arg);
static void setmon(Client *c, Monitor *m, uint32_t newtags); static void setmon(Client *c, Monitor *m, uint32_t newtags);
static void setopacity(const Arg *arg);
static void setpsel(struct wl_listener *listener, void *data); static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data); static void setsel(struct wl_listener *listener, void *data);
static void setup(void); static void setup(void);
@@ -336,6 +368,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void togglegaps(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unlocksession(struct wl_listener *listener, void *data); static void unlocksession(struct wl_listener *listener, void *data);
@@ -405,6 +438,7 @@ static struct wlr_output_layout *output_layout;
static struct wlr_box sgeom; static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
static int enablegaps = 1; /* enables gaps, used by togglegaps */
/* global event handlers */ /* global event handlers */
static struct wl_listener cursor_axis = {.notify = axisnotify}; static struct wl_listener cursor_axis = {.notify = axisnotify};
@@ -436,6 +470,11 @@ static struct wl_listener request_start_drag = {.notify = requeststartdrag};
static struct wl_listener start_drag = {.notify = startdrag}; static struct wl_listener start_drag = {.notify = startdrag};
static struct wl_listener new_session_lock = {.notify = locksession}; static struct wl_listener new_session_lock = {.notify = locksession};
static const Menu *menu_current;
static int menu_fd;
static pid_t menu_pid;
static struct wl_event_source *menu_source;
#ifdef XWAYLAND #ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data); static void activatex11(struct wl_listener *listener, void *data);
static void associatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data);
@@ -455,6 +494,9 @@ static struct wlr_xwayland *xwayland;
/* attempt to encapsulate suck into one file */ /* attempt to encapsulate suck into one file */
#include "client.h" #include "client.h"
static pid_t *autostart_pids;
static size_t autostart_len;
/* function implementations */ /* function implementations */
void void
applybounds(Client *c, struct wlr_box *bbox) applybounds(Client *c, struct wlr_box *bbox)
@@ -490,6 +532,7 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title)) if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) { && (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->opacity = r->opacity;
newtags |= r->tags; newtags |= r->tags;
i = 0; i = 0;
wl_list_for_each(m, &mons, link) { wl_list_for_each(m, &mons, link) {
@@ -498,6 +541,8 @@ applyrules(Client *c)
} }
} }
} }
if (c->scene_surface)
wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
c->isfloating |= client_is_float_type(c); c->isfloating |= client_is_float_type(c);
setmon(c, mon, newtags); setmon(c, mon, newtags);
@@ -603,6 +648,27 @@ arrangelayers(Monitor *m)
} }
} }
void
autostartexec(void) {
const char *const *p;
size_t i = 0;
/* count entries */
for (p = autostart; *p; autostart_len++, p++)
while (*++p);
autostart_pids = calloc(autostart_len, sizeof(pid_t));
for (p = autostart; *p; i++, p++) {
if ((autostart_pids[i] = fork()) == 0) {
setsid();
execvp(*p, (char *const *)p);
die("dwl: execvp %s:", *p);
}
/* skip arguments */
while (*++p);
}
}
void void
axisnotify(struct wl_listener *listener, void *data) axisnotify(struct wl_listener *listener, void *data)
{ {
@@ -699,12 +765,23 @@ checkidleinhibitor(struct wlr_surface *exclude)
void void
cleanup(void) cleanup(void)
{ {
size_t i;
cleanuplisteners(); cleanuplisteners();
#ifdef XWAYLAND #ifdef XWAYLAND
wlr_xwayland_destroy(xwayland); wlr_xwayland_destroy(xwayland);
xwayland = NULL; xwayland = NULL;
#endif #endif
wl_display_destroy_clients(dpy); wl_display_destroy_clients(dpy);
/* kill child processes */
for (i = 0; i < autostart_len; i++) {
if (0 < autostart_pids[i]) {
kill(autostart_pids[i], SIGTERM);
waitpid(autostart_pids[i], NULL, 0);
}
}
if (child_pid > 0) { if (child_pid > 0) {
kill(-child_pid, SIGTERM); kill(-child_pid, SIGTERM);
waitpid(child_pid, NULL, 0); waitpid(child_pid, NULL, 0);
@@ -880,6 +957,9 @@ commitnotify(struct wl_listener *listener, void *data)
resize(c, c->geom, (c->isfloating && !c->isfullscreen)); resize(c, c->geom, (c->isfloating && !c->isfullscreen));
if (c->scene_surface)
wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
/* mark a pending resize as completed */ /* mark a pending resize as completed */
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
c->resize = 0; c->resize = 0;
@@ -1055,6 +1135,11 @@ createmon(struct wl_listener *listener, void *data)
for (i = 0; i < LENGTH(m->layers); i++) for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]); wl_list_init(&m->layers[i]);
m->gappih = gappih;
m->gappiv = gappiv;
m->gappoh = gappoh;
m->gappov = gappov;
wlr_output_state_init(&state); wlr_output_state_init(&state);
/* Initialize monitor state using configured rules */ /* Initialize monitor state using configured rules */
m->tagset[0] = m->tagset[1] = 1; m->tagset[0] = m->tagset[1] = 1;
@@ -1127,6 +1212,7 @@ createnotify(struct wl_listener *listener, void *data)
c = toplevel->base->data = ecalloc(1, sizeof(*c)); c = toplevel->base->data = ecalloc(1, sizeof(*c));
c->surface.xdg = toplevel->base; c->surface.xdg = toplevel->base;
c->bw = borderpx; c->bw = borderpx;
c->opacity = default_opacity;
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify); LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify); LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
@@ -1237,6 +1323,12 @@ cursorwarptohint(void)
} }
} }
void
defaultgaps(const Arg *arg)
{
setgaps(gappoh, gappov, gappih, gappiv);
}
void void
destroydecoration(struct wl_listener *listener, void *data) destroydecoration(struct wl_listener *listener, void *data)
{ {
@@ -1511,6 +1603,49 @@ focusstack(const Arg *arg)
focusclient(c, 1); focusclient(c, 1);
} }
void
focusdir(const Arg *arg)
{
/* Focus the left, right, up, down client relative to the current focused client on selmon */
Client *c, *sel = focustop(selmon);
if (!sel || sel->isfullscreen)
return;
int dist=INT_MAX;
Client *newsel = NULL;
int newdist=INT_MAX;
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, selmon))
continue; /* skip non visible windows */
if (arg->ui == 0 && sel->geom.x <= c->geom.x) {
/* Client isn't on our left */
continue;
}
if (arg->ui == 1 && sel->geom.x >= c->geom.x) {
/* Client isn't on our right */
continue;
}
if (arg->ui == 2 && sel->geom.y <= c->geom.y) {
/* Client isn't above us */
continue;
}
if (arg->ui == 3 && sel->geom.y >= c->geom.y) {
/* Client isn't below us */
continue;
}
dist=abs(sel->geom.x-c->geom.x)+abs(sel->geom.y-c->geom.y);
if (dist < newdist){
newdist = dist;
newsel=c;
}
}
if (newsel != NULL){
focusclient(newsel, 1);
}
}
/* We probably should change the name of this: it sounds like it /* We probably should change the name of this: it sounds like it
* will focus the topmost client of this mon, when actually will * will focus the topmost client of this mon, when actually will
* only return that client */ * only return that client */
@@ -1560,10 +1695,25 @@ gpureset(struct wl_listener *listener, void *data)
void void
handlesig(int signo) handlesig(int signo)
{ {
if (signo == SIGCHLD) if (signo == SIGCHLD) {
while (waitpid(-1, NULL, WNOHANG) > 0); pid_t pid, *p, *lim;
else if (signo == SIGINT || signo == SIGTERM) while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) {
if (pid == child_pid)
child_pid = -1;
if (!(p = autostart_pids))
continue;
lim = &p[autostart_len];
for (; p < lim; p++) {
if (*p == pid) {
*p = -1;
break;
}
}
}
} else if (signo == SIGINT || signo == SIGTERM) {
quit(NULL); quit(NULL);
}
} }
void void
@@ -1575,6 +1725,83 @@ incnmaster(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
void
incgaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov + arg->i,
selmon->gappih + arg->i,
selmon->gappiv + arg->i
);
}
void
incigaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov,
selmon->gappih + arg->i,
selmon->gappiv + arg->i
);
}
void
incihgaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov,
selmon->gappih + arg->i,
selmon->gappiv
);
}
void
incivgaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov,
selmon->gappih,
selmon->gappiv + arg->i
);
}
void
incogaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov + arg->i,
selmon->gappih,
selmon->gappiv
);
}
void
incohgaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov,
selmon->gappih,
selmon->gappiv
);
}
void
incovgaps(const Arg *arg)
{
setgaps(
selmon->gappoh,
selmon->gappov + arg->i,
selmon->gappih,
selmon->gappiv
);
}
void void
inputdevice(struct wl_listener *listener, void *data) inputdevice(struct wl_listener *listener, void *data)
{ {
@@ -1819,6 +2046,145 @@ maximizenotify(struct wl_listener *listener, void *data)
wlr_xdg_surface_schedule_configure(c->surface.xdg); wlr_xdg_surface_schedule_configure(c->surface.xdg);
} }
void
menu(const Arg *arg)
{
FILE *f;
int fd_right[2], fd_left[2];
if (menu_current != NULL) {
wl_event_source_remove(menu_source);
close(menu_fd);
kill(menu_pid, SIGTERM);
menu_current = NULL;
if (!arg->v)
return;
}
if (pipe(fd_right) == -1 || pipe(fd_left) == -1)
return;
if ((menu_pid = fork()) == -1)
return;
if (menu_pid == 0) {
close(fd_right[1]);
close(fd_left[0]);
dup2(fd_right[0], STDIN_FILENO);
close(fd_right[0]);
dup2(fd_left[1], STDOUT_FILENO);
close(fd_left[1]);
execl("/bin/sh", "/bin/sh", "-c", ((Menu *)(arg->v))->cmd, NULL);
die("dwl: execl %s failed:", "/bin/sh");
}
close(fd_right[0]);
close(fd_left[1]);
menu_fd = fd_left[0];
if (fd_set_nonblock(menu_fd) == -1)
return;
if (!(f = fdopen(fd_right[1], "w")))
return;
menu_current = arg->v;
menu_current->feed(f);
fclose(f);
menu_source = wl_event_loop_add_fd(event_loop,
menu_fd, WL_EVENT_READABLE, menuread, NULL);
}
int
menuread(int fd, uint32_t mask, void *data)
{
char *s;
int n;
static char line[512];
static int i = 0;
if (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) {
i = 0;
menu(&(const Arg){ .v = NULL });
return 0;
}
if ((n = read(menu_fd, line + i, LENGTH(line) - 1 - i)) == -1) {
if (errno != EAGAIN) {
i = 0;
menu(&(const Arg){ .v = NULL });
}
return 0;
}
line[i + n] = '\0';
if (!(s = strchr(line + i, '\n'))) {
i += n;
return 0;
}
i = 0;
*s = '\0';
menu_current->action(line);
return 0;
}
void
menuwinfeed(FILE *f)
{
Client *c;
const char *title, *appid;
wl_list_for_each(c, &fstack, flink) {
if (!(title = client_get_title(c)))
continue;
fprintf(f, "%s", title);
if ((appid = client_get_appid(c)))
fprintf(f, " | %s", appid);
fputc('\n', f);
}
}
void
menuwinaction(char *line)
{
Client *c;
const char *appid, *title;
static char buf[512];
wl_list_for_each(c, &fstack, flink) {
if (!(title = client_get_title(c)))
continue;
appid = client_get_appid(c);
snprintf(buf, LENGTH(buf) - 1, "%s%s%s",
title, appid ? " | " : "", appid ? appid : "");
if (strcmp(line, buf) == 0)
goto found;
}
return;
found:
if (!c->mon)
return;
wl_list_remove(&c->flink);
wl_list_insert(&fstack, &c->flink);
selmon = c->mon;
view(&(const Arg){ .ui = c->tags });
}
void
menulayoutfeed(FILE *f)
{
const Layout *l;
for (l = layouts; l < END(layouts); l++)
fprintf(f, "%s\n", l->symbol);
}
void
menulayoutaction(char *line)
{
const Layout *l;
for (l = layouts; l < END(layouts); l++)
if (strcmp(line, l->symbol) == 0)
goto found;
return;
found:
setlayout(&(const Arg){ .v = l });
}
void void
monocle(Monitor *m) monocle(Monitor *m)
{ {
@@ -1828,8 +2194,12 @@ monocle(Monitor *m)
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue; continue;
resize(c, m->w, 0);
n++; n++;
if (!monoclegaps)
resize(c, m->w, 0);
else
resize(c, (struct wlr_box){.x = m->w.x + gappoh, .y = m->w.y + gappov,
.width = m->w.width - 2 * gappoh, .height = m->w.height - 2 * gappov}, 0);
} }
if (n) if (n)
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n);
@@ -2249,6 +2619,7 @@ run(char *startup_cmd)
die("startup: backend_start"); die("startup: backend_start");
/* Now that the socket exists and the backend is started, run the startup command */ /* Now that the socket exists and the backend is started, run the startup command */
autostartexec();
if (startup_cmd) { if (startup_cmd) {
int piperw[2]; int piperw[2];
if (pipe(piperw) < 0) if (pipe(piperw) < 0)
@@ -2295,6 +2666,15 @@ run(char *startup_cmd)
wl_display_run(dpy); wl_display_run(dpy);
} }
void
scenebuffersetopacity(struct wlr_scene_buffer *buffer, int sx, int sy, void *data)
{
Client *c = data;
/* xdg-popups are children of Client.scene, we do not have to worry about
messing with them. */
wlr_scene_buffer_set_opacity(buffer, c->isfullscreen ? 1 : c->opacity);
}
void void
setcursor(struct wl_listener *listener, void *data) setcursor(struct wl_listener *listener, void *data)
{ {
@@ -2363,10 +2743,21 @@ setfullscreen(Client *c, int fullscreen)
* client positions are set by the user and cannot be recalculated */ * client positions are set by the user and cannot be recalculated */
resize(c, c->prev, 0); resize(c, c->prev, 0);
} }
wlr_scene_node_for_each_buffer(&c->scene_surface->node, scenebuffersetopacity, c);
arrange(c->mon); arrange(c->mon);
printstatus(); printstatus();
} }
void
setgaps(int oh, int ov, int ih, int iv)
{
selmon->gappoh = MAX(oh, 0);
selmon->gappov = MAX(ov, 0);
selmon->gappih = MAX(ih, 0);
selmon->gappiv = MAX(iv, 0);
arrange(selmon);
}
void void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
@@ -2419,6 +2810,23 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
focusclient(focustop(selmon), 1); focusclient(focustop(selmon), 1);
} }
void
setopacity(const Arg *arg)
{
Client *sel = focustop(selmon);
if (!sel)
return;
sel->opacity += arg->f;
if (sel->opacity > 1.0)
sel->opacity = 1.0f;
if (sel->opacity < 0.1)
sel->opacity = 0.1f;
wlr_scene_node_for_each_buffer(&sel->scene_surface->node, scenebuffersetopacity, sel);
}
void void
setpsel(struct wl_listener *listener, void *data) setpsel(struct wl_listener *listener, void *data)
{ {
@@ -2711,7 +3119,7 @@ tagmon(const Arg *arg)
void void
tile(Monitor *m) tile(Monitor *m)
{ {
unsigned int mw, my, ty; unsigned int mw, my, ty, h, r, oe = enablegaps, ie = enablegaps;
int i, n = 0; int i, n = 0;
Client *c; Client *c;
@@ -2721,22 +3129,31 @@ tile(Monitor *m)
if (n == 0) if (n == 0)
return; return;
if (smartgaps == n) {
oe = 0; // outer gaps disabled
}
if (n > m->nmaster) if (n > m->nmaster)
mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0; mw = m->nmaster ? (int)roundf((m->w.width + m->gappiv*ie) * m->mfact) : 0;
else else
mw = m->w.width; mw = m->w.width - 2*m->gappov*oe + m->gappiv*ie;
i = my = ty = 0; i = 0;
my = ty = m->gappoh*oe;
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue; continue;
if (i < m->nmaster) { if (i < m->nmaster) {
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw, r = MIN(n, m->nmaster) - i;
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0); h = (m->w.height - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
my += c->geom.height; resize(c, (struct wlr_box){.x = m->w.x + m->gappov*oe, .y = m->w.y + my,
.width = mw - m->gappiv*ie, .height = h}, 0);
my += c->geom.height + m->gappih*ie;
} else { } else {
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty, r = n - i;
.width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0); h = (m->w.height - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
ty += c->geom.height; resize(c, (struct wlr_box){.x = m->w.x + mw + m->gappov*oe, .y = m->w.y + ty,
.width = m->w.width - mw - 2*m->gappov*oe, .height = h}, 0);
ty += c->geom.height + m->gappih*ie;
} }
i++; i++;
} }
@@ -2759,6 +3176,13 @@ togglefullscreen(const Arg *arg)
setfullscreen(sel, !sel->isfullscreen); setfullscreen(sel, !sel->isfullscreen);
} }
void
togglegaps(const Arg *arg)
{
enablegaps = !enablegaps;
arrange(selmon);
}
void void
toggletag(const Arg *arg) toggletag(const Arg *arg)
{ {
@@ -3130,6 +3554,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
c->surface.xwayland = xsurface; c->surface.xwayland = xsurface;
c->type = X11; c->type = X11;
c->bw = client_is_unmanaged(c) ? 0 : borderpx; c->bw = client_is_unmanaged(c) ? 0 : borderpx;
c->opacity = default_opacity;
/* Listen to the various events it can emit */ /* Listen to the various events it can emit */
LISTEN(&xsurface->events.associate, &c->associate, associatex11); LISTEN(&xsurface->events.associate, &c->associate, associatex11);

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
{ {
services = { services = {
glances = { glances = {
enable = true; enable = false;
port = 61208; port = 61208;
extraArgs = [ "--webserver" ]; extraArgs = [ "--webserver" ];
}; };

View File

@@ -16,8 +16,56 @@
"d /mnt/roms_ext 0755 root root -" "d /mnt/roms_ext 0755 root root -"
"d /mnt/tv 0755 root root -" "d /mnt/tv 0755 root root -"
"d /mnt/tv_ext 0755 root root -" "d /mnt/tv_ext 0755 root root -"
"d /mnt/retropi_roms 0755 root root -"
"d /mnt/retropi_bios 0755 root root -"
"d /mnt/retropi_configs 0755 root root -"
]; ];
fileSystems."/mnt/retropi_roms" = {
device = "//retropi/roms";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/retropi_bios" = {
device = "//retropi/bios";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/retropi_configs" = {
device = "//retropi/configs";
fsType = "cifs";
options = [
"credentials=/run/secrets/smb"
"vers=3.0"
"uid=1000" "gid=1000"
"file_mode=0664" "dir_mode=0775"
"rw" "iocharset=utf8" "cache=strict" "mfsymlinks"
"_netdev" "nofail"
"x-systemd.automount" "noauto"
"x-systemd.idle-timeout=10min"
];
};
fileSystems."/mnt/books" = { fileSystems."/mnt/books" = {
device = "//10.0.0.76/Books"; device = "//10.0.0.76/Books";
fsType = "cifs"; fsType = "cifs";