Work on AGS

main
kalle 2024-07-25 19:29:32 +02:00
parent 693057fd48
commit 73d50fe80f
21 changed files with 772 additions and 233 deletions

46
ags/config/bar/Bar.js Normal file
View File

@ -0,0 +1,46 @@
import { GTK_ALIGN_CENTER, GTK_ALIGN_END, GTK_ALIGN_START } from "../constants.js"
import { Clock } from "./Clock.js"
import { SysTray } from "./Systray.js"
function BarStart() {
return Widget.Box({
halign: GTK_ALIGN_START,
children: [
Widget.Label({ label: "Start" }),
Widget.Button({ label: "Button", onClicked: () => App.ToggleWindow("media2") }),
],
})
}
function BarCenter() {
return Widget.Box({
halign: GTK_ALIGN_CENTER,
children: [
Clock(),
],
})
}
function BarEnd() {
return Widget.Box({
halign: GTK_ALIGN_END,
children: [
SysTray(),
],
})
}
export function Bar(monitor = 0) {
return Widget.Window({
monitor,
exclusivity: "exclusive",
className: "bar",
margins: [5, 5, 0, 5],
name: `bar${monitor}`,
anchor: ["left", "top", "right"],
child: Widget.CenterBox({
vertical: false,
startWidget: BarStart(),
centerWidget: BarCenter(),
endWidget: BarEnd(),
})
})
}

24
ags/config/bar/Clock.js Normal file
View File

@ -0,0 +1,24 @@
const time = Variable("", {
poll: [1000, 'date "+%H:%M"'],
})
const date = Variable("", {
poll: [1000, 'date "+%Y-%m-%d"'],
})
export function Clock() {
return Widget.Box({
className: "clock",
vertical: true,
children: [
Widget.Label({
className: "time",
label: time.bind(),
}),
Widget.Label({
className: "date",
label: date.bind(),
}),
],
})
}

16
ags/config/bar/Systray.js Normal file
View File

@ -0,0 +1,16 @@
const systemtray = await Service.import("systemtray")
export function SysTray() {
const items = systemtray.bind("items")
.as(items => items.map(item => Widget.Button({
child: Widget.Icon({ icon: item.bind("icon") }),
on_primary_click: (_, event) => item.activate(event),
on_secondary_click: (_, event) => item.openMenu(event),
tooltip_markup: item.bind("tooltip_markup"),
})))
return Widget.Box({
className: "systray",
children: items,
})
}

35
ags/config/colors.css Normal file
View File

@ -0,0 +1,35 @@
@define-color ctp-rosewater #f5e0dc;
@define-color ctp-flamingo #f2cdcd;
@define-color ctp-pink #f5c2e7;
@define-color ctp-mauve #cba6f7;
@define-color ctp-red #f38ba8;
@define-color ctp-maroon #eba0ac;
@define-color ctp-peach #fab387;
@define-color ctp-yellow #f9e2af;
@define-color ctp-green #a6e3a1;
@define-color ctp-teal #94e2d5;
@define-color ctp-sky #89dceb;
@define-color ctp-sapphire #74c7ec;
@define-color ctp-blue #89b4fa;
@define-color ctp-lavender #b4befe;
@define-color ctp-text #cdd6f4;
@define-color ctp-subtext1 #bac2de;
@define-color ctp-subtext0 #a6adc8;
@define-color ctp-overlay2 #9399b2;
@define-color ctp-overlay1 #7f849c;
@define-color ctp-overlay0 #6c7086;
@define-color ctp-surface2 #585b70;
@define-color ctp-surface1 #45475a;
@define-color ctp-surface0 #313244;
@define-color ctp-base #1e1e2e;
@define-color ctp-mantle #181825;
@define-color ctp-crust #11111b;
button {
background: @ctp-surface0;
border: none;
}
button:active, button:hover, button:focus {
background: @ctp-surface1;
}

14
ags/config/config.js Normal file
View File

@ -0,0 +1,14 @@
import { Media } from "./media/Media.js";
import { Bar } from "./bar/Bar.js";
import { Notifications } from "./notifications/Notifications.js";
App.config({
style: "./style.css",
windows: [
Bar(2),
Media(2),
Notifications(2),
]
})

5
ags/config/constants.js Normal file
View File

@ -0,0 +1,5 @@
export const GTK_ALIGN_FILL = 0;
export const GTK_ALIGN_START = 1;
export const GTK_ALIGN_END = 2;
export const GTK_ALIGN_CENTER = 3;
export const GTK_ALIGN_BASELINE = 4;

50
ags/config/media/Media.js Normal file
View File

@ -0,0 +1,50 @@
const mpris = await Service.import("mpris")
const players = mpris.bind("players")
const FALLBACK_ICON = "audio-x-generic-symbolic"
const PLAY_ICON = "media-playback-start-symbolic"
const PAUSE_ICON = "media-playback-pause-symbolic"
const PREV_ICON = "media-skip-backward-symbolic"
const NEXT_ICON = "media-skip-forward-symbolic"
/** @param {number} length */
function lengthStr(length) {
const min = Math.floor(length / 60)
const sec = Math.floor(length % 60)
const sec0 = sec < 10 ? "0" : ""
return `${min}:${sec0}${sec}`
}
/** @param {import('types/service/mpris').MprisPlayer} player */
function Player(player) {
return Widget.Label({ label: `${player.name}: ${player.cover_path}` })
// return Widget.Overlay({
// child: Widget.Box({
// class_name: "img",
// vpack: "start",
// css: player.bind("cover_path").transform(p => `background-image: url('${p}');`),
// }),
// overlays: [
// Widget.Label({ label: player.name }),
// ],
// })
}
function MediaContent() {
return Widget.Box({
children: players.as(p => p.map(Player)),
})
}
export function Media(monitor = 0) {
return Widget.Window({
monitor,
visible: false,
exclusivity: "normal",
className: "media",
margins: [10, 10, 0, 10],
name: `media${monitor}`,
anchor: ["left", "top"],
child: MediaContent(),
})
}

View File

@ -0,0 +1,129 @@
const notifications = await Service.import("notifications")
/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
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),
})
}
/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
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,
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 content = Widget.Box({
className: "content",
children: [
icon,
Widget.Box({
vertical: true,
children: [
title,
body,
]
}),
],
})
const actions = Widget.Box({
className: "actions",
children: n.actions.map(({ id, label }) => Widget.Button({
className: "action",
on_clicked: () => {
n.invoke(id)
n.dismiss()
},
hexpand: true,
child: Widget.Label(label),
})),
})
return Widget.EventBox({
attribute: { id: n.id },
onPrimaryClick: n.dismiss,
child: Widget.Box({
classNames: ["notification", n.urgency],
vertical: true,
children: [
content,
actions,
],
}),
})
}
function NotificationList() {
const list = Widget.Box({
css: "min-width: 2px; min-height: 2px;",
vertical: true,
spacing: 10,
children: notifications.popups.map(Notification),
})
function onNotified(_, /** @type {number} */ id) {
const n = notifications.getNotification(id)
if (n)
list.children = [Notification(n), ...list.children]
}
function onDismissed(_, /** @type {number} */ id) {
list.children.find(n => n.attribute.id === id)?.destroy()
}
list.hook(notifications, onNotified, "notified")
.hook(notifications, onDismissed, "dismissed")
return list
}
export function Notifications(monitor = 0) {
return Widget.Window({
monitor,
exclusivity: "normal",
className: "notifications",
margins: [10, 10, 10, 10],
name: `notifications${monitor}`,
anchor: ["left", "top"],
child: NotificationList(),
})
}

View File

@ -0,0 +1,59 @@
.notification {
min-width: 300px;
padding: 10px;
background-color: alpha(@ctp-base, 0.7);
border-radius: 5px;
border: 1px solid;
border-left: 5px solid;
border-color: @ctp-overlay1;
}
.notification.low {
border-color: @ctp-base;
}
.notification.critical {
border-color: @ctp-red;
}
.notification .icon {
min-width: 68px;
min-height: 68px;
margin-right: 1em;
}
.notification .icon image {
font-size: 58px;
/* to center the icon */
margin: 5px;
color: @ctp-text;
}
.notification .icon box {
min-width: 68px;
min-height: 68px;
border-radius: 7px;
}
.notification .actions .action {
margin: 0 .4em;
margin-top: .8em;
}
.notification .actions .action:first-child {
margin-left: 0;
}
.notification .actions .action:last-child {
margin-right: 0;
}
.notification .title {
color: @ctp-text;
font-size: 1.4em;
}
.notification .body {
color: @ctp-subtext0;
}

29
ags/config/style.css Normal file
View File

@ -0,0 +1,29 @@
@import url("colors.css");
@import url("notifications/style.css");
.bar > box {
padding: 10px;
border-radius: 5px;
background-color: alpha(@ctp-base, 0.95);
color: @ctp-text;
}
.clock .time {
font-weight: bold;
font-size: 1em;
}
.clock .date {
font-size: 0.8em;
}
.media > box {
padding: 10px;
border-radius: 5px;
background-color: alpha(@ctp-base, 0.95);
color: @ctp-text;
}

18
ags/config/tsconfig.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"lib": [
"ES2022"
],
"allowJs": true,
"checkJs": true,
"strict": true,
"noImplicitAny": false,
"baseUrl": ".",
"typeRoots": [
"./types"
],
"skipLibCheck": true
}
}

1
ags/config/types Symbolic link
View File

@ -0,0 +1 @@
/home/kalle/.local/share/com.github.Aylur.ags/types

15
ags/default.nix Normal file
View File

@ -0,0 +1,15 @@
{ inputs
, lib
, config
, pkgs
, ...
}:
{
imports = [ inputs.ags.homeManagerModules.default ];
programs.ags = {
enable = true;
configDir = ./config;
};
}

View File

@ -8,7 +8,6 @@
{ {
programs.eww = { programs.eww = {
enable = true; enable = true;
package = pkgs.eww-wayland;
configDir = ./config; configDir = ./config;
}; };

View File

@ -1,5 +1,59 @@
{ {
"nodes": { "nodes": {
"ags": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1721306136,
"narHash": "sha256-VKPsIGf3/a+RONBipx4lEE4LXG2sdMNkWQu22LNQItg=",
"owner": "Aylur",
"repo": "ags",
"rev": "344ea72cd3b8d4911f362fec34bce7d8fb37028c",
"type": "github"
},
"original": {
"owner": "Aylur",
"repo": "ags",
"type": "github"
}
},
"aquamarine": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1721571743,
"narHash": "sha256-hat7wggtDISBJD8kTo5MTrT+IsY/Ha2MwgjmqqijoCA=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "601f6cf95cbe4fef02dc7faf34bba58566c914e9",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "aquamarine",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -7,11 +61,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1708988456, "lastModified": 1721534365,
"narHash": "sha256-RCz7Xe64tN2zgWk+MVHkzg224znwqknJ1RnB7rVqUWw=", "narHash": "sha256-XpZOkaSJKdOsz1wU6JfO59Rx2fqtcarQ0y6ndIOKNpI=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1d085ea4444d26aa52297758b333b449b2aa6fca", "rev": "635563f245309ef5320f80c7ebcb89b2398d2949",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -21,23 +75,79 @@
"type": "github" "type": "github"
} }
}, },
"hyprland-protocols": { "hyprcursor": {
"inputs": { "inputs": {
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [ "nixpkgs": [
"xdg-desktop-portal-hyprland", "hyprland",
"nixpkgs" "nixpkgs"
], ],
"systems": [ "systems": [
"xdg-desktop-portal-hyprland", "hyprland",
"systems" "systems"
] ]
}, },
"locked": { "locked": {
"lastModified": 1691753796, "lastModified": 1721330371,
"narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", "narHash": "sha256-aYlHTWylczLt6ERJyg6E66Y/XSCbVL7leVcRuJmVbpI=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "4493a972b48f9c3014befbbf381ed5fff91a65dc",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprcursor",
"type": "github"
}
},
"hyprland": {
"inputs": {
"aquamarine": "aquamarine",
"hyprcursor": "hyprcursor",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs",
"systems": "systems_2",
"xdph": "xdph"
},
"locked": {
"lastModified": 1721668777,
"narHash": "sha256-QNKSZDkZ5+0a+g0wZoZfcWuH1Fy3ZvIeKg0grNdwnHc=",
"owner": "hyprwm",
"repo": "hyprland",
"rev": "4c3b03516209a49244a8f044143c1162752b8a7a",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"xdph",
"nixpkgs"
],
"systems": [
"hyprland",
"xdph",
"systems"
]
},
"locked": {
"lastModified": 1718746314,
"narHash": "sha256-HUklK5u86w2Yh9dOkk4FdsL8eehcOZ95jPhLixGDRQY=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprland-protocols", "repo": "hyprland-protocols",
"rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", "rev": "1b61f0093afff20ab44d88ad707aed8bf2215290",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -48,18 +158,25 @@
}, },
"hyprlang": { "hyprlang": {
"inputs": { "inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [ "nixpkgs": [
"xdg-desktop-portal-hyprland", "hyprland",
"nixpkgs" "nixpkgs"
], ],
"systems": "systems" "systems": [
"hyprland",
"systems"
]
}, },
"locked": { "locked": {
"lastModified": 1708681732, "lastModified": 1721324361,
"narHash": "sha256-ULZZLZ9C33G13IaXLuAc4oTzHUvnATI8Fj2u6gzMfT0=", "narHash": "sha256-BiJKO0IIdnSwHQBSrEJlKlFr753urkLE48wtt0UhNG4=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprlang", "repo": "hyprlang",
"rev": "f4466367ef0a92a6425d482050dc2b8840c0e644", "rev": "adbefbf49664a6c2c8bf36b6487fd31e3eb68086",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,13 +185,79 @@
"type": "github" "type": "github"
} }
}, },
"hyprutils": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1721324102,
"narHash": "sha256-WAZ0X6yJW1hFG6otkHBfyJDKRpNP5stsRqdEuHrFRpk=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "962582a090bc233c4de9d9897f46794280288989",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"hyprwayland-scanner": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1721324119,
"narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1709150264, "lastModified": 1721379653,
"narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", "narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1721379653,
"narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", "rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -103,11 +286,11 @@
"plugin-rainbow-delimiters-nvim": { "plugin-rainbow-delimiters-nvim": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1709163331, "lastModified": 1720388982,
"narHash": "sha256-QETHqUrqY9acAUxRgROGI3Qopy+P6tW36uVqHCemj10=", "narHash": "sha256-6+MSV9pkudhf/xVdofU6syYCzViHltvDWkYvbeuEfLs=",
"owner": "HiPhish", "owner": "HiPhish",
"repo": "rainbow-delimiters.nvim", "repo": "rainbow-delimiters.nvim",
"rev": "4902de74335ba0c4816cb67c5d5052c0c5fc7e56", "rev": "b29da4a6061a88270e875b38367d82c04c856128",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@ -134,12 +317,13 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"ags": "ags",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "hyprland": "hyprland",
"nixpkgs": "nixpkgs_2",
"plugin-harpoon1": "plugin-harpoon1", "plugin-harpoon1": "plugin-harpoon1",
"plugin-rainbow-delimiters-nvim": "plugin-rainbow-delimiters-nvim", "plugin-rainbow-delimiters-nvim": "plugin-rainbow-delimiters-nvim",
"plugin-undotree-nvim": "plugin-undotree-nvim", "plugin-undotree-nvim": "plugin-undotree-nvim"
"xdg-desktop-portal-hyprland": "xdg-desktop-portal-hyprland"
} }
}, },
"systems": { "systems": {
@ -172,21 +356,28 @@
"type": "github" "type": "github"
} }
}, },
"xdg-desktop-portal-hyprland": { "xdph": {
"inputs": { "inputs": {
"hyprland-protocols": "hyprland-protocols", "hyprland-protocols": "hyprland-protocols",
"hyprlang": "hyprlang", "hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [ "nixpkgs": [
"hyprland",
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_2" "systems": [
"hyprland",
"systems"
]
}, },
"locked": { "locked": {
"lastModified": 1708954916, "lastModified": 1721648131,
"narHash": "sha256-GUbIMXUrcb6Pxmz9lQ3j6XMFLsQaSwTvViNKYNSMdd0=", "narHash": "sha256-cyyxu/oj4QEFp3CVx2WeXa9T4OAUyynuBJHGkBZSxJI=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "15fd76cb6ebb0e3c3b2c3a3daf452e7b781c6e8a", "rev": "663be9cad424b170b28b9fa8a61042d721007f3b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -9,6 +9,10 @@
home-manager.url = "github:nix-community/home-manager/master"; home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
# AGS
ags.url = "github:Aylur/ags";
ags.inputs.nixpkgs.follows = "nixpkgs";
# Neovim plugins not in nixpkgs # Neovim plugins not in nixpkgs
plugin-rainbow-delimiters-nvim.url = "gitlab:HiPhish/rainbow-delimiters.nvim"; plugin-rainbow-delimiters-nvim.url = "gitlab:HiPhish/rainbow-delimiters.nvim";
plugin-rainbow-delimiters-nvim.flake = false; plugin-rainbow-delimiters-nvim.flake = false;
@ -19,10 +23,7 @@
plugin-harpoon1.url = "github:ThePrimeagen/harpoon"; plugin-harpoon1.url = "github:ThePrimeagen/harpoon";
plugin-harpoon1.flake = false; plugin-harpoon1.flake = false;
# Track hyprland xdg desktop portal master until screenshots get released again hyprland.url = "github:hyprwm/hyprland";
xdg-desktop-portal-hyprland.url = "github:hyprwm/xdg-desktop-portal-hyprland";
xdg-desktop-portal-hyprland.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs =

View File

@ -19,6 +19,7 @@
../../eww ../../eww
../../hyprland ../../hyprland
../../hyprland/hyprpaper.nix ../../hyprland/hyprpaper.nix
../../ags
]; ];
hyprland = hyprland =
@ -28,7 +29,6 @@
mod = mod; mod = mod;
primaryMonitor = "DP-2"; primaryMonitor = "DP-2";
monitors = [ monitors = [
{ {
name = "DP-2"; name = "DP-2";
@ -72,27 +72,11 @@
sensitivity = 0.1; sensitivity = 0.1;
keyboard = {
layout = "us";
variant = "";
options = "";
};
inner_gaps = 5;
outer_gaps = 10;
border = {
size = 1;
active = "rgba(33ccffee) rgba(00ff99ee) 45deg";
inactive = "rgba(595959aa)";
};
layout = "dwindle"; layout = "dwindle";
rounding = 5;
layerRules = { layerRules = {
"gtk-layer-shell" = [ "blur" "ignorezero" ]; "gtk-layer-shell" = [ "blur" "ignorezero" ];
"notifications2" = [ "noanim" "blur" "ignorezero"];
}; };
windowRules = { windowRules = {
@ -257,7 +241,11 @@
pavucontrol pavucontrol
difftastic difftastic
sops sops
obsidian (obsidian.override {
electron = pkgs.electron_29-bin;
})
unzip
vlc
cachix cachix
]; ];
@ -265,14 +253,34 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
gtk = { gtk = {
enable = true;
theme = { theme = {
package = pkgs.libsForQt5.breeze-gtk; name = "Adwaita-dark";
name = "Breeze-Dark"; package = pkgs.gnome-themes-extra;
}; };
iconTheme = { iconTheme = {
package = pkgs.libsForQt5.breeze-icons;
name = "breeze-dark"; name = "breeze-dark";
package = pkgs.kdePackages.breeze-icons;
};
cursorTheme = {
name = "breeze_cursors";
package = pkgs.libsForQt5.breeze-qt5;
};
};
qt = {
enable = true;
style.name = "breeze-dark";
};
dconf = {
enable = true;
settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
}; };
}; };
@ -286,7 +294,7 @@
# Replace some commands with better versions # Replace some commands with better versions
ssh = "kitty +kitten ssh"; ssh = "kitty +kitten ssh";
diff = "${pkgs.difftastic}/bin/difftastic"; diff = "${pkgs.difftastic}/bin/difft";
}; };
initExtra = '' initExtra = ''
function open() { function open() {
@ -301,6 +309,7 @@
settings = { settings = {
background_opacity = "0.8"; background_opacity = "0.8";
allow_remote_control = true; allow_remote_control = true;
enable_audio_bell = false;
}; };
}; };

View File

@ -85,7 +85,7 @@
variant = mkOption { variant = mkOption {
type = types.str; type = types.str;
default = "qwerty"; default = "";
}; };
options = mkOption { options = mkOption {
@ -94,101 +94,7 @@
}; };
}; };
inner_gaps = mkOption { type = types.int; };
outer_gaps = mkOption { type = types.int; };
border = {
size = mkOption { type = types.int; };
active = mkOption { type = types.str; };
inactive = mkOption { type = types.str; };
};
animations = {
enable = mkOption {
type = types.bool;
default = true;
};
beziers = mkOption {
type = types.listOf types.str;
default = [
"myBezier, 0.05, 0.9, 0.1, 1.05"
];
};
windows = mkOption {
type = types.str;
default = "1, 3, myBezier";
};
windowsOut = mkOption {
type = types.str;
default = "1, 3, default, popin 80%";
};
border = mkOption {
type = types.str;
default = "1, 5, default";
};
borderangle = mkOption {
type = types.str;
default = "1, 4, default";
};
fade = mkOption {
type = types.str;
default = "1, 3, default";
};
workspaces = mkOption {
type = types.str;
default = "1, 2, default";
};
};
layout = mkOption { type = types.str; }; layout = mkOption { type = types.str; };
rounding = mkOption { type = types.int; };
blur = {
enable = mkOption {
type = types.bool;
default = true;
};
size = mkOption {
type = types.int;
default = 3;
};
passes = mkOption {
type = types.int;
default = 1;
};
};
shadow = {
enable = mkOption {
type = types.bool;
default = true;
};
range = mkOption {
type = types.int;
default = 4;
};
strength = mkOption {
type = types.int;
default = 3;
};
color = mkOption {
type = types.str;
default = "rgba(1a1a1aee)";
};
};
layerRules = mkOption { layerRules = mkOption {
type = types.attrsOf (types.listOf types.str); type = types.attrsOf (types.listOf types.str);
@ -205,16 +111,6 @@
default = { }; default = { };
}; };
generateWorkspaceBinds = mkOption {
type = types.bool;
default = true;
};
generateWindowManagementBinds = mkOption {
type = types.bool;
default = true;
};
binds = mkOption { binds = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
@ -280,12 +176,12 @@
}; };
general = { general = {
gaps_in = cfg.inner_gaps; gaps_in = 5;
gaps_out = cfg.outer_gaps; gaps_out = 10;
border_size = cfg.border.size; border_size = 1;
"col.active_border" = cfg.border.active; "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = cfg.border.inactive; "col.inactive_border" = "rgba(595959aa)";
layout = cfg.layout; layout = cfg.layout;
}; };
@ -295,28 +191,19 @@
}; };
decoration = { decoration = {
rounding = cfg.rounding; rounding = 5;
blur = { blur = {
enabled = if cfg.blur.enable then "yes" else "no"; enabled = "yes";
size = cfg.blur.size; size = 3;
passes = cfg.blur.passes; passes = 1;
new_optimizations = "on"; new_optimizations = "on";
}; };
drop_shadow = if cfg.shadow.enable then "yes" else "no"; drop_shadow = "yes";
shadow_range = cfg.shadow.range; shadow_range = 4;
shadow_render_power = cfg.shadow.strength; shadow_render_power = 3;
"col.shadow" = cfg.shadow.color; "col.shadow" = "rgba(1a1a1aee)";
};
dwindle = {
pseudotile = "yes";
preserve_split = "yes";
};
master = {
new_is_master = true;
}; };
gestures = { gestures = {
@ -324,19 +211,21 @@
}; };
animations = { animations = {
enabled = if cfg.animations.enable then "yes" else "no"; enabled = "yes";
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = cfg.animations.beziers; bezier = [
"myBezier, 0.05, 0.9, 0.1, 1.05"
];
animation = [ animation = [
"windows, ${cfg.animations.windows}" "windows, 1, 3, myBezier"
"windowsOut, ${cfg.animations.windowsOut}" "windowsOut, 1, 3, default, popin 80%"
"border, ${cfg.animations.border}" "border, 1, 5, default"
"borderangle, ${cfg.animations.borderangle}" "borderangle, 1, 4, default"
"fade, ${cfg.animations.fade}" "fade, 1, 3, default"
"workspaces, ${cfg.animations.workspaces}" "workspaces, 1, 2, default"
]; ];
}; };
@ -352,7 +241,7 @@
let let
# Create one work space for each non primary monitor # Create one work space for each non primary monitor
perMonitorWorkspaces = map perMonitorWorkspaces = map
(m: "${m.name}, name:${m.name}") (m: "name:${m.name}, monitor:${m.name}")
(lib.filter (lib.filter
(m: m.name != cfg.primaryMonitor) (m: m.name != cfg.primaryMonitor)
cfg.monitors cfg.monitors
@ -368,7 +257,6 @@
let let
# Create binds to switch workspaces and move windows between them # Create binds to switch workspaces and move windows between them
workspaceBinds = workspaceBinds =
if cfg.generateWorkspaceBinds then
lib.flatten lib.flatten
(map (map
(i: (i:
@ -381,19 +269,14 @@
] ]
) )
(lib.range 1 10) (lib.range 1 10)
) );
else
[ ];
# Create binds to manage wiwdows # Create binds to manage wiwdows
windowManagementBinds = windowManagementBinds = [
if cfg.generateWindowManagementBinds then [
"${cfg.mod} SHIFT, Q, killactive" "${cfg.mod} SHIFT, Q, killactive"
"${cfg.mod}, F, togglefloating" "${cfg.mod}, F, togglefloating"
"${cfg.mod} SHIFT, F, fullscreen" "${cfg.mod} SHIFT, F, fullscreen"
] ];
else
[ ];
configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.binds; configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.binds;
in in
@ -401,13 +284,10 @@
bindm = bindm =
let let
windowManagementBinds = windowManagementBinds = [
if cfg.generateWindowManagementBinds then [
"${cfg.mod}, mouse:272, movewindow" "${cfg.mod}, mouse:272, movewindow"
"${cfg.mod}, mouse:273, resizewindow" "${cfg.mod}, mouse:273, resizewindow"
] ];
else
[ ];
configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.mouseBinds; configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.mouseBinds;

View File

@ -17,6 +17,10 @@
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";
# Deduplicate and optimize nix store # Deduplicate and optimize nix store
auto-optimise-store = true; auto-optimise-store = true;
# Allow me to use cachix
trusted-users = [ "root" "kalle" ];
substituters = ["https://hyprland.cachix.org"];
trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
}; };
services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.enable = true;
@ -42,15 +46,10 @@
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.displayManager.sddm.enable = true;
services.xserver = { services.xserver = {
enable = true; enable = true;
displayManager.sddm.enable = true;
# Configure keymap in X11
xkb.layout = "us"; xkb.layout = "us";
# xkbVariant = "dvorak";
# xkbOptions = "eurosign:e,caps:escape";
}; };
# Allow flashing ZSA keyboards # Allow flashing ZSA keyboards
@ -58,7 +57,7 @@
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
portalPackage = inputs.xdg-desktop-portal-hyprland.packages.x86_64-linux.xdg-desktop-portal-hyprland; # package = inputs.hyprland.packages.x86_64-linux.hyprland;
}; };
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
@ -138,6 +137,8 @@
}; };
}; };
services.gvfs.enable = true;
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; services.openssh.enable = true;

View File

@ -19,16 +19,19 @@
vimdiffAlias = true; vimdiffAlias = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
nodejs_21 # Required for copilot-vim nodejs_22 # Required for copilot-vim
ripgrep # Required for telescope ripgrep # Required for telescope
wl-clipboard # Required for clipboard sync wl-clipboard # Required for clipboard sync
# Language servers # Language servers
clang-tools clang-tools
lua-language-server lua-language-server
rnix-lsp
nodePackages.typescript-language-server nodePackages.typescript-language-server
typescript
tailwindcss-language-server tailwindcss-language-server
gopls
vhdl-ls
nixd
]; ];
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
@ -93,7 +96,6 @@
config = toLuaFile ./plugin/cmp.lua; config = toLuaFile ./plugin/cmp.lua;
} }
{ {
plugin = nvim-lspconfig; plugin = nvim-lspconfig;
config = toLuaFile ./plugin/lsp.lua; config = toLuaFile ./plugin/lsp.lua;

View File

@ -100,7 +100,7 @@ require('lspconfig').lua_ls.setup {
} }
} }
require('lspconfig').rnix.setup { require('lspconfig').nixd.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
} }
@ -108,6 +108,11 @@ require('lspconfig').rnix.setup {
require('lspconfig').tsserver.setup { require('lspconfig').tsserver.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
init_options = {
tsserver = {
fallbackPath = string.gsub(vim.fn.system("dirname `which tsserver`"), '^%s*(.-)%s*$', '%1') .. "/../lib/node_modules/typescript/lib",
},
},
} }
require('lspconfig').tailwindcss.setup { require('lspconfig').tailwindcss.setup {
@ -120,6 +125,16 @@ require('lspconfig').clangd.setup {
capabilities = capabilities, capabilities = capabilities,
} }
require('lspconfig').gopls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
require('lspconfig').vhdl_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
require('rust-tools').setup({ require('rust-tools').setup({
server = { server = {
on_attach = on_attach, on_attach = on_attach,