Compare commits

...

2 commits

Author SHA1 Message Date
LordMZTE 5a239082da
add workaround for gtk brainrot 2024-02-11 13:26:59 +01:00
LordMZTE d914aa4069
update to latest Zig
+ other random fixes
2024-02-11 13:10:53 +01:00
22 changed files with 163 additions and 117 deletions

View file

@ -0,0 +1,18 @@
<! if opt.wayland_compositor == "river" then !>
/* GTK is to retarded to realize that some compositors that don't implement deprecated
* protocols do not want client-side decoration. We completely disable titlebars here to compensate. */
headerbar.titlebar.default-decoration {
background: transparent;
padding: 0;
margin: 0 0 -17px 0;
border: 0;
min-height: 0;
font-size: 0;
box-shadow: none;
}
window.csd,
window.csd decoration {
box-shadow: none;
}
<! end !>

View file

@ -0,0 +1,18 @@
<! if opt.wayland_compositor == "river" then !>
/* GTK is to retarded to realize that some compositors that don't implement deprecated
* protocols do not want client-side decoration. We completely disable titlebars here to compensate. */
headerbar.titlebar.default-decoration {
background: transparent;
padding: 0;
margin: 0 0 -17px 0;
border: 0;
min-height: 0;
font-size: 0;
box-shadow: none;
}
window.csd,
window.csd decoration {
box-shadow: none;
}
<! end !>

View file

@ -1,7 +1,7 @@
local opts = {}
opts.mzteinit_entries = {
{ key = "r", label = "river", cmd = { "mzteriver" } },
{ key = "r", label = "river", cmd = { cg.opt.system "which mzteriver" } },
{ key = "h", label = "hyprland", cmd = { "Hyprland" } },
{ key = "s", label = "shell", cmd = { "fish" } },
{ key = "l", label = "logout", cmd = { "!quit" } },

View file

@ -18,7 +18,12 @@ cg.onDone(function(errors)
cg.opt.system("gsettings set org.gnome.desktop.interface gtk-theme " .. cg.opt.gtk_theme)
cg.opt.system("gsettings set org.gnome.desktop.interface cursor-theme " .. cg.opt.cursor.theme)
cg.opt.system("gsettings set org.gnome.desktop.interface cursor-size " .. cg.opt.cursor.size)
cg.opt.system("gsettings set org.gnome.desktop.interface font-name \"" .. cg.opt.font .. " 11\"")
cg.opt.system('gsettings set org.gnome.desktop.interface font-name "' .. cg.opt.font .. ' 11"')
if cg.opt.wayland_compositor == "river" then
cg.opt.system 'gsettings set org.gnome.desktop.wm.preferences button-layout ""'
else
cg.opt.system "gsettings reset org.gnome.desktop.wm.preferences button-layout"
end
end
end)
@ -40,14 +45,6 @@ local function merge(a, b)
return a
end
cg.opt = merge(cg.opt, require "cg_opts")
local local_opts = loadfile(os.getenv "HOME" .. "/.config/mzte_localconf/opts.lua")
if local_opts then
cg.opt = merge(cg.opt, local_opts())
end
-- This function is called in templates to allow adding device-specific configs.
cg.opt.getDeviceConf = function(id)
local path = os.getenv "HOME" .. "/.config/mzte_localconf/" .. id
@ -104,3 +101,11 @@ cg.opt.fileExists = function(path)
return false
end
cg.opt = merge(cg.opt, require "cg_opts")
local local_opts = loadfile(os.getenv "HOME" .. "/.config/mzte_localconf/opts.lua")
if local_opts then
cg.opt = merge(cg.opt, local_opts())
end

View file

@ -5,8 +5,8 @@ const ser = @import("ser.zig");
const log = std.log.scoped(.compiler);
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {

View file

@ -19,47 +19,49 @@ const modules = struct {
const utils = @import("modules/utils.zig");
};
pub const std_options = struct {
pub fn logFn(
comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral),
comptime format: []const u8,
args: anytype,
) void {
var msg_buf: [512]u8 = undefined;
const msg = std.fmt.bufPrintZ(&msg_buf, format, args) catch return;
pub const std_options = std.Options{
.logFn = struct {
pub fn logFn(
comptime level: std.log.Level,
comptime scope: @TypeOf(.EnumLiteral),
comptime format: []const u8,
args: anytype,
) void {
var msg_buf: [512]u8 = undefined;
const msg = std.fmt.bufPrintZ(&msg_buf, format, args) catch return;
var title_buf: [512]u8 = undefined;
const title = std.fmt.bufPrintZ(
&title_buf,
"MZTE-NV ({s})",
.{@tagName(scope)},
) catch return;
var title_buf: [512]u8 = undefined;
const title = std.fmt.bufPrintZ(
&title_buf,
"MZTE-NV ({s})",
.{@tagName(scope)},
) catch return;
const lvl = switch (level) {
.debug => nvim.LOGLVL_DBG,
.info => nvim.LOGLVL_INF,
.warn => nvim.LOGLVL_WRN,
.err => nvim.LOGLVL_ERR,
};
const lvl = switch (level) {
.debug => nvim.LOGLVL_DBG,
.info => nvim.LOGLVL_INF,
.warn => nvim.LOGLVL_WRN,
.err => nvim.LOGLVL_ERR,
};
var dict = znvim.Dictionary{ .alloc = std.heap.c_allocator };
defer dict.deinit();
var dict = znvim.Dictionary{ .alloc = std.heap.c_allocator };
defer dict.deinit();
dict.push(@constCast("title"), znvim.nvimObject(@as([]u8, title))) catch return;
// noice notficitaions recognize this and show in the mini view instead of notifs
dict.push(@constCast("mzte_nv_mini"), comptime znvim.nvimObject(true)) catch return;
dict.push(@constCast("title"), znvim.nvimObject(@as([]u8, title))) catch return;
// noice notficitaions recognize this and show in the mini view instead of notifs
dict.push(@constCast("mzte_nv_mini"), comptime znvim.nvimObject(true)) catch return;
var e = znvim.Error{};
_ = nvim.nvim_notify(
znvim.nvimString(msg),
lvl,
dict.dict,
&e.err,
);
}
var e = znvim.Error{};
_ = nvim.nvim_notify(
znvim.nvimString(msg),
lvl,
dict.dict,
&e.err,
);
}
}.logFn,
pub const log_level = .debug;
.log_level = .debug,
};
const reg_key = "mzte-nv-reg";

View file

@ -31,7 +31,7 @@ fn lCopyBuf(l: *c.lua_State) !c_int {
const ft_opt = znvim.OptionValue.get("filetype", .local);
// store previous window layout
// store previous window layout
const cursor_pos = nvim.curwin.*.w_cursor;
const topline = nvim.curwin.*.w_topline;

View file

@ -4,20 +4,22 @@ const c = ffi.c;
const ffi = @import("ffi.zig");
const util = @import("util.zig");
pub const std_options = struct {
pub const log_level = .debug;
pub fn logFn(
comptime message_level: std.log.Level,
comptime scope: @TypeOf(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
_ = scope;
pub const std_options = std.Options{
.log_level = .debug,
.logFn = struct {
fn logFn(
comptime message_level: std.log.Level,
comptime scope: @TypeOf(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
_ = scope;
const stderr = std.io.getStdErr().writer();
const stderr = std.io.getStdErr().writer();
stderr.print("[mzte-mpv {s}] " ++ format ++ "\n", .{@tagName(message_level)} ++ args) catch return;
}
stderr.print("[mzte-mpv {s}] " ++ format ++ "\n", .{@tagName(message_level)} ++ args) catch return;
}
}.logFn,
};
export fn mpv_open_cplugin(handle: *c.mpv_handle) callconv(.C) c_int {

View file

@ -13,4 +13,3 @@ pub fn msg(mpv: *c.mpv_handle, comptime fmt: []const u8, args: anytype) !void {
@constCast(&[_:null]?[*:0]const u8{ "show-text", osd_msg, "4000" }),
));
}

View file

@ -3,8 +3,8 @@ const std = @import("std");
const cache = @import("cache.zig");
const util = @import("util.zig");
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {

View file

@ -1,7 +1,7 @@
const std = @import("std");
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {

View file

@ -9,29 +9,31 @@ const Server = @import("sock/Server.zig");
const msg = @import("message.zig").msg;
pub const std_options = struct {
pub const log_level = .debug;
pub fn logFn(
comptime msg_level: std.log.Level,
comptime scope: @TypeOf(.enum_literal),
comptime fmt: []const u8,
args: anytype,
) void {
const logfile = log_file orelse return;
pub const std_options = std.Options{
.log_level = .debug,
.logFn = struct {
pub fn logFn(
comptime msg_level: std.log.Level,
comptime scope: @TypeOf(.enum_literal),
comptime fmt: []const u8,
args: anytype,
) void {
const logfile = log_file orelse return;
if (scope != .default) {
logfile.writer().print("[{s}] ", .{@tagName(scope)}) catch return;
if (scope != .default) {
logfile.writer().print("[{s}] ", .{@tagName(scope)}) catch return;
}
logfile.writer().writeAll(switch (msg_level) {
.err => "E: ",
.warn => "W: ",
.info => "I: ",
.debug => "D: ",
}) catch return;
logfile.writer().print(fmt ++ "\n", args) catch return;
}
logfile.writer().writeAll(switch (msg_level) {
.err => "E: ",
.warn => "W: ",
.info => "I: ",
.debug => "D: ",
}) catch return;
logfile.writer().print(fmt ++ "\n", args) catch return;
}
}.logFn,
};
var log_file: ?std.fs.File = null;

View file

@ -2,8 +2,8 @@ const std = @import("std");
const Client = @import("sock/Client.zig");
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {

View file

@ -7,18 +7,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const cg_opt = try common.confgenGet(struct {
nvidia: bool = false,
term: struct { command: [:0]const u8 },
commands: struct {
file_manager: [:0]const u8,
browser: [:0]const u8,
},
cursor: struct {
theme: [:0]const u8,
size: u32,
}
}, "../..", b.allocator);
const cg_opt = try common.confgenGet(struct { nvidia: bool = false, term: struct { command: [:0]const u8 }, commands: struct {
file_manager: [:0]const u8,
browser: [:0]const u8,
}, cursor: struct {
theme: [:0]const u8,
size: u32,
} }, "../..", b.allocator);
const opts = b.addOptions();
opts.addOption(bool, "nvidia", cg_opt.nvidia);

View file

@ -137,13 +137,18 @@ pub fn init(alloc: std.mem.Allocator) !void {
try con.runCommand(&.{ "border-color-focused", "0x880000" });
try con.runCommand(&.{ "border-color-unfocused", "0x660000" });
try con.runCommand(&.{ "hide-cursor", "when-typing", "enabled" });
try con.runCommand(&.{
"xcursor-theme",
opts.cursor_theme,
std.fmt.comptimePrint("{}", .{opts.cursor_size}),
});
try con.runCommand(&.{ "float-filter-add", "app-id", "vinput-editor" });
try con.runCommand(&.{ "rule-add", "-app-id", "vinput-editor", "float" });
// disable client-side decoration (completely stupid concept)
try con.runCommand(&.{ "rule-add", "-app-id", "*", "ssd" });
try con.runCommand(&.{ "default-layout", "rivertile" });
@ -177,7 +182,7 @@ pub fn init(alloc: std.mem.Allocator) !void {
inline for (.{
.{"wlbg"},
.{"waybar"},
.{ "dbus-update-activation-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY" },
.{ "dbus-update-activation-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP" },
.{ "systemctl", "--user", "import-environment", "DISPLAY", "XAUTHORITY", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP" },
.{ "rivertile", "-view-padding", "6", "-outer-padding", "6" },
}) |argv| {

View file

@ -1,11 +1,11 @@
const std = @import("std");
const opts = @import("opts");
pub const std_options = struct {
pub const log_level = switch (@import("builtin").mode) {
pub const std_options = std.Options{
.log_level = switch (@import("builtin").mode) {
.Debug => .debug,
else => .info,
};
},
};
pub fn main() !void {

View file

@ -1,8 +1,8 @@
const std = @import("std");
const info = @import("info.zig");
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
const browsers = &[_][]const u8{

View file

@ -4,8 +4,8 @@ const gui = @import("gui.zig");
const State = @import("State.zig");
const log = std.log.scoped(.main);
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {

View file

@ -8,8 +8,8 @@
.hash = "1220ea86ace34b38e49c1d737c5f857d88346af10695a992b38e10cb0a73b6a19ef7",
},
.known_folders = .{
.url = "git+https://github.com/ziglibs/known-folders#806ba01b872820004c7dec3117cb0db66b206af6",
.hash = "122094b48dea08e241b48d0ec32e3df6965e814091e3cabaff942e62d053f3ff9b5f",
.url = "git+https://github.com/ziglibs/known-folders.git#2aa7f2e9855d45b20072e15107fb379b9380adbe",
.hash = "12209925016f4b5486a713828ead3bcc900fa4f039c93de1894aa7d5253f7633b92c",
},
},
.paths = .{""},

View file

@ -2,8 +2,8 @@ const std = @import("std");
const xinerama = @import("xinerama.zig");
const Walker = @import("Walker.zig");
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !u8 {

View file

@ -2,8 +2,8 @@ const std = @import("std");
const c = @import("ffi.zig").c;
const ClipboardConnection = @import("ClipboardConnection.zig");
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {

View file

@ -16,8 +16,8 @@ const wl = wayland.client.wl;
const zwlr = wayland.client.zwlr;
const zxdg = wayland.client.zxdg;
pub const std_options = struct {
pub const log_level = .debug;
pub const std_options = std.Options{
.log_level = .debug,
};
pub fn main() !void {