Как стать автором
Обновить

Artix Linux + DWM — моя кастомизация

Время на прочтение6 мин
Количество просмотров5.1K

Я пользуюсь Linux'ом уже больше полтора года. Начинал я с Linux Mint, а сейчас у меня стоит Artix Linux.

Почему Artix Linux?

Artix — Arch Linux, но без systemd.

Я не называю себя тру‑линуксоидом, но все‑таки выбрал Artix Linux с системой инициализации dinit. Почему? Все просто — мне не нравится, какой большой стал systemd. Но почему dinit? Во‑первых: посоветовали именно его, во‑вторых: поддерживается и регулярно выпускаются обновление, в‑третьих: он прост и минималистичен.

Кастомизация DWM

Я использую патчи:

  • dwm‑noborder (убирает рамки у окон, когда запущено только одно окно)

  • dwm‑quit (при выходе из dwm спрашивает, точно ли выйти, и надо ли перезагрузить)

  • dwm‑pertag (отображает все окна в статусбаре)

  • dwm‑fibonacci (добавляет две разметки окон при помощи чисел Фибоначчи)

Для статусбара я использую slstatus, а терминал — alacritty.

Мой конфиг dwm:

/* See LICENSE file for copyright and license details. */
#include "fibonacci.c"

/* appearance */
static const unsigned int borderpx  = 2;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const int showbar            = 1;        /* 0 means no bar */
static const int topbar             = 1;        /* 0 means bottom bar */
// static const char *fonts[]          = { "JetBrains Mono:size=12" };
// static const char dmenufont[]       = "JetBrains Mono:size=12";
// static const char *fonts[]          = { "Terminus:style=Bold:size=13" };
// static const char dmenufont[]       = "Terminus:style=Bold:size=13";
static const char *fonts[]          = { "Iosevka NF:size=12", "FontAwesome:size=12" };
static const char dmenufont[]       = "Iosevka NF:size=12";
static const char col_gray1[]       = "#282828";
static const char col_gray2[]       = "#282828";
static const char col_gray3[]       = "#cccccc";
static const char col_gray4[]       = "#ebdbb2";
// static const char col_cyan[]        = "#d3869b";
static const char col_cyan[]        = "#679267";

/* gruvbox */
// static const char dark0_hard[]  = "#d3869b";
static const char dark0_hard[] = "#679267";
static const char dark0_soft[]  = "#151516";
static const char dark1[]       = "#282828";     

static const char light1[] = "#ebdbb2";
static const char light2[] = "#d5c4a1";
static const char light3[] = "#bdae93";
static const char light4[] = "#cccccc";
static const char fg4[]    = "#151516";
static const char fg5[]    = "#202020";

static const char grey[]          = "#C0C0C0";
static const char red[]           = "#fb4934";     
static const char green[]         = "#b8bb26"; 
static const char yellow[]        = "#fabd2f";     
static const char blue[]          = "#83a598";     
static const char purple[]        = "#d3869b";     
static const char aqua[]          = "#8ec07c";
static const char rugreen[]       = "#679267";
static const char orange[]        = "#d65d0e";    

static const char *colors[][3]      = {
	/*               fg         bg         border   */
	[SchemeNorm] = { light1, dark0_soft, dark1      },
	[SchemeSel]  = { fg4, dark0_hard, rugreen          },
};

/* tagging */
static const char *tags[] = { " ", " ", " ", " ", " ", };

// static const char *tags[] = { "1", "2", "3", "4", "5" };

static const Rule rules[] = {
	/* xprop(1):
	 *	WM_CLASS(STRING) = instance, class
	 *	WM_NAME(STRING) = title
	 */
	/* class      instance    title       tags mask     isfloating   monitor */
	{ "QEMU",     NULL,       NULL,       0,            1,           -1 },
	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
	{ "Qemu",	  NULL,		  NULL, 	  0, 			1, 			 -1 }
};

/* layout(s) */
static const float mfact     = 0.5; /* factor of master area size [0.05..0.95] */
static const int nmaster     = 1;    /* number of clients in master area */
static const int resizehints = 0;    /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */

static const Layout layouts[] = {
	/* symbol     arrange function */
	//  ┇
	{ "┇   ┇", 	 spiral  }, 
	{ "┇   ┇",      tile },    /* first entry is default */
	{ "┇ ?  ┇",      NULL },    /* no layout function means floating behavior */
	{ "┇ ?  ┇",      monocle },
	{ "┇   ┇",  	 dwindle }
};

/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/bash", "-c", cmd, NULL } }

#include <X11/XF86keysym.h>
#define XF86XK_AudioLowerVolume	0x1008FF11   /* Volume control down        */
#define XF86XK_AudioMute	0x1008FF12   /* Mute sound from the system */
#define XF86XK_AudioRaiseVolume	0x1008FF13   /* Volume control up */

/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
// static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, NULL };
// static const char *termcmd[]  = { "st", "-n", "spterm", "-g", "120x34", NULL };
static const char *termcmd[] = { "alacritty", NULL };
static const char *screenshot[] = { "scrot", "-F", "/home/okulus/img/screenshot_%H:%M:%S.png", NULL };

static const Key keys[] = {
	/* modifier                     key        function        argument */
	{ MODKEY,                       XK_d,      spawn,          {.v = dmenucmd } },
	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
	{ MODKEY,                       XK_b,      togglebar,      {0} },
	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
	{ MODKEY,                       XK_p,      incnmaster,     {.i = -1 } },
	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
	{ MODKEY,                       XK_Return, zoom,           {0} },
	{ MODKEY,                       XK_Tab,    view,           {0} },
	{ MODKEY,                       XK_q,      killclient,     {0} },
	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
	{ MODKEY,                       XK_space,  setlayout,      {0} },
	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
	{ 0,                            XF86XK_AudioMute,     spawn,                 SHCMD("pactl set-sink-mute 0 toggle && dunstvol") },
	{ 0,                            XF86XK_AudioLowerVolume,     spawn,          SHCMD("pactl set-sink-volume 0 -3% && dunstvol") },
	{ 0,                            XF86XK_AudioRaiseVolume,     spawn,          SHCMD("pactl set-sink-volume 0 +3% && dunstvol") },
    { 0,                            XK_Print,  spawn,          {.v = screenshot} },
	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
	TAGKEYS(                        XK_1,                      0)
	TAGKEYS(                        XK_2,                      1)
	TAGKEYS(                        XK_3,                      2)
	TAGKEYS(                        XK_4,                      3)
	TAGKEYS(                        XK_5,                      4)
	TAGKEYS(                        XK_6,                      5)
	TAGKEYS(                        XK_7,                      6)
	TAGKEYS(                        XK_8,                      7)
	TAGKEYS(                        XK_9,                      8)
	{ MODKEY|ShiftMask, XK_q, quitprompt, {0} },
};

/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static const Button buttons[] = {
	/* click                event mask      button          function        argument */
	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
	{ ClkTagBar,            0,              Button1,        view,           {0} },
	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
};

Мой конфиг slstatus:

/* See LICENSE file for copyright and license details. */

/* interval between updates (in ms) */
const unsigned int interval = 1000;

/* text to show if no value can be retrieved */
static const char unknown_str[] = "n/a";

/* maximum output string length */
#define MAXLEN 2048

/*
 * function            description                     argument (example)
 *
 * battery_perc        battery percentage              battery name (BAT0)
 *                                                     NULL on OpenBSD/FreeBSD
 * battery_remaining   battery remaining HH:MM         battery name (BAT0)
 *                                                     NULL on OpenBSD/FreeBSD
 * battery_state       battery charging state          battery name (BAT0)
 *                                                     NULL on OpenBSD/FreeBSD
 * cat                 read arbitrary file             path
 * cpu_freq            cpu frequency in MHz            NULL
 * cpu_perc            cpu usage in percent            NULL
 * datetime            date and time                   format string (%F %T)
 * disk_free           free disk space in GB           mountpoint path (/)
 * disk_perc           disk usage in percent           mountpoint path (/)
 * disk_total          total disk space in GB          mountpoint path (/)
 * disk_used           used disk space in GB           mountpoint path (/)
 * entropy             available entropy               NULL
 * gid                 GID of current user             NULL
 * hostname            hostname                        NULL
 * ipv4                IPv4 address                    interface name (eth0)
 * ipv6                IPv6 address                    interface name (eth0)
 * kernel_release      `uname -r`                      NULL
 * keyboard_indicators caps/num lock indicators        format string (c?n?)
 *                                                     see keyboard_indicators.c
 * keymap              layout (variant) of current     NULL
 *                     keymap
 * load_avg            load average                    NULL
 * netspeed_rx         receive network speed           interface name (wlan0)
 * netspeed_tx         transfer network speed          interface name (wlan0)
 * num_files           number of files in a directory  path
 *                                                     (/home/foo/Inbox/cur)
 * ram_free            free memory in GB               NULL
 * ram_perc            memory usage in percent         NULL
 * ram_total           total memory size in GB         NULL
 * ram_used            used memory in GB               NULL
 * run_command         custom shell command            command (echo foo)
 * swap_free           free swap in GB                 NULL
 * swap_perc           swap usage in percent           NULL
 * swap_total          total swap size in GB           NULL
 * swap_used           used swap in GB                 NULL
 * temp                temperature in degree celsius   sensor file
 *                                                     (/sys/class/thermal/...)
 *                                                     NULL on OpenBSD
 *                                                     thermal zone on FreeBSD
 *                                                     (tz0, tz1, etc.)
 * uid                 UID of current user             NULL
 * uptime              system uptime                   NULL
 * username            username of current user        NULL
 * vol_perc            OSS/ALSA volume in percent      mixer file (/dev/mixer)
 *                                                     NULL on OpenBSD/FreeBSD
 * wifi_essid          WiFi ESSID                      interface name (wlan0)
 * wifi_perc           WiFi signal in percent          interface name (wlan0)
 */
static const struct arg args[] = {
	/* function format          argument */
	{ battery_perc, "   %s%%", "BAT0"        },
	{ battery_state, "%s  ", "BAT0"           },
	{ cpu_perc, "  %s%%  ", NULL           },
	{ ram_used, "  %s  ", NULL             },
	{ keymap, "  %s  ", NULL              },
	{ datetime, "? %s",           "%T"           },
};

Галерея

Теги:
Хабы:
Всего голосов 9: ↑5 и ↓4+2
Комментарии29

Публикации

Истории

Ближайшие события

AdIndex City Conference 2024
Дата26 июня
Время09:30
Место
Москва
Summer Merge
Дата28 – 30 июня
Время11:00
Место
Ульяновская область