Clean up and move kalle-laptop over to new layout as well
parent
04ad416f64
commit
88b125c6da
|
@ -1,46 +0,0 @@
|
|||
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(),
|
||||
})
|
||||
})
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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(),
|
||||
}),
|
||||
],
|
||||
})
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
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,
|
||||
})
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
@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;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
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),
|
||||
]
|
||||
})
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
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;
|
|
@ -1,160 +0,0 @@
|
|||
import { GTK_ALIGN_CENTER, GTK_ALIGN_FILL } from '../constants.js'
|
||||
|
||||
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) {
|
||||
const artists = player.bind("track_artists").transform(a => a.join(", "))
|
||||
|
||||
const playPause = Widget.Button({
|
||||
className: "play-pause",
|
||||
onClicked: () => player.playPause(),
|
||||
visible: player.bind("can_play"),
|
||||
child: Widget.Icon({
|
||||
icon: player.bind("play_back_status").transform(s => {
|
||||
switch (s) {
|
||||
case "Playing": return PAUSE_ICON
|
||||
case "Paused":
|
||||
case "Stopped": return PLAY_ICON
|
||||
}
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
const prev = Widget.Button({
|
||||
onClicked: () => player.previous(),
|
||||
visible: player.bind("can_go_prev"),
|
||||
child: Widget.Icon(PREV_ICON),
|
||||
})
|
||||
|
||||
const next = Widget.Button({
|
||||
onClicked: () => player.next(),
|
||||
visible: player.bind("can_go_next"),
|
||||
child: Widget.Icon(NEXT_ICON),
|
||||
})
|
||||
|
||||
const positionSlider = Widget.Slider({
|
||||
className: "position",
|
||||
drawValue: false,
|
||||
onChange: ({ value }) => player.position = value * player.length,
|
||||
visible: player.bind("length").as(l => l > 0),
|
||||
setup: self => {
|
||||
function update() {
|
||||
const value = player.position / player.length
|
||||
self.value = value > 0 ? value : 0
|
||||
}
|
||||
self.hook(player, update)
|
||||
self.hook(player, update, "position")
|
||||
self.poll(1000, update)
|
||||
},
|
||||
})
|
||||
|
||||
const positionLabel = Widget.Label({
|
||||
className: "position",
|
||||
hpack: "start",
|
||||
setup: self => {
|
||||
const update = (_, time) => {
|
||||
self.label = lengthStr(time || player.position)
|
||||
self.visible = player.length > 0
|
||||
}
|
||||
|
||||
self.hook(player, update, "position")
|
||||
self.poll(1000, update)
|
||||
},
|
||||
})
|
||||
|
||||
const lengthLabel = Widget.Label({
|
||||
className: "length",
|
||||
hpack: "end",
|
||||
visible: player.bind("length").transform(l => l > 0),
|
||||
label: player.bind("length").transform(lengthStr),
|
||||
})
|
||||
|
||||
return Widget.Overlay({
|
||||
className: "player",
|
||||
child: Widget.Box({
|
||||
className: "bg-img",
|
||||
vpack: "start",
|
||||
css: player.bind("cover_path").transform(p => `background-image: url('${p}');`),
|
||||
}),
|
||||
overlays: [
|
||||
Widget.Box({
|
||||
className: "bg-cover"
|
||||
}),
|
||||
Widget.Box({
|
||||
className: "overlay",
|
||||
vertical: true,
|
||||
halign: GTK_ALIGN_CENTER,
|
||||
children: [
|
||||
Widget.Box({
|
||||
className: "info",
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Label({ className: "title", label: player.bind("track_title") }),
|
||||
Widget.Label({ className: "album", label: player.bind("track_album") }),
|
||||
Widget.Label({ className: "artist", label: artists }),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
vexpand: true,
|
||||
}),
|
||||
Widget.CenterBox({
|
||||
className: "controls",
|
||||
startWidget: positionLabel,
|
||||
centerWidget: Widget.Box({
|
||||
halign: GTK_ALIGN_CENTER,
|
||||
spacing: 20,
|
||||
children: [
|
||||
prev,
|
||||
playPause,
|
||||
next,
|
||||
],
|
||||
}),
|
||||
endWidget: lengthLabel,
|
||||
}),
|
||||
positionSlider,
|
||||
],
|
||||
})
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
function MediaContent() {
|
||||
const currentIdx = Variable(0);
|
||||
const currentPlayer = Utils.merge([currentIdx.bind(), players], (currentIdx, players) => {
|
||||
const idx = Math.min(currentIdx, players.length - 1);
|
||||
return players[idx];
|
||||
})
|
||||
|
||||
return Widget.Box({
|
||||
children: currentPlayer.as(p => [Player(p)]),
|
||||
})
|
||||
}
|
||||
|
||||
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(),
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
.media > box {
|
||||
border-radius: 5px;
|
||||
|
||||
background-color: transparent;
|
||||
color: @ctp-text;
|
||||
}
|
||||
|
||||
.media .player .bg-img {
|
||||
border-radius: 5px;
|
||||
min-width: 400px;
|
||||
min-height: 200px;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.media .player .bg-cover {
|
||||
background: linear-gradient(alpha(@ctp-base, 0.5), @ctp-base);
|
||||
}
|
||||
|
||||
.media .player .overlay {
|
||||
border-radius: 5px;
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.media .player .info {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.media .player .controls {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.media .player .info .title {
|
||||
font-size: 1.2em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.media .player scale.position {
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.media .player scale.position trough {
|
||||
min-height: 4px;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
background-color: @ctp-overlay0;
|
||||
}
|
||||
|
||||
.media .player scale.position highlight {
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
background-color: @ctp-lavender;
|
||||
}
|
||||
|
||||
.media .player scale.position slider {
|
||||
all: unset;
|
||||
}
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
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(),
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
.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;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
@import url("colors.css");
|
||||
@import url("notifications/style.css");
|
||||
@import url("media/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;
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"lib": [
|
||||
"ES2022"
|
||||
],
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"strict": true,
|
||||
"noImplicitAny": false,
|
||||
"baseUrl": ".",
|
||||
"typeRoots": [
|
||||
"./types"
|
||||
],
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
/home/kalle/.local/share/com.github.Aylur.ags/types
|
|
@ -1,15 +0,0 @@
|
|||
{ inputs
|
||||
, lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ inputs.ags.homeManagerModules.default ];
|
||||
programs.ags = {
|
||||
enable = true;
|
||||
configDir = ./config;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
(defpoll time :interval "10s" "date '+%H:%M'")
|
||||
(defpoll year :interval "10h" "date '+%Y'")
|
||||
(defpoll date :interval "30m" "date '+%m-%d'")
|
|
@ -1,87 +0,0 @@
|
|||
(defwidget notifications []
|
||||
(eventbox :class "notifications"
|
||||
""
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget audio []
|
||||
(eventbox :class "audio"
|
||||
:onclick "eww open --toggle audio"
|
||||
""
|
||||
))
|
||||
|
||||
(defwidget clipboard []
|
||||
(eventbox :class "clipboard"
|
||||
""
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget left []
|
||||
(box :class "left"
|
||||
:space-evenly "false"
|
||||
:halign "start"
|
||||
:valign "center"
|
||||
:orientation "h"
|
||||
(notifications)
|
||||
(audio)
|
||||
(clipboard)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget workspace-indicator []
|
||||
". . . . . . . . . ."
|
||||
)
|
||||
|
||||
(defwidget center []
|
||||
(box :class "center"
|
||||
:space-evenly "false"
|
||||
:halign "center"
|
||||
:valign "center"
|
||||
:orientation "h"
|
||||
(workspace-indicator)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget time []
|
||||
(eventbox :class "time"
|
||||
time
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget date []
|
||||
(eventbox :class "date"
|
||||
"${year}-${date}"
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget right []
|
||||
(box :class "right"
|
||||
:space-evenly "false"
|
||||
:halign "end"
|
||||
:valign "center"
|
||||
:orientation "v"
|
||||
(time)
|
||||
(date)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget bar []
|
||||
(box :class "bar"
|
||||
:orientation "h"
|
||||
(left)
|
||||
(center)
|
||||
(right)
|
||||
)
|
||||
)
|
||||
|
||||
(defwindow bar
|
||||
:monitor 2
|
||||
:geometry (geometry :x "0px"
|
||||
:y "10px"
|
||||
:width "1060px"
|
||||
:height "48px"
|
||||
:anchor "center top")
|
||||
:stacking "fg"
|
||||
:exclusive true
|
||||
(bar)
|
||||
)
|
|
@ -1,2 +0,0 @@
|
|||
(include "_variables.yuck")
|
||||
(include "bar.yuck")
|
|
@ -1,14 +0,0 @@
|
|||
{ inputs
|
||||
, lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.eww = {
|
||||
enable = true;
|
||||
|
||||
configDir = ./config;
|
||||
};
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
{ inputs
|
||||
, outputs
|
||||
, lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
home = {
|
||||
username = "kalle";
|
||||
homeDirectory = "/home/kalle";
|
||||
};
|
||||
|
||||
imports =
|
||||
[
|
||||
../../nvim
|
||||
../../tmux
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
overlays = with outputs.overlays; [
|
||||
nvim-plugins
|
||||
];
|
||||
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowUnfreePredicate = _: true;
|
||||
|
||||
permittedInsecurePackages = [
|
||||
"electron-25.9.0"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# The home.packages option allows you to install Nix packages into your
|
||||
# environment.
|
||||
home.packages = with pkgs; [
|
||||
discord
|
||||
vesktop
|
||||
firefox
|
||||
chromium
|
||||
httpie
|
||||
kate
|
||||
dolphin
|
||||
ark
|
||||
rustup
|
||||
gcc
|
||||
pavucontrol
|
||||
difftastic
|
||||
sops
|
||||
obsidian
|
||||
|
||||
cachix
|
||||
];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
# Git aliases
|
||||
gg = "git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an (%ae)%C(reset)' --all";
|
||||
gca = "git add -A; git commit -a --amend --no-edit";
|
||||
gs = "git status";
|
||||
|
||||
# Replace some commands with better versions
|
||||
ssh = "kitty +kitten ssh";
|
||||
diff = "${pkgs.difftastic}/bin/difftastic";
|
||||
};
|
||||
initExtra = ''
|
||||
function open() {
|
||||
xdg-open $@ &> /dev/null &
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
theme = "Catppuccin-Mocha";
|
||||
settings = {
|
||||
background_opacity = "0.8";
|
||||
allow_remote_control = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
add_newline = true;
|
||||
|
||||
# Remove text from nix shell component
|
||||
nix_shell.format = "via [$symbol]($style) ";
|
||||
|
||||
git_status.disabled = true;
|
||||
package.disabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Kalle Struik";
|
||||
userEmail = "kalle@kallestruik.nl";
|
||||
difftastic.enable = true;
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
};
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
};
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.05"; # Please read the comment before changing.
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
do.not.rebuild = migration in progress;
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
../_base
|
||||
./hardware-configuration.nix
|
||||
|
||||
../../modules/sddm.nix
|
||||
|
||||
../../modules/bash.nix
|
||||
../../modules/kitty.nix
|
||||
../../modules/git.nix
|
||||
../../modules/direnv.nix
|
||||
../../modules/firefox.nix
|
||||
../../modules/nvim
|
||||
];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "kalle-laptop";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
xkb.layout = "us";
|
||||
xkb.options = "eurosign:e,caps:escape";
|
||||
};
|
||||
|
||||
# Disable firewall.
|
||||
networking.firewall.enable = false;
|
||||
|
||||
home-manager.users.kalle = {
|
||||
home.packages = with pkgs; [
|
||||
discord
|
||||
vesktop
|
||||
firefox
|
||||
chromium
|
||||
httpie
|
||||
kate
|
||||
dolphin
|
||||
ark
|
||||
rustup
|
||||
gcc
|
||||
pavucontrol
|
||||
difftastic
|
||||
sops
|
||||
obsidian
|
||||
|
||||
cachix
|
||||
];
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It's perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.05"; # Did you read the comment?
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.05"; # Please read the comment before changing.
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
options =
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
hyprland = {
|
||||
mod = mkOption {
|
||||
type = types.str;
|
||||
default = "SUPER";
|
||||
};
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
primaryMonitor = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
monitors = mkOption {
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
width = mkOption {
|
||||
type = types.int;
|
||||
};
|
||||
height = mkOption {
|
||||
type = types.int;
|
||||
};
|
||||
refreshRate = mkOption {
|
||||
type = types.int;
|
||||
default = 60;
|
||||
};
|
||||
x = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
y = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
transform = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
vrr = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
enabled = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
environment = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
};
|
||||
|
||||
sensitivity = mkOption {
|
||||
type = types.float;
|
||||
default = 0.0;
|
||||
};
|
||||
|
||||
keyboard = {
|
||||
layout = mkOption {
|
||||
type = types.str;
|
||||
default = "us";
|
||||
};
|
||||
|
||||
variant = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
layout = mkOption { type = types.str; };
|
||||
|
||||
layerRules = mkOption {
|
||||
type = types.attrsOf (types.listOf types.str);
|
||||
default = { };
|
||||
};
|
||||
|
||||
windowRules = mkOption {
|
||||
type = types.attrsOf (types.listOf types.str);
|
||||
default = { };
|
||||
};
|
||||
|
||||
windowRulesV2 = mkOption {
|
||||
type = types.attrsOf (types.listOf types.str);
|
||||
default = { };
|
||||
};
|
||||
|
||||
binds = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
};
|
||||
|
||||
mouseBinds = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.hyprland;
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
wl-clipboard
|
||||
cliphist
|
||||
ulauncher
|
||||
];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
settings = {
|
||||
monitor =
|
||||
map (
|
||||
m:
|
||||
let
|
||||
resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}";
|
||||
position = "${toString m.x}x${toString m.y}";
|
||||
vrr = if m.vrr != 0 then ",vrr,${toString m.vrr}" else "";
|
||||
transform = if m.transform != 0 then ",transform,${toString m.transform}" else "";
|
||||
in
|
||||
"${m.name},${if m.enabled then "${resolution},${position},1${vrr}${transform}" else "disable"}"
|
||||
) (cfg.monitors)
|
||||
# Automatically detect newly connected monitors
|
||||
++ [ ",preferred,auto,auto" ];
|
||||
|
||||
exec-once = [
|
||||
"${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store"
|
||||
"${pkgs.ulauncher}/bin/ulauncher --no-window-shadow --hide-window"
|
||||
"${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"
|
||||
# kde-connect (somehow, wasnt working well last time)
|
||||
] ++ cfg.autoStart;
|
||||
|
||||
env = lib.mapAttrsToList (k: v: "${toString k},${v}") cfg.environment;
|
||||
|
||||
input = {
|
||||
kb_layout = cfg.keyboard.layout;
|
||||
kb_variant = cfg.keyboard.variant;
|
||||
kb_options = cfg.keyboard.options;
|
||||
|
||||
follow_mouse = 1;
|
||||
|
||||
touchpad = {
|
||||
natural_scroll = "yes";
|
||||
};
|
||||
|
||||
sensitivity = cfg.sensitivity;
|
||||
accel_profile = "flat";
|
||||
};
|
||||
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 10;
|
||||
|
||||
border_size = 1;
|
||||
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
||||
"col.inactive_border" = "rgba(595959aa)";
|
||||
|
||||
layout = cfg.layout;
|
||||
};
|
||||
|
||||
misc = {
|
||||
force_default_wallpaper = 2;
|
||||
};
|
||||
|
||||
decoration = {
|
||||
rounding = 5;
|
||||
|
||||
blur = {
|
||||
enabled = "yes";
|
||||
size = 3;
|
||||
passes = 1;
|
||||
new_optimizations = "on";
|
||||
};
|
||||
|
||||
# drop_shadow = "yes";
|
||||
# shadow_range = 4;
|
||||
# shadow_render_power = 3;
|
||||
# "col.shadow" = "rgba(1a1a1aee)";
|
||||
};
|
||||
|
||||
gestures = {
|
||||
workspace_swipe = "on";
|
||||
};
|
||||
|
||||
animations = {
|
||||
enabled = "yes";
|
||||
|
||||
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||
|
||||
bezier = [
|
||||
"myBezier, 0.05, 0.9, 0.1, 1.05"
|
||||
];
|
||||
|
||||
animation = [
|
||||
"windows, 1, 3, myBezier"
|
||||
"windowsOut, 1, 3, default, popin 80%"
|
||||
"border, 1, 5, default"
|
||||
"borderangle, 1, 4, default"
|
||||
"fade, 1, 3, default"
|
||||
"workspaces, 1, 2, default"
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
layerrule =
|
||||
let
|
||||
y = ident: value: "${value},${ident}";
|
||||
x = ident: values: map (y ident) values;
|
||||
in
|
||||
lib.flatten (lib.mapAttrsToList x cfg.layerRules);
|
||||
|
||||
workspace =
|
||||
let
|
||||
# Create one work space for each non primary monitor
|
||||
perMonitorWorkspaces = map (m: "name:${m.name}, monitor:${m.name}") (
|
||||
lib.filter (m: m.name != cfg.primaryMonitor) cfg.monitors
|
||||
);
|
||||
|
||||
# Create 10 work spaces on the primary monitor
|
||||
primaryMonitorWorkspaces = map (i: "${toString i}, monitor:${cfg.primaryMonitor}") (lib.range 1 10);
|
||||
|
||||
in
|
||||
primaryMonitorWorkspaces ++ perMonitorWorkspaces;
|
||||
|
||||
bind =
|
||||
let
|
||||
# Create binds to switch workspaces and move windows between them
|
||||
workspaceBinds = lib.flatten (
|
||||
map (
|
||||
i:
|
||||
let
|
||||
k = if i == 10 then 0 else i;
|
||||
in
|
||||
[
|
||||
"${cfg.mod}, ${toString k}, workspace, ${toString i}"
|
||||
"${cfg.mod} SHIFT, ${toString k}, movetoworkspace, ${toString i}"
|
||||
]
|
||||
) (lib.range 1 10)
|
||||
);
|
||||
|
||||
# Create binds to manage wiwdows
|
||||
windowManagementBinds = [
|
||||
"${cfg.mod} SHIFT, Q, killactive"
|
||||
"${cfg.mod}, F, togglefloating"
|
||||
"${cfg.mod} SHIFT, F, fullscreen"
|
||||
];
|
||||
|
||||
configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.binds;
|
||||
in
|
||||
configBinds ++ workspaceBinds ++ windowManagementBinds;
|
||||
|
||||
bindm =
|
||||
let
|
||||
windowManagementBinds = [
|
||||
"${cfg.mod}, mouse:272, movewindow"
|
||||
"${cfg.mod}, mouse:273, resizewindow"
|
||||
];
|
||||
|
||||
configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.mouseBinds;
|
||||
|
||||
in
|
||||
configBinds ++ windowManagementBinds;
|
||||
|
||||
windowrule =
|
||||
let
|
||||
y = ident: value: "${value},${ident}";
|
||||
x = ident: values: map (y ident) values;
|
||||
in
|
||||
lib.flatten (lib.mapAttrsToList x cfg.windowRules);
|
||||
|
||||
windowrulev2 =
|
||||
let
|
||||
y = ident: value: "${value},${ident}";
|
||||
x = ident: values: map (y ident) values;
|
||||
in
|
||||
lib.flatten (lib.mapAttrsToList x cfg.windowRulesV2);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
options =
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
hyprpaper = {
|
||||
wallpaperFolder = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.hyprpaper;
|
||||
hyprlandCfg = config.hyprland;
|
||||
|
||||
changeWallpaperScript = pkgs.writeShellScriptBin "change-wallpaper" (
|
||||
lib.concatStringsSep "\n" (
|
||||
lib.flatten (
|
||||
map (
|
||||
m:
|
||||
let
|
||||
output = m.name;
|
||||
wallpaper = "\"$(${pkgs.findutils}/bin/find -L \"${cfg.wallpaperFolder}\" -type f | ${pkgs.coreutils}/bin/shuf -n 1)\"";
|
||||
in
|
||||
[
|
||||
"wallpaper=${wallpaper}"
|
||||
"${pkgs.hyprland}/bin/hyprctl hyprpaper preload $wallpaper"
|
||||
"${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ${output},$wallpaper"
|
||||
]
|
||||
) hyprlandCfg.monitors
|
||||
)
|
||||
++ [ "${pkgs.hyprland}/bin/hyprctl hyprpaper unload all" ]
|
||||
)
|
||||
);
|
||||
in
|
||||
{
|
||||
hyprland.autoStart = [
|
||||
"${pkgs.hyprpaper}/bin/hyprpaper"
|
||||
"sleep 2; ${changeWallpaperScript}/bin/change-wallpaper"
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
hyprpaper
|
||||
changeWallpaperScript
|
||||
];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
...
|
||||
}:
|
||||
{
|
||||
services.xserver.desktopManager.plasma6.enable = true;
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
{ inputs
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
nix.settings = {
|
||||
# Enable flakes and new 'nix' command
|
||||
experimental-features = "nix-command flakes";
|
||||
# Deduplicate and optimize nix store
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "kalle-laptop";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true; # use xkbOptions in tty.
|
||||
};
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
displayManager.sddm.enable = true;
|
||||
desktopManager.plasma6.enable = true;
|
||||
|
||||
# Configure keymap in X11
|
||||
xkb = {
|
||||
layout = "us";
|
||||
options = "eurosign:e,caps:escape";
|
||||
};
|
||||
};
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
services.printing.enable = true;
|
||||
|
||||
# Enable sound.
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
jack.enable = true;
|
||||
};
|
||||
|
||||
users.users.kalle = {
|
||||
isNormalUser = true;
|
||||
group = "kalle";
|
||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
};
|
||||
|
||||
users.groups.kalle.gid = 1000;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
xdg-user-dirs
|
||||
];
|
||||
|
||||
fonts = {
|
||||
enableDefaultPackages = true;
|
||||
packages = with pkgs; [
|
||||
noto-fonts
|
||||
noto-fonts-cjk
|
||||
noto-fonts-color-emoji
|
||||
|
||||
fira-code
|
||||
fira-code-symbols
|
||||
|
||||
(nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
|
||||
];
|
||||
|
||||
fontconfig = {
|
||||
defaultFonts = {
|
||||
serif = [ "Noto Serif" "Symbols Nerd Font" ];
|
||||
sansSerif = [ "Noto Sans" "Symbols Nerd Font" ];
|
||||
monospace = [ "Fira Code" "Symbols Nerd Font Mono" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Disable firewall.
|
||||
networking.firewall.enable = false;
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It's perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.05"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
still.migrating = do not rebuild this;
|
||||
|
||||
}
|
136
nvim/default.nix
136
nvim/default.nix
|
@ -1,136 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.neovim =
|
||||
let
|
||||
toLua = str: "lua << EOF\n${str}\nEOF\n";
|
||||
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
nodejs_22 # Required for copilot-vim
|
||||
ripgrep # Required for telescope
|
||||
wl-clipboard # Required for clipboard sync
|
||||
|
||||
# Language servers
|
||||
clang-tools
|
||||
lua-language-server
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages."@astrojs/language-server"
|
||||
typescript
|
||||
tailwindcss-language-server
|
||||
gopls
|
||||
vhdl-ls
|
||||
nixd
|
||||
nixfmt-rfc-style
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
yuck-vim
|
||||
|
||||
{
|
||||
plugin = which-key-nvim;
|
||||
config = toLua "require('which-key').setup()";
|
||||
}
|
||||
|
||||
neodev-nvim
|
||||
plenary-nvim
|
||||
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
config = toLuaFile ./plugin/telescope.lua;
|
||||
}
|
||||
telescope-ui-select-nvim
|
||||
|
||||
FTerm-nvim
|
||||
|
||||
vim-fugitive
|
||||
|
||||
harpoon1
|
||||
|
||||
{
|
||||
plugin = undotree-nvim;
|
||||
config = toLua "require('undotree').setup()";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = comment-nvim;
|
||||
config = toLua "require('Comment').setup()";
|
||||
}
|
||||
{
|
||||
plugin = todo-comments-nvim;
|
||||
config = toLua "require('todo-comments').setup()";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = neoconf-nvim;
|
||||
config = toLua "require('neoconf').setup()";
|
||||
}
|
||||
{
|
||||
plugin = catppuccin-nvim;
|
||||
config = "colorscheme catppuccin-mocha";
|
||||
}
|
||||
|
||||
cmp-nvim-lsp
|
||||
cmp-nvim-lsp-signature-help
|
||||
cmp-buffer
|
||||
cmp-path
|
||||
cmp-cmdline
|
||||
cmp-git
|
||||
cmp-calc
|
||||
cmp_luasnip
|
||||
copilot-cmp
|
||||
luasnip
|
||||
friendly-snippets
|
||||
{
|
||||
plugin = nvim-cmp;
|
||||
config = toLuaFile ./plugin/cmp.lua;
|
||||
}
|
||||
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
config = toLuaFile ./plugin/lsp.lua;
|
||||
}
|
||||
rust-tools-nvim
|
||||
{
|
||||
plugin = fidget-nvim;
|
||||
config = toLua "require('fidget').setup({})";
|
||||
}
|
||||
|
||||
rainbow-delimiters-nvim
|
||||
|
||||
{
|
||||
plugin = (nvim-treesitter.withAllGrammars);
|
||||
config = toLuaFile ./plugin/treesitter.lua;
|
||||
}
|
||||
|
||||
{
|
||||
plugin = copilot-lua;
|
||||
config = toLua ''
|
||||
require("copilot").setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraLuaConfig = ''
|
||||
${builtins.readFile ./options.lua}
|
||||
${builtins.readFile ./keymaps.lua}
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
---@diagnostic disable: redefined-local
|
||||
|
||||
local function map(mode, keys, func, desc, silent)
|
||||
local silent = silent == nil and true or silent
|
||||
vim.keymap.set(mode, keys, func, { desc = desc, silent = silent })
|
||||
end
|
||||
|
||||
-- Movement between windows
|
||||
map('n', '<leader>h', function() vim.cmd.wincmd('h') end, "Window Left")
|
||||
map('n', '<leader>j', function() vim.cmd.wincmd('j') end, "Window Down")
|
||||
map('n', '<leader>k', function() vim.cmd.wincmd('k') end, "Window Up")
|
||||
map('n', '<leader>l', function() vim.cmd.wincmd('l') end, "Window Right")
|
||||
|
||||
-- Harpoon keybinds
|
||||
map('n', '<leader>mm', require('harpoon.mark').add_file, "[M]ark file in harpoon")
|
||||
map('n', '<leader>mh', require('harpoon.ui').toggle_quick_menu, "[M]enu [H]arpoon")
|
||||
map('n', '<leader>1', function() require('harpoon.ui').nav_file(1) end, "Harpoon [1]")
|
||||
map('n', '<leader>2', function() require('harpoon.ui').nav_file(2) end, "Harpoon [2]")
|
||||
map('n', '<leader>3', function() require('harpoon.ui').nav_file(3) end, "Harpoon [3]")
|
||||
map('n', '<leader>4', function() require('harpoon.ui').nav_file(4) end, "Harpoon [4]")
|
||||
map('n', '<leader>5', function() require('harpoon.ui').nav_file(5) end, "Harpoon [5]")
|
||||
map('n', '<leader>6', function() require('harpoon.ui').nav_file(6) end, "Harpoon [6]")
|
||||
map('n', '<leader>7', function() require('harpoon.ui').nav_file(7) end, "Harpoon [7]")
|
||||
map('n', '<leader>8', function() require('harpoon.ui').nav_file(8) end, "Harpoon [8]")
|
||||
map('n', '<leader>9', function() require('harpoon.ui').nav_file(9) end, "Harpoon [9]")
|
||||
|
||||
map('n', '<leader>tg', vim.cmd.Neogit, '[T]oggle [G]it view')
|
||||
map('n', '<leader>tu', require('undotree').toggle, '[T]oggle [U]ndo tree')
|
||||
|
||||
map('n', '[d', vim.diagnostic.goto_prev, 'Goto Previous Diagnostic')
|
||||
map('n', ']d', vim.diagnostic.goto_next, 'Goto Next Diagnostic')
|
||||
map('n', '<leader>e', vim.diagnostic.open_float, 'Show [E]rrors')
|
||||
map('n', '<leader>q', vim.diagnostic.setloclist, 'Errors to [Q]uickfix')
|
||||
|
||||
|
||||
map('n', '<leader>?', require('telescope.builtin').oldfiles, '[?] Find recently opened files')
|
||||
map('n', '<leader><space>', require('telescope.builtin').find_files, '[ ]Search Files')
|
||||
map('n', '<leader>sb', require('telescope.builtin').buffers, '[S]earch [B]uffers')
|
||||
map('n', '<leader>sh', require('telescope.builtin').help_tags, '[S]earch [H]elp')
|
||||
map('n', '<leader>sw', require('telescope.builtin').grep_string, '[S]earch current [W]ord')
|
||||
map('n', '<leader>sg', require('telescope.builtin').live_grep, '[S]earch by [G]rep')
|
||||
map('n', '<leader>sd', require('telescope.builtin').diagnostics, '[S]earch [D]iagnostics')
|
||||
|
||||
map({ 'n', 't' }, '<A-t>', require("FTerm").toggle, 'Toggle Terminal')
|
|
@ -1,41 +0,0 @@
|
|||
vim.opt.termguicolors = true
|
||||
vim.opt.clipboard = 'unnamed,unnamedplus'
|
||||
vim.opt.timeoutlen = 300
|
||||
vim.opt.mouse = 'a'
|
||||
vim.opt.listchars = 'tab:▸ ,extends:❯,precedes:❮'
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = vim.fn.expand('~/.cache/vim/undo')
|
||||
vim.opt.undofile = true
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.list = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.modeline = true
|
||||
|
||||
vim.opt.spell = true
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
vim.opt.updatetime = 50
|
||||
vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert' }
|
||||
vim.opt.shortmess = vim.opt.shortmess + { c = true }
|
||||
|
||||
-- Autoformat on save
|
||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
|
@ -1,102 +0,0 @@
|
|||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
require("copilot_cmp").setup()
|
||||
|
||||
local has_words_before = function()
|
||||
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Add tab support
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() and has_words_before() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
})
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "copilot", group_index = 2 },
|
||||
{ name = 'path' }, -- file paths
|
||||
{ name = 'nvim_lsp' }, -- from language server
|
||||
{ name = 'nvim_lsp_signature_help' }, -- display function signatures with current parameter emphasized
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lua' }, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||
{ name = 'buffer' }, -- source current buffer
|
||||
{ name = 'calc' }, -- source for math calculation
|
||||
}),
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'menu', 'abbr', 'kind' },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
vsnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
|
@ -1,172 +0,0 @@
|
|||
local on_attach = function(_, bufnr)
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format()
|
||||
elseif vim.lsp.buf.formatting then
|
||||
vim.lsp.buf.formatting()
|
||||
end
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
|
||||
-- LSP Diagnostics Options Setup
|
||||
local sign = function(opts)
|
||||
vim.fn.sign_define(opts.name, {
|
||||
texthl = opts.name,
|
||||
text = opts.text,
|
||||
numhl = ''
|
||||
})
|
||||
end
|
||||
|
||||
sign({ name = 'DiagnosticSignError', text = '' })
|
||||
sign({ name = 'DiagnosticSignWarn', text = '' })
|
||||
sign({ name = 'DiagnosticSignHint', text = '' })
|
||||
sign({ name = 'DiagnosticSignInfo', text = '' })
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = false,
|
||||
float = {
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||
]])
|
||||
|
||||
-- LSP Configuration
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
require('neodev').setup({
|
||||
override = function(root_dir, library)
|
||||
if root_dir:find("/home/kalle/.dots", 1, true) == 1 then
|
||||
library.enabled = true
|
||||
library.plugins = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require('lspconfig').lua_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
cmd = { "lua-language-server" },
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
require('lspconfig').nixd.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
nixd = {
|
||||
formatting = {
|
||||
command = { "nixfmt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require('lspconfig').tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
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 {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('lspconfig').clangd.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('lspconfig').gopls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('lspconfig').vhdl_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('lspconfig').astro.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
require('rust-tools').setup({
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy"
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
-- Workaround for https://github.com/neovim/neovim/issues/30985
|
||||
for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
|
||||
local default_diagnostic_handler = vim.lsp.handlers[method]
|
||||
vim.lsp.handlers[method] = function(err, result, context, config)
|
||||
if err ~= nil and err.code == -32802 then
|
||||
return
|
||||
end
|
||||
return default_diagnostic_handler(err, result, context, config)
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("telescope").load_extension("ui-select")
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
|
@ -1,9 +0,0 @@
|
|||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = {},
|
||||
|
||||
auto_install = false,
|
||||
|
||||
highlight = { enable = true },
|
||||
|
||||
indent = { enable = true },
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{ inputs
|
||||
, lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
keyMode = "vi";
|
||||
mouse = true;
|
||||
baseIndex = 1;
|
||||
escapeTime = 20;
|
||||
terminal = "tmux-256color";
|
||||
historyLimit = 100000;
|
||||
plugins = with pkgs.tmuxPlugins;
|
||||
[
|
||||
better-mouse-mode
|
||||
catppuccin
|
||||
];
|
||||
extraConfig = ''
|
||||
# Use catppuccin-mocha theme.
|
||||
set -g @catppuccin_flavour 'mocha'
|
||||
# Other catppuccin settigns.
|
||||
set -g @catppuccin_window_default_text "#{window_name}"
|
||||
|
||||
# Don't leave gaps inDon't leave gaps in window numbers.
|
||||
set -g renumber-windows on
|
||||
|
||||
# Vim keys for pane navigation.
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue