Added ags

This commit is contained in:
Kirill committed 2025-03-28 12:12:39 +03:00
1 parent 63e0442b85
commit 8c9e64c6ff
28 files changed
+814 -166

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
{ config, inputs, pkgs, ... }: {
imports = [ inputs.ags.homeManagerModules.default ];
programs.ags = {
enable = true;
configDir = null;
extraPackages = with inputs.ags.packages.${pkgs.system}; [
battery
mpris
hyprland
network
tray
wireplumber
];
};
home.packages = with pkgs; [
pulsemixer
];
wayland.windowManager.hyprland.settings.exec-once = [ "ags run" ];
xdg.configFile."ags".source = (pkgs.callPackage ./ags/ags.nix { colors = config.lib.stylix.colors; });
}
+21
View File
@@ -0,0 +1,21 @@
{ stdenv, lib, config, colors, ... }:
stdenv.mkDerivation {
name = "AGS theme";
src = ./ags;
dontUnpack = true;
patchPhase = ''
echo \$bg: \#${colors.base00}\; > colors.scss
echo \$surface0: \#${colors.base02}\; >> colors.scss
echo \$fg: \#${colors.base05}\; >> colors.scss
echo \$accent: \#${colors.base0B}\; >> colors.scss
'';
installPhase = ''
ls
mkdir $out
cp $src/* $out -r
mv colors.scss $out
'';
}
+12
View File
@@ -0,0 +1,12 @@
# Simple Bar Example
![simple-bar](https://github.com/user-attachments/assets/a306c864-56b7-44c4-8820-81f424f32b9b)
A simple bar for Hyprland using
- [Battery library](https://aylur.github.io/astal/guide/libraries/battery).
- [Hyprland library](https://aylur.github.io/astal/guide/libraries/hyprland).
- [Mpris library](https://aylur.github.io/astal/guide/libraries/mpris).
- [Network library](https://aylur.github.io/astal/guide/libraries/network).
- [Tray library](https://aylur.github.io/astal/guide/libraries/tray).
- [WirePlumber library](https://aylur.github.io/astal/guide/libraries/wireplumber).
+13
View File
@@ -0,0 +1,13 @@
import { App } from "astal/gtk3"
import style from "./style.scss"
import Bar from "./widget/Bar"
App.start({
css: style,
instanceName: "ags",
requestHandler(request, res) {
print(request)
res("ok")
},
main: () => App.get_monitors().map(Bar),
})
+97
View File
@@ -0,0 +1,97 @@
@use "sass:color";
@use "colors.scss" as *;
$radius: 10px;
%item {
all: unset;
background: $bg;
border-radius: $radius;
padding: 4px;
& + &, .item + & { margin-left: 4px; }
label { margin: 0 8px; }
}
window.Bar {
border: none;
box-shadow: none;
background-color: transparent;
color: $fg;
font-size: 1.1em;
font-weight: bold;
.Container {
margin: 10px 10px 0;
}
.Workspaces {
button {
all: unset;
&:hover label {
background: $surface0;
color: $accent;
}
&:active label {
background: $surface0;
color: $accent;
}
}
label {
transition: 200ms;
padding: 0 6px;
margin: 2px;
border-radius: $radius;
border: 1pt solid transparent;
}
.focused label {
background: $accent;
color: $bg;
border-color: $accent;
}
}
.Layout.en { color: $accent; }
.SysTray button {
all: unset;
padding: 8px;
border-radius: inherit;
&:hover {
background: $surface0;
}
}
Media {
&.playing {
border: 2pt solid $accent;
}
.Cover {
min-height: 1.2em;
min-width: 1.2em;
border-radius: $radius;
background-position: center;
background-size: contain;
}
}
.Battery label {
padding-left: 0;
margin-left: 0;
}
.Time { padding: 0 8px; }
.AudioSlider icon { margin-left: 8px; }
.Workspaces, .Layout, .Media, .SysTray, .AudioSlider, .Time {
@extend %item;
}
}
+39
View File
@@ -0,0 +1,39 @@
import { App } from "astal/gtk3"
import { Astal, Gtk, Gdk } from "astal/gtk3"
import Time from "./elements/Time"
import Wifi from "./elements/Wifi"
import Audio from "./elements/Audio"
import Media from "./elements/Media"
import Layout from "./elements/Keyboard"
import SysTray from "./elements/SysTray"
import Workspaces from "./elements/Workspaces"
import BatteryLevel from "./elements/Battery"
export default function Bar(monitor: Gdk.Monitor) {
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
return <window
className="Bar"
gdkmonitor={monitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={TOP | LEFT | RIGHT}>
<centerbox className="Container">
<box hexpand halign={Gtk.Align.START}>
<Workspaces />
<Layout />
</box>
<box>
<Media />
</box>
<box hexpand halign={Gtk.Align.END} >
<Wifi />
<Audio />
<BatteryLevel />
<Time />
<SysTray />
</box>
</centerbox>
</window>
}
@@ -0,0 +1,16 @@
import { bind } from "astal"
import Wp from "gi://AstalWp"
import {execAsync} from "astal/process"
export default function Audio() {
const speaker = Wp.get_default()?.audio.defaultSpeaker!
return <box className="AudioSlider">
<button onClicked={() => {execAsync("kitty --class pulsemixer -e pulsemixer")}}>
<box spacing={4}>
<icon icon={bind(speaker, "volumeIcon")} />
<label label={bind(speaker, "volume").as(v => `${Math.floor(v*100)}%`)} />
</box>
</button>
</box>
}
@@ -0,0 +1,14 @@
import { bind } from "astal"
import Battery from "gi://AstalBattery"
export default function BatteryLevel() {
const bat = Battery.get_default()
return <box className="Battery"
visible={bind(bat, "isPresent")}>
<icon icon={bind(bat, "batteryIconName")} />
<label label={bind(bat, "percentage").as(p =>
`${Math.floor(p * 100)} %`
)} />
</box>
}
@@ -0,0 +1,12 @@
import { Variable, bind } from "astal"
import Hyprland from "gi://AstalHyprland"
export default function Layout() {
const hl = Hyprland.get_default();
let layout = Variable("en");
hl.connect("keyboard-layout", (_, __, l) => { layout.set(`${l}`.slice(0, 2).toLowerCase()) })
return <box className={bind(layout).as((l) => `Layout ${l}`)}>
<label label={bind(layout)}/>
</box>
}
@@ -0,0 +1,29 @@
import { Variable, bind } from "astal"
import { Gtk } from "astal/gtk3"
import Mpris from "gi://AstalMpris"
export default function Media() {
const mpris = Mpris.get_default()
// console.log(bind(mpris, "players").as(ps => ps[0] ? `${ps[0].title} ${ps[0].artist} ${ps[0].get_playback_status()}` : "-"));
return <box>
{bind(mpris, "players").as(ps => ps[0] ? (
<button
className={bind(ps[0], "playback-status").as(s => s == 0 ? "Media playing" : "Media")}
onClicked={() => ps[0].play_pause()}>
<box>
<box
className="Cover"
valign={Gtk.Align.CENTER}
css={bind(ps[0], "coverArt").as(cover =>
`background-image: url('${cover}');`
)}
/>
<label
label={bind(ps[0], "title").as(() =>ps[0].title.length < 80 ? ps[0].title : `${ps[0].title.slice(0, 77)}...`)}
/>
</box>
</button>
) : ("") )}
</box>
}
@@ -0,0 +1,22 @@
import { bind } from "astal"
import Tray from "gi://AstalTray"
export default function SysTray() {
const tray = Tray.get_default()
return <box className="item">
{bind(tray, "items").as(i => (i.length > 0) ? (
<box className="SysTray">
{bind(tray, "items").as(items => items.map(item => (
<menubutton
tooltipMarkup={bind(item, "tooltipMarkup")}
usePopover={false}
actionGroup={bind(item, "action-group").as(ag => ["dbusmenu", ag])}
menuModel={bind(item, "menu-model")}>
<icon gicon={bind(item, "gicon")} />
</menubutton>
)))}
</box>
) : ("") )}
</box>
}
@@ -0,0 +1,12 @@
import { Variable, GLib } from "astal"
export default function Time({ format = "%e %b - %H:%M %a" }) {
const time = Variable<string>("").poll(1000, () =>
GLib.DateTime.new_now_local().format(format)!)
return <label
className="Time"
onDestroy={() => time.drop()}
label={time()}
/>
}
@@ -0,0 +1,34 @@
import { bind } from "astal"
import Network from "gi://AstalNetwork"
import {execAsync} from "astal/process"
/*export default function Wifi() {
const network = Network.get_default()
const wifi = bind(network, "wifi")
return <box visible={wifi.as(Boolean)}>
{wifi.as(wifi => wifi && (
<icon
tooltipText={bind(wifi, "ssid").as(String)}
className="Wifi"
icon={bind(wifi, "iconName")}
/>
))}
</box>
}*/
export default function Wifi() {
const network = Network.get_default()
const wifi = bind(network, "wifi")
return <box visible={wifi.as(Boolean)}>
{wifi.as(wifi => wifi && (
<button onClicked={() => {execAsync("kitty --title=nmtui -e nmtui")}} className="Wifi">
<box spacing={4}>
<icon icon={bind(wifi, "iconName")}/>
<label label={wifi.ssid.slice(0, 10) + (wifi.ssid.length > 10 ? "…" : "")}/>
</box>
</button>
))}
</box>
}
@@ -0,0 +1,21 @@
import { bind } from "astal"
import Hyprland from "gi://AstalHyprland"
export default function Workspaces() {
const hypr = Hyprland.get_default()
return <box className="Workspaces">
{bind(hypr, "workspaces").as(wss => wss
.filter(ws => !(ws.id >= -99 && ws.id <= -2)) // filter out special workspaces
.sort((a, b) => a.id - b.id)
.map(ws => (
<button
className={bind(hypr, "focusedWorkspace").as(fw =>
ws === fw ? "focused" : "")}
onClicked={() => ws.focus()}>
{ws.id}
</button>
))
)}
</box>
}
-5
View File
@@ -75,10 +75,6 @@
new_optimizations = true;
};
drop_shadow = true;
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";
};
animations = {
@@ -134,7 +130,6 @@
"systemctl --user start plasma-polkit-agent"
"swww init"
"python3 ${lib.getExe wallpaper_changer}"
"waybar"
"${lib.getExe' pkgs.udiskie "udiskie"}"
"wl-paste --type text --watch cliphist store"
"wl-paste --type image --watch cliphist store"
+2 -1
View File
@@ -1,7 +1,8 @@
{config, pkgs, ...}: {
imports = [
./hyprland.nix
./waybar.nix
./ags.nix
#./waybar.nix
./style.nix
./git.nix
./mako.nix
-1
View File
@@ -13,7 +13,6 @@
settings = {
background = {
path = lib.mkForce "${image}";
color = "rgba(25, 20, 20, 1.0)";
blur_passes = 0;
blur_size = 7;
noise = 0.0117;
+6
View File
@@ -12,6 +12,12 @@
image = pkgs.fetchurl {
url = "https://99px.ru/sstorage/53/2024/03/mid_357241_413672.jpg";
sha256 = "sha256-evP7zstPa0ztNs/dUJ8G5p+/L2maIKZASeuONJ1C0h0=";
};
iconTheme = {
enable = true;
package = pkgs.pop-icon-theme;
dark = "Pop-Dark";
};
fonts = {
+2
View File
@@ -5,6 +5,8 @@ home.packages = [ pkgs.pulsemixer ];
"float, ^(nmtui)"
];
wayland.windowManager.hyprland.settings.exec-once = [ "waybar" ];
programs.waybar =
let
colors = config.lib.stylix.colors;
+6 -17
View File
@@ -1,9 +1,9 @@
{ pkgs, lib, ... }:
let yazi-plugins = pkgs.fetchFromGitHub {
{ pkgs, lib, ... }: let
yazi-plugins = pkgs.fetchFromGitHub {
owner = "yazi-rs";
repo = "plugins";
rev = "c5785059611624e20a37ba573620f30acc28a26a";
hash = "sha256-wlSBtabIsEUJhuHmXwgpSnwZp9WaVQFBg6s1XXjubrE=";
rev = "07258518f3bffe28d87977bc3e8a88e4b825291b";
hash = "sha256-axoMrOl0pdlyRgckFi4DiS+yBKAIHDhVeZQJINh8+wk=";
};
starship = pkgs.fetchFromGitHub {
owner = "Rolv-Apneseth";
@@ -22,19 +22,8 @@ in {
show_hidden = true;
};
preview = {
image_filter = "lanczos3";
image_quality = 90;
tab_size = 1;
max_width = 600;
max_height = 900;
cache_dir = "";
ueberzug_scale = 1;
ueberzug_offset = [
0
0
0
0
];
max_width = 1000;
max_height = 1000;
};
};
+2
View File
@@ -3,6 +3,8 @@
./zsh.nix
./data/pkgs.nix
];
home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ";
home = {
username = "kirill";
+96 -52
View File
@@ -1,62 +1,106 @@
{ config, ... }: {
programs.zoxide.enable = true;
programs.zsh = {
enable = true;
enableCompletion = true;
# enableAutosuggestions = true;
syntaxHighlighting.enable = true;
programs = {
zoxide.enable = true;
shellAliases =
let
flakeDir = "~/nix";
in {
rb = "sudo nixos-rebuild switch --flake ${flakeDir}";
upd = "nix flake update ${flakeDir}";
upg = "sudo nixos-rebuild switch --upgrade --flake ${flakeDir}";
starship = {
enable = true;
enableZshIntegration = true;
hms = "home-manager switch --flake ${flakeDir}";
settings = {
add_newline = true;
format = ''
$os$directory$git_branch$git_status
$nix_shell$status$character
'';
right_format = "$all";
conf = "$EDITOR ${flakeDir}/nixos/hosts/$(hostname)/configuration.nix";
pkgs = "$EDITOR ${flakeDir}/nixos/packages.nix";
ll = "ls -l";
se = "sudoedit";
ff = "fastfetch";
cat = "bat";
cd = "z";
rebuild = "sudo nixos-rebuild switch --flake ~/.config/f#usconfig";
deleteGenerations = "sudo nix-collect-garbage -d";
openHome = "vim .config/f/home-manager/home.nix";
rebuildHome = "home-manager switch --flake ~/.config/f";
rebuildHomeImpure = "home-manager switch --flake ~/.config/f --impure";
openConfiguration = "sudo nano ~/.config/f/nixos/hosts/usconfig/configuration.nix";
openHyprland = "vim .config/f/home-manager/data/hyprland.nix";
openZSH = "vim .config/f/home-manager/zsh.nix";
openWayBar = "vim .config/f/home-manager/data/waybar.nix";
rebuildFlake = "sudo nixos-rebuild switch --flake /home/kirill/.config/f --impure";
openFlake = "vim /home/kirill/.config/f/flake.nix";
swichWalls = "python3 /nix/store/6czqsnf0gbvvm472lipndyg34qhnfpis-wallpaper_changer/bin/wallpaper_changer";
screenshot_f="grimblast save screen ~/screenshot_$(date +\%Y-\%m-\%d_\%H-\%M-\%S).png";
screenshot="grimblast save area ~/screenshot_$(date +\%Y-\%m-\%d_\%H-\%M-\%S).png";
screenshot_c = "grimblast copy area";
loginPostgresql = "sudo -u postgres psql";
cmake.disabled = true;
cmd_duration = {
format = "";
show_notifications = true;
notification_timeout = 10000;
};
git_branch.format = "on [$branch(:$remote_branch)]($style) ";
git_metrics.disabled = false;
git_status = {
conflicted = "!";
up_to_date = "ok";
stashed = "S";
modified = "M";
};
directory = {
truncation_length = 3;
fish_style_pwd_dir_length = 1;
read_only = " RO";
};
nix_shell.format = "[nix-shell]($style) ";
os.disabled = false;
python = {
symbol = "py ";
python_binary = ["python3" "python"];
};
status.disabled = false;
};
};
initExtra = ''
if [ -z "''${WAYLAND_DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
dbus-run-session Hyprland
fi
eval "$(zoxide init zsh)"
'';
history.size = 10000;
history.path = "${config.xdg.dataHome}/zsh/history";
oh-my-zsh = {
zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "agnoster"; # blinks is also really nice
enableCompletion = true;
# enableAutosuggestions = true;
syntaxHighlighting.enable = true;
shellAliases =
let
flakeDir = "~/nix";
in {
rb = "sudo nixos-rebuild switch --flake ${flakeDir}";
upd = "nix flake update ${flakeDir}";
upg = "sudo nixos-rebuild switch --upgrade --flake ${flakeDir}";
hms = "home-manager switch --flake ${flakeDir}";
conf = "$EDITOR ${flakeDir}/nixos/hosts/$(hostname)/configuration.nix";
pkgs = "$EDITOR ${flakeDir}/nixos/packages.nix";
ll = "ls -l";
se = "sudoedit";
ff = "fastfetch";
cat = "bat";
cd = "z";
rebuild = "sudo nixos-rebuild switch --flake ~/.config/f#usconfig";
deleteGenerations = "sudo nix-collect-garbage -d";
openHome = "vim .config/f/home-manager/home.nix";
rebuildHome = "home-manager switch --flake ~/.config/f";
rebuildHomeSudo = "sudo home-manager switch --flake ~/.config/f";
openConfiguration = "sudo nano ~/.config/f/nixos/hosts/usconfig/configuration.nix";
openHyprland = "vim .config/f/home-manager/data/hyprland.nix";
openZSH = "vim .config/f/home-manager/zsh.nix";
openWayBar = "vim .config/f/home-manager/data/waybar.nix";
rebuildFlake = "sudo nixos-rebuild switch --flake /home/kirill/.config/f --impure";
openFlake = "vim /home/kirill/.config/f/flake.nix";
swichWalls = "python3 /nix/store/6czqsnf0gbvvm472lipndyg34qhnfpis-wallpaper_changer/bin/wallpaper_changer";
screenshot_f="grimblast save screen ~/screenshot_$(date +\%Y-\%m-\%d_\%H-\%M-\%S).png";
screenshot="grimblast save area ~/screenshot_$(date +\%Y-\%m-\%d_\%H-\%M-\%S).png";
screenshot_c = "grimblast copy area";
loginPostgresql = "sudo -u postgres psql";
};
initExtra = ''
if [ -z "''${WAYLAND_DISPLAY}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
dbus-run-session Hyprland
fi
eval "$(zoxide init zsh)"
'';
history.size = 10000;
history.path = "${config.xdg.dataHome}/zsh/history";
oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" ];
theme = "agnoster"; # blinks is also really nice
};
};
};
}