Compare commits

...

10 commits

Author SHA1 Message Date
joygnu 9820c97317 opsi 2024-07-03 11:59:44 +02:00
joygnu abf6f524f6 opsi 2024-07-03 11:59:04 +02:00
joygnu b075447810 wallpaper 2024-07-02 23:52:12 +02:00
joygnu 0f48884f73 hy 2024-07-02 22:38:45 +02:00
joygnu e3a6f94173 ags 2024-07-02 22:37:09 +02:00
joygnu 38cc3dd067 update 2024-07-02 22:18:06 +02:00
joygnu 62cdc53859 update 2024-07-02 22:11:44 +02:00
joygnu 8f0091cd64 update 2024-07-02 22:10:44 +02:00
joygnu 51559a0f75 update 2024-07-02 18:00:01 +02:00
joygnu 1829dfa128 update 2024-07-02 12:38:34 +02:00
14 changed files with 467 additions and 346 deletions

View file

@ -1,5 +1,23 @@
{
"nodes": {
"ags": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1718921313,
"narHash": "sha256-TFJah1RW5qnYW7kajjAFPAS5j/0q0R3vz9zPjrRA0Mc=",
"owner": "Aylur",
"repo": "ags",
"rev": "646d5ad073ff7f8b1d50cfbd40f5b8a250fcd59d",
"type": "github"
},
"original": {
"owner": "Aylur",
"repo": "ags",
"type": "github"
}
},
"base16-schemes": {
"flake": false,
"locked": {
@ -23,11 +41,11 @@
]
},
"locked": {
"lastModified": 1719677234,
"narHash": "sha256-qO9WZsj/0E6zcK4Ht1y/iJ8XfwbBzq7xdqhBh44OP/M=",
"lastModified": 1719827439,
"narHash": "sha256-tneHOIv1lEavZ0vQ+rgz67LPNCgOZVByYki3OkSshFU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "36317d4d38887f7629876b0e43c8d9593c5cc48d",
"rev": "59ce796b2563e19821361abbe2067c3bb4143a7d",
"type": "github"
},
"original": {
@ -57,15 +75,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1719816714,
"narHash": "sha256-X+uZMLQB5I+oGKJ/Hmp75usklZi95xdsSTuJMWlirOc=",
"owner": "nixos",
"lastModified": 1718714799,
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0ae8fa2d995b5a928597485d5e1989c9817107de",
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
"type": "github"
},
"original": {
"owner": "nixos",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -85,11 +104,27 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1719915469,
"narHash": "sha256-dNQPEges+os5o3SpV3gkIJk2wNX+eIzv6D48S3WxBRo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "88d829e52cfbeee71d81704ce28f5b439f6dea16",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"ags": "ags",
"home-manager": "home-manager",
"nix-colors": "nix-colors",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs_2"
}
}
},

View file

@ -4,6 +4,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
nix-colors.url = "github:misterio77/nix-colors";
ags.url = "github:Aylur/ags";
home-manager = {
url = "github:nix-community/home-manager";

219
home/ags/config.js Normal file
View file

@ -0,0 +1,219 @@
const hyprland = await Service.import("hyprland")
const notifications = await Service.import("notifications")
const mpris = await Service.import("mpris")
const audio = await Service.import("audio")
const battery = await Service.import("battery")
const systemtray = await Service.import("systemtray")
const date = Variable("", {
poll: [1000, 'date "+%H:%M:%S %b %e."'],
})
// widgets can be only assigned as a child in one container
// so to make a reuseable widget, make it a function
// then you can simply instantiate one by calling it
function Workspaces() {
const activeId = hyprland.active.workspace.bind("id")
const workspaces = hyprland.bind("workspaces")
.as(ws => ws.map(({ id }) => Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`),
class_name: activeId.as(i => `${i === id ? "focused" : ""}`),
})))
return Widget.Box({
class_name: "workspaces",
children: workspaces,
})
}
function ClientTitle() {
return Widget.Label({
class_name: "client-title",
label: hyprland.active.client.bind("title"),
})
}
function Clock() {
return Widget.Label({
class_name: "clock",
label: date.bind(),
})
}
// we don't need dunst or any other notification daemon
// because the Notifications module is a notification daemon itself
function Notification() {
const popups = notifications.bind("popups")
return Widget.Box({
class_name: "notification",
visible: popups.as(p => p.length > 0),
children: [
Widget.Icon({
icon: "preferences-system-notifications-symbolic",
}),
Widget.Label({
label: popups.as(p => p[0]?.summary || ""),
}),
],
})
}
function Media() {
const label = Utils.watch("", mpris, "player-changed", () => {
if (mpris.players[0]) {
const { track_artists, track_title } = mpris.players[0]
return `${track_artists.join(", ")} - ${track_title}`
} else {
return "Nothing is playing"
}
})
return Widget.Button({
class_name: "media",
on_primary_click: () => mpris.getPlayer("")?.playPause(),
on_scroll_up: () => mpris.getPlayer("")?.next(),
on_scroll_down: () => mpris.getPlayer("")?.previous(),
child: Widget.Label({ label }),
})
}
function Volume() {
const icons = {
101: "overamplified",
67: "high",
34: "medium",
1: "low",
0: "muted",
}
function getIcon() {
const icon = audio.speaker.is_muted ? 0 : [101, 67, 34, 1, 0].find(
threshold => threshold <= audio.speaker.volume * 100)
return `audio-volume-${icons[icon]}-symbolic`
}
const icon = Widget.Icon({
icon: Utils.watch(getIcon(), audio.speaker, getIcon),
})
const slider = Widget.Slider({
hexpand: true,
draw_value: false,
on_change: ({ value }) => audio.speaker.volume = value,
setup: self => self.hook(audio.speaker, () => {
self.value = audio.speaker.volume || 0
}),
})
return Widget.Box({
class_name: "volume",
css: "min-width: 180px",
children: [icon, slider],
})
}
function BatteryLabel() {
const value = battery.bind("percent").as(p => p > 0 ? p / 100 : 0)
const icon = battery.bind("percent").as(p =>
`battery-level-${Math.floor(p / 10) * 10}-symbolic`)
return Widget.Box({
class_name: "battery",
visible: battery.bind("available"),
children: [
Widget.Icon({ icon }),
Widget.LevelBar({
widthRequest: 140,
vpack: "center",
value,
}),
],
})
}
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({
children: items,
})
}
// layout of the bar
function Left() {
return Widget.Box({
spacing: 8,
children: [
Workspaces(),
ClientTitle(),
],
})
}
function Center() {
return Widget.Box({
spacing: 8,
children: [
Media(),
Notification(),
],
})
}
function Right() {
return Widget.Box({
hpack: "end",
spacing: 8,
children: [
Volume(),
BatteryLabel(),
Clock(),
SysTray(),
],
})
}
function Bar(monitor = 0) {
return Widget.Window({
name: `bar-${monitor}`, // name has to be unique
class_name: "bar",
monitor,
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: Left(),
center_widget: Center(),
end_widget: Right(),
}),
})
}
App.config({
style: "./style.css",
windows: [
Bar(),
// you can call it, for each monitor
// Bar(0),
// Bar(1)
],
})
export { }

8
home/ags/default.nix Normal file
View file

@ -0,0 +1,8 @@
{pkgs, ...}:
{
programs.ags = {
enable = true;
};
}

40
home/ags/style.css Normal file
View file

@ -0,0 +1,40 @@
window.bar {
background-color: @theme_bg_color;
color: @theme_fg_color;
}
button {
min-width: 0;
padding-top: 0;
padding-bottom: 0;
background-color: transparent;
}
button:active {
background-color: @theme_selected_bg_color;
}
button:hover {
border-bottom: 3px solid @theme_fg_color;
}
label {
font-weight: bold;
}
.workspaces button.focused {
border-bottom: 3px solid @theme_selected_bg_color;
}
.client-title {
color: @theme_selected_bg_color;
}
.notification {
color: yellow;
}
levelbar block,
highlight {
min-height: 10px;
}

18
home/ags/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
home/ags/types Symbolic link
View file

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

View file

@ -3,13 +3,14 @@
{
imports = [
./rofi
./waybar
./alacritty
./hyprland
./zsh
./gtk
./git
./ags
inputs.nix-colors.homeManagerModules.default
inputs.ags.homeManagerModules.default
];
home.username = "joy";
@ -20,7 +21,6 @@
EDITOR = "vim";
};
colorScheme = inputs.nix-colors.colorSchemes.gruvbox-dark-medium;
}

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }:
{
{ config, lib, pkgs, ... }: {
home.packages = with pkgs; [
rofi-wayland
pavucontrol
@ -19,7 +18,6 @@
settings = {
"$mod" = "SUPER";
dwindle = {
pseudotile = true;
preserve_split = true;
@ -36,10 +34,10 @@
"lxqt-policykit-agent &"
"swww init &"
"swww img ~/nix/home/hyprland/wallpaper.png &"
"waybar &"
"ags -c ~/nix/home/ags/config.js &"
"wl-paste --type text --watch cliphist store"
"wl-paste --type image --watch cliphist store"
"sh cmus.sh"
"screen -dmS cmus cmus &"
];
@ -50,6 +48,7 @@
"$mod, E, exec, nemo"
"$mod, S, exec, brave"
"$mod, X, exec, keepassxc"
"$mod, D, exec, alacritty -e screen -r cmus"
"$mod, F, exec, freetube"
"$mod, M, exec, thunderbird"
"$mod, C, exec, hyprpicker -a"
@ -67,21 +66,33 @@
"$mod+shift, Y, exec, systemctl suspend"
"$mod+shift, M, exit, hyprland"
# mocp
# cmus
"$mod, P, exec, cmus-remote --pause"
"$mod, comma, exec, cmus-remote --next"
"$mod, period, exec, cmus-remote --prev"
"$mod, comma, exec, cmus-remote --prev"
"$mod, period, exec, cmus-remote --next"
"$mod, equal, exec, cmus-remote -v +5%"
"$mod, minus, exec, cmus-remote -v -5%"
# Move focus with mainMod + arrow keys
# Move focus
"$mod, Return, fullscreen"
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
# Switch workspaces with mainMod + [0-9]
# Window resizing X Y
"CTRL+SHIFT, left, resizeactive, -60 0"
"CTRL+SHIFT, right, resizeactive, 60 0"
"CTRL+SHIFT, up, resizeactive, 0 -60"
"CTRL+SHIFT, down, resizeactive, 0 60"
# Moving windows
"$mod SHIFT, left, swapwindow, l"
"$mod SHIFT, right, swapwindow, r"
"$mod SHIFT, up, swapwindow, u"
"$mod SHIFT, down, swapwindow, d"
# Switch workspaces
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
@ -93,7 +104,7 @@
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
# Move active window to a workspace with mainMod + SHIFT + [0-9]
# Move active window to a workspace
"$mod+Shift, 1, movetoworkspace, 1"
"$mod+Shift, 2, movetoworkspace, 2"
"$mod+Shift, 3, movetoworkspace, 3"
@ -112,9 +123,11 @@
];
general = {
gaps_in = 1;
gaps_out = 1;
border_size = 2;
gaps_in = 0;
gaps_out = 0;
border_size = 3;
"col.active_border" = "0xFFEBDBB2";
"col.inactive_border" = "0xFF363537";
allow_tearing = false;
layout = "dwindle";
};
@ -134,7 +147,13 @@
kb_options = "grp:alt_shift_toggle";
};
animations = {
enabled = false;
};
};
};
};
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 KiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View file

@ -1,220 +0,0 @@
{
pkgs,
config,
...
}: let
workspaces = {
};
mainWaybarConfig = {
mod = "dock";
layer = "top";
gtk-layer-shell = true;
height = 14;
position = "top";
modules-left = ["hyprland/workspaces"];
modules-center = ["clock"];
modules-right = [
"pulseaudio"
"tray"
];
"wlr/workspaces" = workspaces;
"hyprland/workspaces" = workspaces;
clock = {
actions = {
on-click-backward = "tz_down";
on-click-forward = "tz_up";
on-click-right = "mode";
on-scroll-down = "shift_down";
on-scroll-up = "shift_up";
};
};
pulseaudio = {
format = "{icon} {volume}%";
on-click = "pavucontrol";
format-icons = {
default = ["" "" ""];
};
};
tray = {
icon-size = 15;
spacing = 5;
};
};
css = ''
/* -----------------------------------------------------
* General
* ----------------------------------------------------- */
* {
font-size: 16px;
font-family: Ubuntu Nerd Font, Font Awesome, sans-serif;
font-weight: bold;
}
window#waybar {
background-color: rgba(26,27,38,0.4);
border-bottom: 1px solid rgba(26,27,38,0);
border-radius: 0px;
color: #f8f8f2;
}
/* -----------------------------------------------------
* Workspaces
* ----------------------------------------------------- */
#workspaces {
background: #fb4934;
margin: 5px 3px 5px 12px;
padding: 0px 1px;
border-radius: 15px;
border: 0px;
font-style: normal;
color: #15161e;
}
#workspaces button {
padding: 0px 5px;
margin: 4px 3px;
border-radius: 15px;
border: 0px;
color: #15161e;
background-color: #fb4934;
opacity: 0.5;
transition: all 0.3s ease-in-out;
}
#workspaces button.active {
color: #15161e;
background: #fb4934;
border-radius: 15px;
min-width: 40px;
transition: all 0.3s ease-in-out;
opacity: 1.0;
}
#workspaces button:hover {
color: #15161e;
background: #fb4934;
border-radius: 15px;
opacity: 1.0;
}
/* -----------------------------------------------------
* Tooltips
* ----------------------------------------------------- */
tooltip {
background: #282828;
border: 1px solid #282828;
border-radius: 10px;
}
tooltip label {
color: #15161e;
}
/* -----------------------------------------------------
* Window
* ----------------------------------------------------- */
#window {
color: #15161e;
background: #8ec07c;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#custom-packages {
color: #15161e;
background: #f7768e;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#memory {
color: #15161e;
background: #e0af68;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#clock {
color: #15161e;
background: #fabd2f;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#cpu {
color: #15161e;
background: #7dcfff;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#disk {
color: #15161e;
background: #9ece6a;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#battery {
color: #15161e;
background: #ff79c6;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#network {
color: #15161e;
background: #f1fa8c;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#tray {
color: #15161e;
background: #8EC07C;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#pulseaudio {
color: #15161e;
background: #83a598;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
#custom-notification {
color: #15161e;
background: #6272a4;
border-radius: 15px;
margin: 5px;
padding: 2px 10px;
}
'';
in {
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
});
style = css;
settings = {mainBar = mainWaybarConfig;};
};
}

View file

@ -9,7 +9,7 @@
shellAliases = {
v = "nvim";
pu = "git push -u origin main && git push -u berg main && git push -u hub main";
pu = "git push -u berg main && git push -u hub main";
fr = "sudo systemctl reboot --firmware";
ser = "ssh root@joygnu.org";
sp = "sudo nixos-rebuild switch --flake ~/nix/#pc";

View file

@ -40,8 +40,8 @@
bottles
thunderbird
gnome.gnome-clocks
gnome.gnome-calculator
gnome.gnome-disk-utility
gnome-calculator
gnome-disk-utility
#random utils
pass
pinentry-curses