Initial commit

This commit is contained in:
Alexey 2025-01-21 12:05:54 +03:00
commit 4d53c2cb0d
5 changed files with 1021 additions and 0 deletions

53
alacritty/alacritty.toml Normal file
View file

@ -0,0 +1,53 @@
[general]
import = []
live_config_reload = true
[window]
opacity = 0.7
[font]
normal = { family = "Source Code Pro", style = "Regular" }
size = 11
[colors]
draw_bold_text_with_bright_colors = true
[colors.primary]
foreground = "#ffffff"
dim_foreground = "#f0dada"
bright_foreground = "#ffffff"
background = "#2c3746"
[colors.normal]
black = "#176ef1"
red = "#fd3762"
green = "#2aacaa"
yellow = "#f7c067"
blue = "#f77067"
magenta = "#cb75f7"
cyan = "#5cc6d1"
white = "#9cacad"
[colors.bright]
black = "#1874ff"
red = "#ff4772"
green = "#2ebdbb"
yellow = "#ffc66a"
blue = "#ff7c77"
magenta = "#ce79ff"
cyan = "#60ccd8"
white = "#aabcbd"
[colors.dim]
black = "#156bdc"
red = "#f22c57"
green = "#28a09c"
yellow = "#ddab5c"
blue = "#df635d"
magenta = "#af69dd"
cyan = "#4fb0b3"
white = "#879596"
[cursor.style]
shape = "Underline"
blinking = "On"

1
mpd/mpd.conf Symbolic link
View file

@ -0,0 +1 @@
/home/secondbeam/.mpd/mpd.conf

458
river/init Executable file
View file

@ -0,0 +1,458 @@
#!/usr/bin/lua5.4
--[[
NOTE:
- execp() needs 'lua-posix' package
- bitwise operands for tag mappings need Lua version >= 5.3
--]]
-- Convenient functions ────────────────────────────────────────────────────────
-- Wrapper around table.concat() to also handle other types
local function concat(...)
local list, sep, i, j = ...
if type(list) == 'table' then
return table.concat(list, sep, i, j)
else
return tostring(list)
end
end
-- All the setting tables ──────────────────────────────────────────────────────
local wallpapers = {
primary = '~/Pictures/wallpaper/1772658.jpg',
secondary = '~/Pictures/wallpaper/83D9B0BF750C2763F9126AAAEF23F3DB3D3A6328-3688606028.png'
}
local monitors = {
main = 'eDP-2',
external = 'HDMI-A-1'
}
local startup_commands = {
-- Inform dbus about the environment variables
{
'dbus-update-activation-environment',
'DISPLAY',
'WAYLAND_DISPLAY',
'XDG_SESSION_TYPE',
'XDG_CURRENT_DESKTOP',
},
{
'waybar'
},
{
string.format("swaybg -o %s -i %s -o %s -i %s",
monitors.main, wallpapers.primary,
monitors.external, wallpapers.secondary)
}
-- Startup programs
--{
-- 'swayidle',
-- 'timeout 300 "swaylock"',
--},
}
local outputs = {
[monitors.main] = {
mode = '1920x1080',
pos = '0,0',
transform = 'normal',
scale = '1.000000',
preferred = true,
},
[monitors.external] = {
mode = '1920x1080',
pos = '-1920,0',
transform = 'normal',
scale = '1.000000',
preferred = true,
},
}
local inputs = {
['pointer-10248-514-ASUF1204:00_2808:0202_Touchpad'] = {
['drag'] = 'enabled',
['tap'] = 'enabled',
['tap-button-map'] = 'left-right-middle',
['disable-while-typing'] = 'enabled',
['scroll-method'] = 'two-finger',
['accel-profile'] = 'none',
},
['pointer-9639-64124-Compx_2.4G_Wireless_Receiver'] = {
['accel-profile'] = 'none',
}
}
local river_options = {
-- Theme options
['border-width'] = 2,
['border-color-focused'] = '0xeceff4',
['border-color-unfocused'] = '0x81a1c1',
['border-color-urgent'] = '0xbf616a',
['xcursor-theme'] = { 'Bibata-Modern-Ice', 24 },
['background-color'] = '0x2e3440',
-- Other options
['set-repeat'] = { 25, 300 },
['focus-follows-cursor'] = 'normal',
['set-cursor-warp'] = 'on-output-change',
['attach-mode'] = 'bottom',
['default-layout'] = 'rivertile',
['keyboard-layout'] = { '-options', 'grp:alt_shift_toggle', 'us,ru' }
}
local gsettings = {
['org.gnome.desktop.interface'] = {
['gtk-theme'] = 'Nordic',
['icon-theme'] = 'Papirus-Dark',
['cursor-theme'] = river_options['xcursor-theme'][1],
['cursor-size'] = river_options['xcursor-theme'][2],
},
}
local window_rules = {
['float-filter-add'] = {
['app-id'] = {
'float',
'popup',
'swappy',
'pinentry-qt',
'pavucontrol-qt',
},
['title'] = {
'Picture-in-Picture',
-- 'About *',
},
},
['csd-filter-add'] = {
['app-id'] = { 'swappy' },
},
}
-- Additional modes and their mappings to switch between them and 'normal' mode
--
-- name: string (the name of the additional mode)
-- mod: string|list (modifiers for key binding, concanated by '+')
-- key: string
local modes = {
{
name = 'passthrough',
mod = 'Super',
key = 'F11',
},
}
-- Each mapping contains 4 keys:
--
-- mod: string|list (modifiers, concanated by '+')
-- key: string
-- command: string|list (the command passed to riverctl)
-- opt: string ('release' or 'repeat')
local mappings = {
-- Key bindings
map = {
normal = {
{
mod = { 'Super', 'Shift' },
key = 'T',
command = { 'spawn', 'alacritty' },
},
{
mod = { 'Shift', 'Control' },
key = 'Escape',
command = { 'spawn', [['wofi --show drun']] }
},
{
mod = { 'Super', 'Shift' },
key = 'S',
command = { 'spawn', [['slurp | grim -g - - | wl-copy']] }
},
{
mod = { 'Super' },
key = 'O',
command = { 'spawn', [['waylock -init-color 0x352e2c -input-color 0x575e7a -fail-color 0x833b18']] }
},
-- Super+Q to close the focused view
{
mod = 'Alt',
key = 'F4',
command = 'close',
},
-- Super+Shift+Q to exit river
{
mod = { 'Super', 'Shift' },
key = 'Q',
command = 'exit',
},
-- Super+Shift+X to lock the screen
{
mod = { 'Super', 'Shift' },
key = 'X',
command = { 'spawn', 'swaylock' },
},
-- Super+{J,K} to focus next/previous view in the layout stack
{
mod = 'Super',
key = 'J',
command = { 'focus-view', 'previous' },
},
{
mod = 'Super',
key = 'K',
command = { 'focus-view', 'next' },
},
-- Super+Shift+{J,K} to swap focused view with the next/previous view in the layout stack
{
mod = { 'Super', 'Shift' },
key = 'J',
command = { 'swap', 'previous' },
},
{
mod = { 'Super', 'Shift' },
key = 'K',
command = { 'swap', 'next' },
},
-- Super+{P,N} to focus next/previous output
{
mod = 'Super',
key = 'P',
command = { 'focus-output', 'previous' },
},
{
mod = 'Super',
key = 'N',
command = { 'focus-output', 'next' },
},
-- Super+Shift+{P,N} to send the focused view to next/previous output
{
mod = { 'Super', 'Shift' },
key = 'P',
command = { 'send-to-output', 'previous' },
},
{
mod = { 'Super', 'Shift' },
key = 'N',
command = { 'send-to-output', 'next' },
},
-- Super+E to bump the focused view to the top of the layout stack
{
mod = 'Super',
key = 'E',
command = 'zoom',
},
-- Super+{H,L} to decrease/increase the main_factor value of rivertile by 0.02
{
mod = 'Super',
key = 'H',
command = { 'send-layout-cmd', 'rivertile', [['main-ratio -0.02']] },
},
{
mod = 'Super',
key = 'L',
command = { 'send-layout-cmd', 'rivertile', [['main-ratio +0.02']] },
},
-- Super+Shift+{H,L} to increment/decrement the main_count value of rivertile
{
mod = { 'Super', 'Shift' },
key = 'H',
command = { 'send-layout-cmd', 'rivertile', [['main-count +1']] },
},
{
mod = { 'Super', 'Shift' },
key = 'L',
command = { 'send-layout-cmd', 'rivertile', [['main-count -1']] },
},
-- Control+Alt+{H,J,K,L} to change layout orientation
{
mod = { 'Control', 'Alt' },
key = 'H',
command = { 'send-layout-cmd', 'rivertile', [['main-location left']] },
},
{
mod = { 'Control', 'Alt' },
key = 'J',
command = { 'send-layout-cmd', 'rivertile', [['main-location bottom']] },
},
{
mod = { 'Control', 'Alt' },
key = 'K',
command = { 'send-layout-cmd', 'rivertile', [['main-location top']] },
},
{
mod = { 'Control', 'Alt' },
key = 'L',
command = { 'send-layout-cmd', 'rivertile', [['main-location right']] },
},
-- Super+Space to toggle float
{
mod = 'Super',
key = 'Space',
command = 'toggle-float',
},
-- Super+F to toggle fullscreen
{
mod = 'Super',
key = 'F',
command = 'toggle-fullscreen',
},
},
},
-- Mappings for pointer (mouse)
['map-pointer'] = {
normal = {
-- Super + Left Mouse Button to move views
{
mod = 'Super',
key = 'BTN_LEFT',
command = 'move-view',
},
-- Super + Right Mouse Button to resize views
{
mod = 'Super',
key = 'BTN_RIGHT',
command = 'resize-view',
},
},
},
}
-- These mappings are repeated, so they are separated from the mappings table
local function tag_mappings()
for i = 1, 9 do
local tag_num = 1 << (i - 1)
-- Super+[1-9] to focus tag [0-8]
os.execute(string.format('riverctl map normal Super %s set-focused-tags %s', i, tag_num))
-- Super+Shift+[1-9] to tag focused view with tag [0-8]
os.execute(string.format('riverctl map normal Super+Shift %s set-view-tags %s', i, tag_num))
-- Super+Control+[1-9] to toggle focus of tag [0-8]
os.execute(string.format('riverctl map normal Super+Control %s toggle-focused-tags %s', i, tag_num))
-- Super+Alt+[1-9] to toggle tag [0-8] of focused view
os.execute(string.format('riverctl map normal Super+Alt %s toggle-view-tags %s', i, tag_num))
end
-- river has a total of 32 tags
local all_tags = (1 << 32) - 1
os.execute(string.format('riverctl map normal Super 0 set-focused-tags %s', all_tags))
os.execute(string.format('riverctl map normal Super+Shift 0 set-view-tags %s', all_tags))
end
-- Apply settings ──────────────────────────────────────────────────────────────
-- Run startup commands
--
-- 'riverctl spawn ...' always returns (even when the child process is a daemon)
-- so we don't need to resort to posix.unistd.spawn()
for _, cmd in ipairs(startup_commands) do
os.execute(string.format([[riverctl spawn '%s']], concat(cmd, ' ')))
end
-- Configure outputs
local randr_cmd = 'wlr-randr'
for output, options in pairs(outputs) do
randr_cmd = randr_cmd .. ' --output ' .. output
for opt, value in pairs(options) do
if opt ~= 'preferred' then
randr_cmd = string.format(randr_cmd .. ' --%s %s', opt, value)
end
end
-- Ensure '--preferred' is the last argument for each monitor
if options.preferred then
randr_cmd = randr_cmd .. ' --preferred'
end
end
os.execute(randr_cmd)
os.execute(string.format("echo %s > ~/.config/river/wlr-randr", randr_cmd))
-- Configure input devices
for device, options in pairs(inputs) do
for key, val in pairs(options) do
os.execute(string.format('riverctl input %s %s %s', device, key, val))
end
end
-- GNOME-related settings
for group, tbl in pairs(gsettings) do
for key, value in pairs(tbl) do
os.execute(string.format('gsettings set %s %s %s', group, key, value))
end
end
-- Set river's options
for key, value in pairs(river_options) do
os.execute(string.format('riverctl %s %s', key, concat(value, ' ')))
end
-- Additional modes (beside 'normal' and 'locked')
for _, mode in ipairs(modes) do
local mode_name = mode.name
local modifiers = concat(mode.mod, '+')
-- Declare the mode
os.execute('riverctl declare-mode ' .. mode_name)
-- Setup key bindings to enter/exit the mode
os.execute(string.format('riverctl map normal %s %s enter-mode %s', modifiers, mode.key, mode_name))
os.execute(string.format('riverctl map %s %s %s enter-mode normal', mode_name, modifiers, mode.key))
end
-- Keyboard and mouse bindings
for map_type, tbl in pairs(mappings) do
for mode, value in pairs(tbl) do
for _, binding in ipairs(value) do
local modifiers = concat(binding.mod, '+')
local cmd = concat(binding.command, ' ')
-- Options -release and -repeat for 'map' and 'unmap' commands
local opt = binding.opt
if opt ~= 'release' and opt ~= 'repeat' then
opt = ''
else
opt = '-' .. opt
end
os.execute(string.format('riverctl %s -layout 0 %s %s %s %s %s', map_type, opt, mode, modifiers, binding.key, cmd))
-- Duplicate mappings of mode 'locked' for mode 'normal'
if mode == 'locked' then
os.execute(string.format('riverctl %s -layout 0 %s normal %s %s %s', map_type, opt, modifiers, binding.key, cmd))
end
end
end
end
-- Mappings for tag management
tag_mappings()
-- Window rules (float/csd filters)
for key, value in pairs(window_rules) do
for type, patterns in pairs(value) do
for _, pattern in ipairs(patterns) do
os.execute(string.format('riverctl %s %s %s', key, type, pattern))
end
end
end
-- Launch the layout generator as the final initial process.
--
-- River run the init file as a process group leader and send
-- SIGTERM to the group on exit. Therefore, keep the main init
-- process running (replace it with the layout generator process).
local unistd = require('posix.unistd')
unistd.execp('rivertile', {
'-view-padding', 5,
'-outer-padding', 5,
'-main-location', 'left',
'-main-count', 1,
'-main-ratio', 0.7,
})

174
waybar/config.jsonc Normal file
View file

@ -0,0 +1,174 @@
[{
"output": "HDMI-A-1",
"layer": "top",
"position": "top",
"height": 30,
"spacing": 4,
"modules-left": [
"river/tags"
],
"modules-center": [
"river/window"
],
"modules-right": [
"mpd",
"clock"
],
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 5,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)",
"on-click": "mpc toggle"
},
"clock": {
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
}
},
{
"output": "eDP-2",
"layer": "top",
"position": "top",
"height": 30,
"spacing": 4,
"modules-left": [
"river/tags"
],
"modules-center": [
"river/window"
],
"modules-right": [
"mpd",
"pulseaudio",
"network",
"power-profiles-daemon",
"cpu",
"memory",
"temperature",
"backlight",
"battery",
"clock",
"tray"
],
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 5,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)",
"on-click": "mpc toggle"
},
"tray": {
"spacing": 10
},
"clock": {
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
"critical-threshold": 80,
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""]
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-full": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
"format-icons": ["", "", "", "", ""]
},
"power-profiles-daemon": {
"format": "{icon}",
"tooltip-format": "Power profile: {profile}\nDriver: {driver}",
"tooltip": true,
"format-icons": {
"default": "",
"performance": "",
"balanced": "",
"power-saver": ""
}
},
"network": {
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ipaddr}/{cidr} ",
"tooltip-format": "{ifname} via {gwaddr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
"scroll-step": 1,
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
}
}]

335
waybar/style.css Normal file
View file

@ -0,0 +1,335 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: white;
}
#privacy-item.screenshare {
background-color: #cf5700;
}
#privacy-item.audio-in {
background-color: #1ca000;
}
#privacy-item.audio-out {
background-color: #0069d4;
}
#tags button {
color: #aaaaaa;
}
#tags button.focused {
background-color: #555555;
}