This commit is contained in:
Hadi
2024-06-14 10:00:54 +02:00
parent 70a3473916
commit aae1271cf0
117 changed files with 616 additions and 1461 deletions

View File

@@ -0,0 +1,263 @@
{ config, ... }: {
imports = [ ./duckduckgo-colorscheme.nix ./homepage ];
programs.qutebrowser = {
enable = true;
searchEngines = {
"DEFAULT" = "https://duckduckgo.com/?q={}&ia=web";
"d" = "https://duckduckgo.com/?q={}&ia=web";
"g" = "https://google.com/search?q={}";
"y" = "https://youtube.com/results?search_query={}";
"ya" = "https://yandex.com/search/?text={}";
"n" = "https://mynixos.com/search?q={}";
"nixo" = "https://search.nixos.org/options?channel=unstable&query={}";
"nixp" = "https://search.nixos.org/packages?channel=unstable&query={}";
"gt" = "https://github.com/search?q={}&type=repositories";
};
quickmarks = {
home = "${config.var.homeDirectory}/.config/startpage/index.html";
server = "${config.var.homeDirectory}/.config/serverpage/index.html";
mynixos = "https://mynixos.com";
github = "https://github.com";
outlook = "https://outlook.office.com/mail/";
office = "https://www.office.com/?auth=2";
teams = "https://teams.microsoft.com/_";
casa = "http://192.168.2.16:8081/#/";
proton = "https://mail.proton.me/u/0/inbox";
cloudflare-one = "https://one.dash.cloudflare.com/";
chatgpt = "https://chat.openai.com/";
nixvim = "https://nix-community.github.io/nixvim/";
hyprland = "https://wiki.hyprland.org/";
nerdfont = "https://www.nerdfonts.com/cheat-sheet";
youtube = "https://youtube.com/";
cloudflare = "https://dash.cloudflare.com/";
};
settings = {
url = {
default_page =
"${config.var.homeDirectory}/.config/startpage/index.html";
start_pages =
[ "${config.var.homeDirectory}/.config/startpage/index.html" ];
};
colors = {
tabs = {
odd.bg = "#${config.var.theme.colors.bg}";
odd.fg = "#${config.var.theme.colors.fg}";
even.bg = "#${config.var.theme.colors.bg}";
even.fg = "#${config.var.theme.colors.fg}";
selected = {
odd = {
bg = "#${config.var.theme.colors.accent}";
fg = "#${config.var.theme.colors.accentFg}";
};
even = {
bg = "#${config.var.theme.colors.accent}";
fg = "#${config.var.theme.colors.accentFg}";
};
};
indicator = {
error = "#${config.var.theme.colors.c1}";
start = "#${config.var.theme.colors.bgalt}";
stop = "#${config.var.theme.colors.bgalt}";
};
};
hints = {
bg = "#${config.var.theme.colors.bgalt}";
fg = "#${config.var.theme.colors.fgalt}";
match.fg = "#${config.var.theme.colors.bg}";
};
completion = {
category = {
bg = "#${config.var.theme.colors.bg}";
fg = "#${config.var.theme.colors.fg}";
border = {
top = "#${config.var.theme.colors.bg}";
bottom = "#${config.var.theme.colors.bg}";
};
};
odd.bg = "#${config.var.theme.colors.bg}";
even.bg = "#${config.var.theme.colors.bg}";
fg = [ "#FFFFFF" "#FFFFFF" "#FFFFFF" ];
match.fg = "#${config.var.theme.colors.accent}";
item.selected = {
bg = "#${config.var.theme.colors.accent}";
border.top = "#${config.var.theme.colors.accent}";
border.bottom = "#${config.var.theme.colors.accent}";
fg = "#${config.var.theme.colors.accentFg}";
match.fg = "#${config.var.theme.colors.accentFg}";
};
};
statusbar = {
normal.bg = "#${config.var.theme.colors.bg}";
normal.fg = "#${config.var.theme.colors.fg}";
private.bg = "#${config.var.theme.colors.bg}";
private.fg = "#${config.var.theme.colors.fg}";
insert.bg = "#${config.var.theme.colors.accent}";
insert.fg = "#${config.var.theme.colors.accentFg}";
command = {
bg = "#${config.var.theme.colors.bgalt}";
fg = "#${config.var.theme.colors.fgalt}";
private.bg = "#${config.var.theme.colors.bgalt}";
private.fg = "#${config.var.theme.colors.fgalt}";
};
};
messages = {
info = {
bg = "#${config.var.theme.colors.bgalt}";
fg = "#${config.var.theme.colors.fgalt}";
border = "#${config.var.theme.colors.bgalt}";
};
error = {
bg = "#${config.var.theme.colors.c1}";
fg = "#${config.var.theme.colors.fgalt}";
border = "#${config.var.theme.colors.c1}";
};
};
#webpage.darkmode.enabled = true; # Enable dark mode for all websites (Weird on images)
webpage.preferred_color_scheme =
"dark"; # Enable dark mode for websites that support it
};
fonts = { default_family = "${config.var.theme.font}"; };
completion = {
height = "30%";
open_categories = [ "history" ];
scrollbar = {
padding = 0;
width = 0;
};
show = "always";
shrink = true;
timestamp_format = "";
web_history.max_items = 7;
};
content = {
autoplay = false;
javascript.clipboard = "access";
javascript.enabled = true;
pdfjs = true;
};
downloads = {
position = "bottom";
remove_finished = 0;
};
hints = {
border = "none";
radius = 1;
};
scrolling = {
bar = "never";
smooth = true;
};
tabs = {
show = "multiple";
last_close = "close";
mode_on_change = "restore";
close_mouse_button = "right";
};
zoom.default = "100%";
qt.force_software_rendering = "chromium";
};
keyBindings = {
normal = {
"gh" = "open ${config.var.homeDirectory}/.config/startpage/index.html";
"gs" = "open ${config.var.homeDirectory}/.config/serverpage/index.html";
" p" = "tab-move -";
" n" = "tab-move +";
" w" = "tab-close";
" 1" = "tab-focus 1";
" 2" = "tab-focus 2";
" 3" = "tab-focus 3";
" 4" = "tab-focus 4";
" 5" = "tab-focus 5";
" 6" = "tab-focus 6";
" 7" = "tab-focus 7";
" 8" = "tab-focus 8";
" 9" = "tab-focus 9";
" 0" = "tab-focus 10";
"<Ctrl-w>" = "tab-close";
"<Ctrl-n>" = "open -w";
"<Ctrl-1>" = "tab-focus 1";
"<Ctrl-2>" = "tab-focus 2";
"<Ctrl-3>" = "tab-focus 3";
"<Ctrl-4>" = "tab-focus 4";
"<Ctrl-5>" = "tab-focus 5";
"<Ctrl-6>" = "tab-focus 6";
"<Ctrl-7>" = "tab-focus 7";
"<Ctrl-8>" = "tab-focus 8";
"<Ctrl-9>" = "tab-focus 9";
"<Ctrl-0>" = "tab-focus 10";
};
command = {
"<Ctrl-w>" = "tab-close";
"<Ctrl-n>" = "open -w";
"<Ctrl-1>" = "tab-focus 1";
"<Ctrl-2>" = "tab-focus 2";
"<Ctrl-3>" = "tab-focus 3";
"<Ctrl-4>" = "tab-focus 4";
"<Ctrl-5>" = "tab-focus 5";
"<Ctrl-6>" = "tab-focus 6";
"<Ctrl-7>" = "tab-focus 7";
"<Ctrl-8>" = "tab-focus 8";
"<Ctrl-9>" = "tab-focus 9";
"<Ctrl-0>" = "tab-focus 10";
};
insert = {
"<Ctrl-w>" = "tab-close";
"<Ctrl-n>" = "open -w";
"<Ctrl-1>" = "tab-focus 1";
"<Ctrl-2>" = "tab-focus 2";
"<Ctrl-3>" = "tab-focus 3";
"<Ctrl-4>" = "tab-focus 4";
"<Ctrl-5>" = "tab-focus 5";
"<Ctrl-6>" = "tab-focus 6";
"<Ctrl-7>" = "tab-focus 7";
"<Ctrl-8>" = "tab-focus 8";
"<Ctrl-9>" = "tab-focus 9";
"<Ctrl-0>" = "tab-focus 10";
};
};
extraConfig = ''
config.unbind("gm")
config.unbind("gd")
config.unbind("gb")
config.unbind("tl")
config.unbind("gt")
c.tabs.padding = {"bottom": 6, "left": 7, "right": 7, "top": 6}
config.load_autoconfig(True)
'';
};
}

View File

@@ -0,0 +1,37 @@
{ config, ... }: {
xdg.configFile."duckduckgo-colorscheme.js".text = ''
// Go to DuckDuckGo settings page, open the console, paste the code and hit enter.
// based on https://ddg.codingcodax.dev/
// Cookies string for your theme
const cookie = '7=${config.var.theme.colors.bg}; j=${config.var.theme.colors.bg}; 9=${config.var.theme.colors.fg}; aa=${config.var.theme.colors.fgalt}; 8=${config.var.theme.colors.c7}; x=${config.var.theme.colors.accent}; 21=${config.var.theme.colors.bgalt};';
// Converts cookie string into formatted JSON
const cookieToJSON = (cookieRaw) => {
const cookieJson = {};
const items = cookieRaw.split(/[ ,]+/);
items.forEach((item) => {
const parts = item.split('=');
cookieJson[parts[0]] = parts[1];
});
return cookieJson;
};
// Iterates over JSON, and adds to browser cookie store
const setCookies = (cookieJson) => {
Object.keys(cookieJson).forEach((key) => {
document.cookie = `''${key}=''${cookieJson [ key ]}`;
});
};
alert('The Nixy theme will be applied.');
// Call set cookies, passing in formated cookie data
setCookies(cookieToJSON(cookie));
// All done, reload page for changes to take effect :)
location.reload();
'';
}

View File

@@ -0,0 +1,297 @@
{ config, ... }:
let
bookmarks = ''
Bookmarks: [
{text: "MyNixOs", url: "https://mynixos.com", icon: "󱄅"},
{text: "Github", url: "https://github.com", icon: ""},
{text: "Proton", url: "https://mail.proton.me/u/0/inbox", icon: ""},
{text: "Cloudflare One", url: "https://one.dash.cloudflare.com/", icon: ""},
{text: "Chat GPT", url: "https://chat.openai.com/", icon: "󰭹"},
{text: "Nixvim", url: "https://nix-community.github.io/nixvim/", icon: ""},
{text: "Hyprland Wiki", url: "https://wiki.hyprland.org/", icon: "󰖬"},
{text: "Nerdfont", url: "https://www.nerdfonts.com/cheat-sheet", icon: ""},
{text: "Youtube", url: "https://youtube.com", icon: "󰗃"},
],
Home: [
{text: "Casa", url: "http://192.168.2.16:8081/#/", icon: "󰋜"},
{text: "Plex", url: "http://192.168.2.16:32400", icon: "󰚺"},
{text: "Nextcloud", url: "http://192.168.2.16:10081", icon: ""},
],
Work: [
{text: "Outlook", url: "https://outlook.office.com/mail/", icon: "󰴢"},
{text: "Office", url: "https://www.office.com/?auth=2", icon: "󰏆"},
{text: "Teams", url: "https://teams.microsoft.com/_", icon: "󰊻"},
],
'';
in {
xdg.configFile."startpage/index.html".text = ''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Homepage</title>
<style>
h1,
h2,
h3,
p {
margin: 0;
padding: 0;
font-family: '${config.var.theme.font}', sans-serif;
}
.w-screen {
width: 100vw;
}
.overflow-hidden {
overflow: hidden;
}
.max-w-7xl {
max-width: 80rem;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
}
.justify-between {
justify-content: space-between;
}
.items-center {
align-items: center;
}
.py-12 {
padding-top: 3rem;
padding-bottom: 3rem;
}
.px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.text-5xl {
font-size: 3rem;
line-height: 1;
}
.font-bold {
font-weight: 700;
}
.mb-4 {
margin-bottom: 1rem;
}
.flex {
display: flex;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-col {
flex-direction: column;
}
.flex-grow {
flex-grow: 1;
}
.gap-5 {
gap: 1.25rem;
}
.gap-05 {
gap: 0.125rem;
}
.justify-start {
justify-content: flex-start;
}
.items-start {
align-items: flex-start;
}
.hover\:opacity-60:hover {
opacity: 0.6;
}
.pb-10 {
padding-bottom: 2.5rem;
}
.p-10 {
padding: 2.5rem;
}
.text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
.text-sm {
font-size: 0.875rem;
line-height: 1.25rem;
}
.text-4xl {
font-size: 2.25rem;
line-height: 2.5rem;
}
.px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
}
.py-2 {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
a {
text-decoration: none;
}
a, a:visited, a:hover, a:active {
color: inherit;
}
</style>
</head>
<body class="w-screen" style="background-color: #${config.var.theme.colors.bg}; color: #${config.var.theme.colors.fg};">
<div class="max-w-7xl mx-auto p-10">
<div class="w-full flex justify-between" id="date-time">
<p class="text-xl"></p>
<p class="text-xl"></p>
</div>
<div class="w-full py-12 px-2" id="greeting">
<h1 class="text-5xl font-bold mb-4" style="color: #${config.var.theme.colors.accent};"></h1>
</div>
<div id="link-list" class="flex gap-5 flex-col justify-start items-start"></div>
</div>
<script defer>
const linkLists = {
${bookmarks}
};
function getDomainFromUrl(url) {
let domain = url.replace(/(^\w+:|^)\/\//, "");
domain = domain.split('/')[0];
return domain;
}
const linkListContainer = document.getElementById('link-list');
for (const key in linkLists) {
if (Object.hasOwnProperty.call(linkLists, key)) {
const linkList = linkLists[key];
const title = document.createElement('h2');
title.textContent = key.charAt(0).toUpperCase() + key.slice(1);
title.className = "text-3xl font-bold"
linkListContainer.appendChild(title);
const list = document.createElement('div');
list.className = 'flex flex-wrap gap-5 justify-start';
linkList.forEach(link => {
const anchor = document.createElement('a');
anchor.href = link.url;
anchor.className = "px-5 py-2 hover:opacity-60 flex-grow"
const div = document.createElement('div');
div.className = 'flex flex-row gap-5 items-center';
let icon = document.createElement('p');
icon.textContent = link.icon || "";
icon.className = "text-4xl";
div.appendChild(icon);
const divNameUrl = document.createElement('div');
divNameUrl.className = 'flex flex-col gap-05';
const name = document.createElement('p');
name.textContent = link.text;
name.className = 'text-lg font-medium';
const url = document.createElement('p');
url.textContent = link.url;
url.className = 'text-sm';
url.style = "color: #${config.var.theme.colors.fgalt};"
divNameUrl.appendChild(name);
divNameUrl.appendChild(url);
div.appendChild(divNameUrl);
anchor.appendChild(div);
list.appendChild(anchor);
});
linkListContainer.appendChild(list);
const spacer = document.createElement('div');
spacer.className = "pb-10"
linkListContainer.appendChild(spacer);
}
}
function updateDateTime() {
const dateTimeContainer = document.getElementById('date-time');
const currentDate = new Date();
const dateOptions = {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'};
const timeOptions = {hour: '2-digit', minute: '2-digit'};
const formattedDate = currentDate.toLocaleDateString('en-US', dateOptions);
const formattedTime = currentDate.toLocaleTimeString('en-US', timeOptions);
const dateParagraph = dateTimeContainer.querySelector('p:nth-child(1)');
const timeParagraph = dateTimeContainer.querySelector('p:nth-child(2)');
dateParagraph.textContent = formattedDate;
timeParagraph.textContent = formattedTime;
}
updateDateTime();
setInterval(updateDateTime, 60000);
function updateGreeting() {
const greetingContainer = document.getElementById('greeting');
const currentDate = new Date();
const currentHour = currentDate.getHours();
let greetingText;
if (currentHour < 2) {
greetingText = "Good night! ";
} else if (currentHour < 5) {
greetingText = "Hello, night owl! 󰏒";
} else if (currentHour < 12) {
greetingText = "Good morning! ";
} else if (currentHour < 17) {
greetingText = "Good afternoon! ";
} else if (currentHour < 20) {
greetingText = "Good evening! ";
} else {
greetingText = "Good night! ";
}
const greetingHeader = greetingContainer.querySelector('h1');
greetingHeader.textContent = greetingText;
}
updateGreeting();
</script>
</body>
</html>
'';
}