refact: restyling

This commit is contained in:
Marcius 2024-05-04 01:18:56 +01:00
parent 7eb0424f1a
commit c09204c72d
23 changed files with 250 additions and 98 deletions

View file

@ -1,2 +1,10 @@
[monitors]
eDP-1=<% opt.wallpaper %>
[shaders]
vertex=vertex.glsl
fragment=fragment.glsl
[animations]
loop=true
fps=15

View file

@ -0,0 +1,11 @@
#version 330 core
out vec4 frag_color;
in vec3 ourColor;
in vec2 TexCoord;
uniform sampler2D ourTexture;
void main() {
frag_color = texture(ourTexture, TexCoord);
}

View file

@ -0,0 +1,13 @@
#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aColor;
layout(location = 2) in vec2 aTexCoord;
out vec3 ourColor;
out vec2 TexCoord;
void main() {
gl_Position = vec4(aPos.x, -aPos.y, aPos.z, 1.0);
ourColor = aColor;
TexCoord = aTexCoord;
}

View file

@ -1,4 +1,4 @@
font=<% opt.font_term %>:<! if opt.compositor == "river" then !>size=16<! else !>size=11<! end !>
font=<% opt.font_term %>:<! if opt.compositor == "river" then !>size=15<! else !>size=11<! end !>
[cursor]
color=<% opt.term.cursor_foreground %> <% opt.term.cursor_background %>

View file

@ -1,6 +1,6 @@
[Settings]
gtk-theme-name=<% opt.gtk_theme %>
gtk-icon-theme-name=<% opt.icon_theme %>
gtk-font-name=<% opt.term.font %> 12
gtk-font-name=<% opt.term.font %> 11
gtk-cursor-theme-name=<% opt.cursor.theme %>
gtk-cursor-theme-size=0

View file

@ -1,5 +1,5 @@
[Settings]
gtk-theme-name=<% opt.term.font %>
gtk-icon-theme-name=<% opt.icon_theme %> 12
gtk-icon-theme-name=<% opt.icon_theme %> 11
gtk-cursor-theme-name=<% opt.cursor.theme %>
gtk-cursor-theme-size=0

View file

@ -0,0 +1,3 @@
require("hardtime").setup()

View file

@ -0,0 +1 @@
require("hardtime").setup()

View file

@ -26,7 +26,8 @@ require('mason-lspconfig').setup({
'html',
'cssls',
'bashls',
'pyre'
'pyre',
'glsl_analyzer'
},
handlers = {
lsp.default_setup,

View file

@ -1,6 +1,6 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "all" },
ensure_installed = { "java", "zig", "javascript", "typescript", "c", "lua", "vim", "vimdoc", "query", "html", "css" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,

View file

@ -12,7 +12,8 @@ return require('packer').startup(function(use)
use 'nvim-lualine/lualine.nvim'
use 'norcalli/nvim-colorizer.lua'
use 'lewis6991/gitsigns.nvim'
use 'm4xshen/hardtime.nvim'
use {'akinsho/git-conflict.nvim', tag = "*"}
use {

View file

@ -123,7 +123,7 @@ do
done
# Recording
riverctl map normal Super Print spawn 'obs --startrecording --minimize-to-tray'
riverctl map normal Super Print spawn 'obs --startrecording'
riverctl map normal Super None spawn "grim $HOME/media/images/screenshot/$(date +'%screenshot.jpeg') | wl-copy"
# pre start up scripts
@ -132,12 +132,11 @@ echo 'cg.opt.compositor = "river"' >~/confgenfs/_cgfs/eval
# start up scripts
waybar &
aestuarium &
swayidle -w timeout 150 ~/lock_screen_rand_wp.sh timeout 200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' &
gsettings set org.gnome.desktop.interface gtk-theme "Breeze-Dark" &&
gsettings set org.gnome.desktop.interface cursor-theme darkbolt-cursor &&
gsettings set org.gnome.desktop.wm.preferences button-layout ""
gsettings set org.gnome.desktop.interface font-name "Iosevka NFM 12"
gsettings set org.gnome.desktop.interface text-scaling-factor 1.5
gsettings set org.gnome.desktop.interface text-scaling-factor 1.0
# Set background and border color
riverctl background-color 0x10002f
@ -148,10 +147,12 @@ riverctl input pointer-1267-12541-ELAN0712:00_04F3:30FD_Touchpad natural-scroll
riverctl input pointer-1267-12541-ELAN0712:00_04F3:30FD_Touchpad tap enabled
riverctl set-repeat 50 300
riverctl hide-cursor when-typing enabled
riverctl hide-cursor when-typing disabled
export XDG_CURRENT_DESKTOP=river
dbus-update-activation-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
systemctl --user import-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
riverctl default-layout rivertile
rivertile -view-padding 6 -outer-padding 6 -main-count 2 -main-ratio 0.5 &
rivertile -view-padding 6 -outer-padding 6 -main-count 4 -main-ratio 0.5 &
swayidle -w timeout 150 exec 'swaylock -f -i $(find $HOME/dev/wallpapers/ -type f | shuf -n 1)' timeout 200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' &

View file

@ -2,12 +2,15 @@
"spacing": 2,
"layer": "top",
"modules-left": [
<! if opt.compositor == "river" then !>
"river/tags"
<! else !>
<! if opt.compositor == "hyprland" then !>
"hyprland/workspaces"
<! else !>
"river/tags"
<! end !>
],
"modules-center": [
"clock"
],
"modules-right": [
"network",
"temperature",
@ -16,7 +19,6 @@
"pulseaudio",
"gamemode",
"battery",
"clock",
"tray"
],
"river/tags": {
@ -87,8 +89,8 @@
},
"battery": {
"states": {
"warning": 50,
"critical": 20
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon} ",
"format-charging": "{capacity}% 󰂄",

View file

@ -1,65 +1,32 @@
@import "theme.css";
* {
border: none;
border-radius: 0;
border: none;
border-radius: 0px;
font-family: "<% opt.font %>";
min-height: 18px;
transition: transform 250ms ease-in-out;
}
window#waybar {
background: rgba(1, 1, 1, 0.5);
background-color: #050505;
padding: 20px;
}
window#waybar.hidden {
opacity: 0.2;
padding: 20px;
}
#window {
padding-top: 4px;
padding-bottom: 4px;
padding-left: 8px;
padding-right: 8px;
}
#workspaces, #tags {
background: @base;
}
#workspaces button{
#workspaces button,
#tags button{
padding: 10px;
transition: none;
color: @text;
background: @base;
font-size: 16px;
}
#tags button {
padding: 10px;
transition: none;
color: @text;
background: transparent;
font-size: 16px;
}
#workspaces button.active,
#tags button.focused {
color: @text;
background: @active;
background: transparent;
}
#workspaces button:hover,
#tags button:hover{
transition: none;
box-shadow: inherit;
text-shadow: inherit;
color: @subtext;
background: white;
}
#tags button.occupied{
background: @base;
#tags button:hover,
#clock:hover
{
color: #F7A41D;
}
#tags button.urgent{
@ -71,6 +38,11 @@ window#waybar.hidden {
animation-direction: alternate;
}
#tags button.focused,
#tags button.occupied {
color: #F7A41D;
}
#pulseaudio, #mpris,
#temperature, #cpu,
#memory, #battery,
@ -79,9 +51,24 @@ window#waybar.hidden {
#network
{
padding: 8px;
transition: transform 250ms ease-in-out;
color: @text;
background: @base;
background: transparent;
}
#pulseaudio:hover, #mpris:hover,
#temperature:hover, #cpu:hover,
#memory:hover, #battery:hover,
#clock:hover, #gamemode:hover,
#tray:hover, #window:hover,
#network:hover
{
color: #F7A41D;
}
#clock,
#tags,
.modules-right {
border: 5px double white;
margin: 10px 0px;
border-radius: 100px;
}
#battery.warning {
@ -102,20 +89,13 @@ window#waybar.hidden {
animation-direction: alternate;
}
#clock:hover {
color: @subtext;
background: white;
}
tooltip {
background: @base;
}
window#waybar.empty #window {
padding: 0px;
margin: 0px;
border: 0px;
background-color: transparent;
#battery.charging {
background: @charging;
animation-name: charging-blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes critical-blink {
@ -129,3 +109,9 @@ window#waybar.empty #window {
background-color: @warning_blink;
}
}
@keyframes charging-blink {
to {
background-color: @charging_blink;
}
}

View file

@ -1,9 +1,11 @@
@define-color base rgba(46, 142, 218, 0.2);
@define-color active rgba(50, 150, 250, 0.4);
@define-color base #050505;
@define-color active #202020;
@define-color warning rgba(250, 250, 5, 0.2);
@define-color warning_blink rgba(250, 250, 5, 0.5);
@define-color critical rgba(250, 5, 5, 0.2);
@define-color critical_blink rgba(250, 5, 5, 0.5);
@define-color charging rgba(5, 250, 5, 0.2);
@define-color charging_blink rgba(5, 250, 5, 0.5);
@define-color crust grey;
@define-color text white;

View file

@ -1,5 +1,5 @@
gtk-icon-theme-name="<% opt.icon_theme %>"
gtk-cursor-theme-name="<% opt.cursor.theme %>"
gtk-theme-name="<% opt.gtk_theme %>"
gtk-font-name="<% opt.font %> 12"
gtk-font-name="<% opt.font %> 11"

View file

@ -3,7 +3,7 @@ local opt = {}
opt.default_editor = "nvim"
opt.font = "HeavyData Nerd Font"
opt.font_term = "Iosevka NFM"
opt.font_term = "Hurmit Nerd Font"
opt.font_size = "12"
opt.gtk_theme = "Breeze-Dark"
@ -17,11 +17,11 @@ opt.cursor = {
}
opt.wallpapers_path = os.getenv("HOME") .. "/dev/wallpapers"
opt.wallpaper = opt.wallpapers_path .. "/aqua.png"
opt.wallpaper = opt.wallpapers_path .. "/zig.gif"
opt.term = {
font = "Iosevka NFM",
alpha = 0.7,
font = "Hurmit Nerd Font",
alpha = 0.95,
foreground = "bbbbbb",
background = "090a18",
regular0 = "090a18",

View file

@ -1,3 +1,20 @@
# Aestuarium
Well, at the moment this is a complet copy of the original project but I plan to later on make some changes here
Yet another wayland background manager using openGL. This is still in very early stages of development and I don't recommend anyone to use it yet.
### Why another tool for background in wayland?
Because all other tools for background didn't have the features I want and also nothing bad in some competition
### Why the name "Aestuarium"
It is the latin for [Estuary](https://en.wikipedia.org/wiki/Estuary), I will leave the explanation to your imagination.
### Dependencies
- [zigimg/zigimg](https://github.com/zigimg/zigimg)
- [getty-zig/json](https://github.com/getty-zig/json)
- [ifeund/zig-wayland](https://codeberg.org/ifreund/zig-wayland)
- [ziglibs/known-folders](https://github.com/ziglibs/known-folders)
- [ziglibs/ini](https://github.com/ziglibs/ini)
- [MasterQ32/zig-args](https://github.com/MasterQ32/zig-args)

View file

@ -16,6 +16,7 @@ const Preloaded = struct {
height: c_int,
width: c_int,
bytes: []const u8,
// OpenGL Format
format: c_int,
zigimg: *Image,
};
@ -37,7 +38,6 @@ pub fn preload(self: *Preload, path: []const u8) !void {
var preloaded = try self.alloc.create(Preloaded);
std.debug.print("to preload: {s}", .{path});
const new_mem_path = try self.alloc.alloc(u8, path.len);
@memcpy(new_mem_path, path);
preloaded.path = new_mem_path;

View file

@ -9,30 +9,38 @@ pub const Opts = struct {
help: bool = false,
outputs: bool = false,
json: bool = false,
target: ?[]const u8 = null,
monitor: ?[]const u8 = null,
preload: ?[]const u8 = null,
unload: ?[]const u8 = null,
wallpaper: ?[]const u8 = null,
pub const shorthands = .{
.h = "help",
.j = "json",
.t = "target",
.m = "monitor",
.p = "preload",
.u = "unload",
.w = "wallpaper",
};
};
pub const Args = union(enum) {};
const help_msg =
\\Aestuarium v{[version]s} - yet another wayland background manager
\\Aestuarium v{[version]s} - yet another wayland wallpaper manager
\\
\\usage: {[a0]s} [options] <commands>
\\
\\Options:
\\ --target, -t Target output to set wallpaper
\\ --json, -j Returns the result in json format
\\ --monitor, -m Monitor to set wallpaper
\\
\\Subcommands:
\\ {[a0]s} wallpaper Set wallpaper to output
\\ {[a0]s} outputs Lists the monitors currently available
\\ {[a0]s} help Print this help and exit
\\ {[a0]s} preload <path> Preload file into memory
\\ {[a0]s} wallpaper <path> Set wallpaper to output
\\ {[a0]s} unload <path/"all"> Unload file/s from memory
\\ {[a0]s} outputs Lists the monitors currently available
\\ {[a0]s} help Print this help and exit
;
pub fn printHelp(alloc: Allocator) !void {

View file

@ -8,6 +8,7 @@ const Outputs = @import("Outputs.zig");
const Config = @import("Config.zig");
const Render = @import("Render.zig");
const Server = @import("socket/Server.zig");
const Client = @import("socket/Client.zig");
const Preload = @import("Preload.zig");
const Allocator = std.mem.Allocator;
@ -68,6 +69,28 @@ pub fn main() !u8 {
return 1;
}
const cl_state = if (opts.options.preload != null or opts.options.wallpaper != null or opts.options.unload != null) true else false;
if (opts.options.preload) |path| {
var client = try Client.init(alloc);
try client.preload(path);
client.deinit();
}
if (opts.options.wallpaper) |path| {
var client = try Client.init(alloc);
try client.wallpaper(opts.options.monitor, path);
client.deinit();
}
if (opts.options.unload) |path| {
var client = try Client.init(alloc);
try client.unload(path);
client.deinit();
}
if (cl_state) {
return 0;
}
// TODO check for existing instances of the app running
return try runMainInstance(alloc);
}
@ -151,11 +174,9 @@ fn runMainInstance(alloc: Allocator) !u8 {
var i: usize = 0;
while (i <= ev_count) : (i += 1) {
if (epoll_events[i].data.fd == display_fd) {
std.log.info("epoll display global event", .{});
if (globals.display.roundtrip() != .SUCCESS) return error.RoundTripFail;
}
if (epoll_events[i].data.fd == server.fd) {
std.log.info("epoll socket server event", .{});
try server.handleConnection();
}
}

View file

@ -0,0 +1,76 @@
const std = @import("std");
const Globals = @import("../Globals.zig");
const fs = std.fs;
const Allocator = std.mem.Allocator;
const Client = @This();
alloc: Allocator,
stream: std.net.Stream,
pub fn init(alloc: Allocator) !Client {
var env_map = try std.process.getEnvMap(alloc);
defer env_map.deinit();
const xdg_runtime_dir = env_map.get("XDG_RUNTIME_DIR") orelse return error.MissingXDGRuntimeDir;
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const server_address = try std.fmt.bufPrintZ(
&buf,
"{s}/aestuarium.sock",
.{xdg_runtime_dir},
);
const client = try std.net.connectUnixSocket(server_address);
return Client{
.alloc = alloc,
.stream = client,
};
}
pub fn preload(self: *Client, path: []const u8) !void {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
if (!std.fs.path.isAbsolute(path)) {
return error.PathNotAbsolute;
}
try self.stream.writeAll(try std.fmt.bufPrintZ(&buf, "preload {s}", .{path}));
const reply_len = try self.stream.read(&buf);
try std.io.getStdOut().writeAll(buf[0 .. reply_len - 1]);
try std.io.getStdOut().writer().writeByte('\n');
}
pub fn wallpaper(self: *Client, monitor: ?[]const u8, path: []const u8) !void {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
if (!std.fs.path.isAbsolute(path)) {
return error.PathNotAbsolute;
}
try self.stream.writeAll(try std.fmt.bufPrintZ(&buf, "wallpaper {s}={s}", .{ monitor orelse "", path }));
const reply_len = try self.stream.read(&buf);
try std.io.getStdOut().writeAll(buf[0 .. reply_len - 1]);
try std.io.getStdOut().writer().writeByte('\n');
}
// unload can be a path or "all" to unload all wallpapers
pub fn unload(self: *Client, path: []const u8) !void {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
if (!std.fs.path.isAbsolute(path) and !std.mem.eql(u8, "all", path)) {
return error.PathNotAbsolute;
}
try self.stream.writeAll(try std.fmt.bufPrintZ(&buf, "unload {s}", .{path}));
const reply_len = try self.stream.read(&buf);
try std.io.getStdOut().writeAll(buf[0 .. reply_len - 1]);
try std.io.getStdOut().writer().writeByte('\n');
}
pub fn deinit(self: *Client) void {
self.stream.close();
}

View file

@ -65,7 +65,7 @@ pub fn handleConnection(self: *Server) !void {
_ = try connection.stream.write(@errorName(err));
return;
};
_ = try connection.stream.write("preloaded successfully");
_ = try connection.stream.write("preloaded successfully\n");
return;
}
}
@ -80,6 +80,7 @@ pub fn handleConnection(self: *Server) !void {
self.globals.rendered_outputs.?[i].setWallpaper(std.mem.trim(u8, wallpaper, "\x0a")) catch |err| {
std.log.err("{s}", .{@errorName(err)});
_ = try connection.stream.write(@errorName(err));
connection.stream.close();
return;
};
_ = try connection.stream.write("Changed successfully!\n");