myputer specific changes

This commit is contained in:
Emile Clark-Boman 2025-02-11 15:47:56 +10:00
parent 1d4189b040
commit a448ce3f39
216 changed files with 544 additions and 24478 deletions

26
homes/modules/ags/config.js Executable file
View file

@ -0,0 +1,26 @@
import { AppLauncher } from "./widgets/applauncher.js"
import { Notifications } from "./widgets/notifications.js"
const date = Variable('', {
poll: [1000, 'date'],
})
const Bar = (monitor = 0) => Widget.Window({
monitor,
name: 'bar${monitor}',
anchor: ['top', 'left', 'right'],
child: Widget.Label({ label: date.bind() }),
})
App.config({
style: "./style.css",
// icons: "./assets",
windows: [
Bar(),
AppLauncher,
Notifications()
]
// gtkTheme: "Adwaita-dark",
// cursorTheme: "Qogir",
// iconTheme: "MoreWaita",[]
})

View file

@ -0,0 +1,12 @@
{pkgs, ...}: {
programs.ags = {
enable = true;
configDir = ./.;
extraPackages = with pkgs; [
gtksourceview
webkitgtk
accountsservice
];
};
}

0
homes/modules/ags/style.css Executable file
View file

View file

@ -0,0 +1,125 @@
const { query } = await Service.import("applications");
const WINDOW_NAME = "applauncher";
const AppItem = app => Widget.Button({
on_clicked: () => {
App.closeWindow(WINDOW_NAME)
app.launch()
},
attribute: { app },
child: Widget.Box({
children: [
Widget.Icon({
icon: app.icon_name || "",
size: 42,
}),
Widget.Label({
class_name: "title",
label: app.name,
xalign: 0,
vpack: "center",
truncate: "end",
css: "margin-left: 10px;"
}),
],
}),
})
const AppLauncherWidget = ({ width = 500, height = 500, spacing = 12 }) => {
let applications = query("").map(AppItem)
const list = Widget.Box({
vertical: true,
children: applications,
spacing,
})
function refresh() {
applications = query("").map(AppItem)
list.children = applications
}
const entry = Widget.Entry({
placeholder_text: "Search",
hexpand: true,
css: "min-height: 50px;",
// launch first item when Enter is pressed
on_accept: () => {
// only consider applications that are visible in the list
const results = applications.filter((item) => item.visible);
if (results[0]) {
App.toggleWindow(WINDOW_NAME);
results[0].attribute.app.launch()
}
},
// filter the applications based on search term
on_change: ({ text }) => applications.forEach(item => {
item.visible = item.attribute.app.match(text ?? "")
}),
})
return Widget.Box({
vertical: false,
children: [
// LEFT
Widget.Box({
vertical: true,
css: `min-width: ${width}px;`
+ `min-height: ${height}px;`
+ "background-image: url('https://images2.alphacoders.com/135/1351579.png');"
+ "background-size: cover;"
+ "background-position: center;"
+ "background-repeat: no-repeat;",
children: [
// align the entry field with the app list
Widget.Box({
css: `margin: ${spacing * 2}px;`,
child: entry,
}),
],
}),
// RIGHT
Widget.Box({
vertical: true,
css: `margin: ${spacing * 2}px;`,
child:
// make scrollable
Widget.Scrollable({
hscroll: "never",
css: `min-width: ${width}px; min-height: ${height}px;`,
child: list,
}),
setup: self => self.hook(App, (_, windowName, visible) => {
if (windowName !== WINDOW_NAME)
return
// when the launcher becomes visible
if (visible) {
refresh()
entry.text = ""
entry.grab_focus()
}
}),
}),
],
})
}
// the app launcher should be a singleton
export const AppLauncher = Widget.Window({
name: WINDOW_NAME,
setup: self => self.keybind("Escape", () => {
App.closeWindow(WINDOW_NAME)
}),
visible: false,
keymode: "exclusive",
child: AppLauncherWidget({
width: 500,
height: 500,
spacing: 12,
}),
})

View file

@ -0,0 +1,38 @@
import options from "options"p
const { start, center, end } = options.bar.layout
// place all your bar widgets in here
const widgets = {
expander: () => Widget.Box({ expand: true}),
}
//export type BarWidget = keyof typeof widget;
export default (monitor: number) => Widget.Window({
monitor,
class_name: "bar",
name: "bar-${monitor}",
// anchor: position.bind().as(pos => [pos, "left", "right"]),
anchor: ["top", "left", "right"],
child: Widget.CenterBox({
// ensure bar is shown
css: "min-width: 2px; min-height: 2px;"
startWidget: Widget.Box({
hexpand: true,
// map all start widgets to be childen
childen: start.bind().as(s => s.map(w => widgets[w]()))
}),
centerWidget: Widget.Box({
hpack: "center",
// map all center widgets to be childen
childen: center.bind().as(c => c.map(w => widgets[w]()))
}),
endWidget: Widget.Box({
hexpand: true
// map all end widgets to be childen
childen: end.bind().as(e => e.map(w => widgets[w]()))
}),
})
})

View file

@ -0,0 +1,23 @@
const WINDOW_NAME = "fullscreen";
const Fullscreen = (children) => Widget.Box({
vertical: true,
css: "background-image: url('https://images2.alphacoders.com/135/1351579.png');"
+ "background-size: cover;"
+ "background-position: center;"
+ "background-repeat: no-repeat;",
children: children,
})
export const fullscreen = Widget.Window({
name: WINDOW_NAME,
setup: self => self.keybind("Escape", () => {
App.closeWindow(WINDOW_NAME)
}),
anchor: ["top", "bottom", "left", "right"],
visible: false,
keymode: "exclusive",
child: Fullscreen(
Widget.Label({"Hello World"});
)
})

View file

@ -0,0 +1,122 @@
const notifications = await Service.import("notifications");
function NotificationIcon({ app_entry, app_icon, image}) {
if (image) {
return Widget.Box({
css: `background-image: url("${image}");`
+ "background-size: contain;"
+ "background-repeat: no-repeat;"
+ "background-position: center;"
})
}
let icon = "dialog-information-symbolic"
if (Utils.lookUpIcon(app_icon))
icon = app_icon
if (app_entry && Utils.lookUpIcon(app_entry))
icon = app_entry
return Widget.Box({
child: Widget.Icon(icon),
})
}
function Notification(n) {
const icon = Widget.Box({
vpack: "start",
class_name: "icon",
child: NotificationIcon(n),
})
const title = Widget.Label({
class_name: "title",
xalign: 0,
justification: "left",
hexpand: true,
max_width_chars: 24,
truncate: "end",
wrap: true,
label: n.summary,
use_markup: true,
})
const body = Widget.Label({
class_name: "body",
hexpand: true,
use_markup: true,
xalign: 0,
justification: "left",
label: n.body,
wrap: true,
})
const actions = Widget.Box({
class_name: "actions",
children: n.actions.map(({ id, label}) => Widget.Button({
class_name: "action-button",
on_clicked: () => {
n.invoke(id),
n.dismiss()
},
hexpand: true,
child: Widget.Label(label),
})),
})
return Widget.EventBox(
{
attribute: {id: n.id},
on_primary_click: n.dismiss,
},
Widget.Box(
{
class_name: `notification ${n.urgency}`,
vertical: true,
},
Widget.Box([
icon,
Widget.Box(
{ vertical: true },
title,
body,
),
]),
actions,
),
)
}
export function Notifications(monitor = 0) {
const list = Widget.Box({
vertical: true,
children: notifications.popups.map(Notification),
})
function onNotified(_, id) {
const n = notifications.getNotification(id)
if (n)
list.children = [Notification(n), ...list.children]
}
function onDismissed(_, id) {
list.children.find(n => n.attribute.id === id)?.destroy()
}
list.hook(notifications, onNotified, "notified")
.hook(notifications, onDismissed, "dismissed")
return Widget.Window({
monitor,
class_name: "notifications-widget",
name: `notifications-${monitor}`,
anchor: ["top", "left"],
child: Widget.Box({
css: "min-width: 2px; min-height: 2px;",
class_name: "notifications",
vertical: true,
child: list,
}),
})
}

0
homes/modules/bat.nix Normal file → Executable file
View file

0
homes/modules/editor/helix.nix Normal file → Executable file
View file

0
homes/modules/editor/nixvim.nix Normal file → Executable file
View file

0
homes/modules/firefox.nix Normal file → Executable file
View file

0
homes/modules/fish.nix Normal file → Executable file
View file

0
homes/modules/git.nix Normal file → Executable file
View file

0
homes/modules/hypr/hypridle.nix Normal file → Executable file
View file

0
homes/modules/hypr/hyprland.nix Normal file → Executable file
View file

12
homes/modules/hypr/hyprlock.nix Normal file → Executable file
View file

@ -8,7 +8,7 @@
settings = {
background = {
monitor = "";
path = "$HOME/downloads/wallpaper/kill-my-first/astronaut-pink-blue.png"; # only png supported for now
path = "$HOME/downloads/wallpaper/kill-my-firstborn/astronaut-pink-blue.png"; # only png supported for now
# color = $color1
# all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations
@ -81,7 +81,7 @@
# Degrees
monitor = "";
# get temperature in Brisbane
text = ''cmd[update:18000000] echo "<b>Feels like<big> $(curl -s 'wttr.in/bne?format=%t' | tr -d '+') </big></b>"'';
text = ''cmd[update:18000000] echo "<b>Feels like $(curl -s 'wttr.in/bne?format=%t' | tr -d '+')</b>"'';
color = "rgb(255, 255, 255, 1)";
font_size = 18;
font_family = "Geist Mono 10";
@ -103,11 +103,11 @@
dots_rouding = -1;
rounding = 22;
outer_color = "rgb(255, 0, 0, 1)";
inner_color = "rgb(0, 255, 0, 1)";
font_color = "rgb(0, 0, 255, 1)";
outer_color = "rgb(0, 0, 0, 0)";
inner_color = "rgb(100, 114, 125, 0.1)";
font_color = "rgb(200, 200, 200)";
fade_on_empty = true;
placeholder_text = "!!Super Secret!!"; # Text rendered in the input box when it's empty.
placeholder_text = "<i>Password...</i>"; # Text rendered in the input box when it's empty.
position = "0, 120";
halign = "center";

0
homes/modules/kanshi.nix Normal file → Executable file
View file

0
homes/modules/nixcord.nix Normal file → Executable file
View file

0
homes/modules/rio.nix Normal file → Executable file
View file

0
homes/modules/rofi.nix Normal file → Executable file
View file

View file

@ -0,0 +1,17 @@
{...}: {
# simple fail2ban config (not production ready or anything though)
# refer to: https://nixos.wiki/wiki/Fail2Ban
services.fail2ban = {
enable = true;
maxretry = 5;
bantime = "10m"; # 10 minute ban
bantime-increment = {
enable = true;
formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)";
multipliers = "1 2 4 8 16 32 64";
maxtime = "168h"; # dont ban for more than 1 week
overalljails = true;
};
};
}

35
homes/modules/server/nginx.nix Executable file
View file

@ -0,0 +1,35 @@
{...}: {
services = {
# use nginx as the reverse proxy
# (also will use certbot and Let's Encrypt)
# refer to: https://nixos.wiki/wiki/Nginx
nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
# https://imbored.dev
virtualHosts = {
"imbored.dev" = {
forceSSL = true;
enableACME = true;
# config reverse proxy paths
locations = {
"/" = {
# TODO
proxyPass = "http://127.0.0.1:12345";
};
};
};
};
};
};
security.acme = {
acceptTerms = true;
defaults.email = "eclarkboman@gmail.com";
};
}

13
homes/modules/server/ssh.nix Executable file
View file

@ -0,0 +1,13 @@
{...}: {
services.openssh = {
enable = true;
ports = [22];
settings = {
PasswordAuthentication = true;
PermitRootLogin = "no";
AllowUsers = null; # allow all users by default
UseDns = true;
X11Forwarding = false;
};
};
}

209
homes/modules/theme.rasi Executable file
View file

@ -0,0 +1,209 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Rofi Theme File
* Rofi Version: 1.7.3
**/
/*****----- Configuration -----*****/
configuration {
modi: "drun,run,filebrowser,window";
show-icons: true;
display-drun: "APPS";
display-run: "RUN";
display-filebrowser: "FILES";
display-window: "WINDOW";
drun-display-format: "{name}";
window-format: "{w} · {c} · {t}";
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 10";
background: #11092D;
background-alt: #281657;
foreground: #FFFFFF;
selected: #DF5296;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 1000px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 15px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: horizontal;
children: [ "imagebox", "listbox" ];
}
imagebox {
padding: 20px;
background-color: transparent;
background-image: url("~/.config/rofi/images/j.jpg", height);
orientation: vertical;
children: [ "inputbar", "dummy", "mode-switcher" ];
}
listbox {
spacing: 20px;
padding: 20px;
background-color: transparent;
orientation: vertical;
children: [ "message", "listview" ];
}
dummy {
background-color: transparent;
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
padding: 15px;
border-radius: 10px;
background-color: @background-alt;
text-color: @foreground;
children: [ "textbox-prompt-colon", "entry" ];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
background-color: inherit;
text-color: inherit;
}
entry {
enabled: true;
background-color: inherit;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 20px;
background-color: transparent;
text-color: @foreground;
}
button {
padding: 15px;
border-radius: 10px;
background-color: @background-alt;
text-color: inherit;
cursor: pointer;
}
button selected {
background-color: @selected;
text-color: @foreground;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 1;
lines: 8;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 10px;
background-color: transparent;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 15px;
padding: 8px;
border-radius: 10px;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element normal.normal {
background-color: inherit;
text-color: inherit;
}
element normal.urgent {
background-color: @urgent;
text-color: @foreground;
}
element normal.active {
background-color: @active;
text-color: @foreground;
}
element selected.normal {
background-color: @selected;
text-color: @foreground;
}
element selected.urgent {
background-color: @urgent;
text-color: @foreground;
}
element selected.active {
background-color: @urgent;
text-color: @foreground;
}
element-icon {
background-color: transparent;
text-color: inherit;
size: 32px;
cursor: inherit;
}
element-text {
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
}
/*****----- Message -----*****/
message {
background-color: transparent;
}
textbox {
padding: 15px;
border-radius: 10px;
background-color: @background-alt;
text-color: @foreground;
vertical-align: 0.5;
horizontal-align: 0.0;
}
error-message {
padding: 15px;
border-radius: 20px;
background-color: @background;
text-color: @foreground;
}