Add ags system tray
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
21
flake.lock
generated
21
flake.lock
generated
@@ -1,5 +1,25 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
"disko": {
|
"disko": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -90,6 +110,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"ags": "ags",
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
|
@@ -20,6 +20,11 @@
|
|||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ags = {
|
||||||
|
url = "github:Aylur/ags";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... } @ inputs: {
|
outputs = { self, nixpkgs, ... } @ inputs: {
|
||||||
|
@@ -6,4 +6,8 @@
|
|||||||
General.Experimental = true;
|
General.Experimental = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.persistence."/persist".directories = [
|
||||||
|
"/var/lib/bluetooth"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
{
|
{
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
environment.persistence."/persist".directories = [
|
||||||
|
"/etc/NetworkManager/system-connections"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = [
|
directories = [
|
||||||
"/etc/nixos"
|
"/etc/nixos"
|
||||||
"/etc/NetworkManager/system-connections"
|
|
||||||
"/var/lib/nixos"
|
"/var/lib/nixos"
|
||||||
"/var/lib/systemd/coredump"
|
"/var/lib/systemd/coredump"
|
||||||
"/var/log"
|
"/var/log"
|
||||||
|
@@ -65,29 +65,39 @@ export default [
|
|||||||
'@typescript-eslint/no-misused-promises': ['error', {
|
'@typescript-eslint/no-misused-promises': ['error', {
|
||||||
checksVoidReturn: false,
|
checksVoidReturn: false,
|
||||||
}],
|
}],
|
||||||
|
'@typescript-eslint/naming-convention': [
|
||||||
'@typescript-eslint/naming-convention': ['error', {
|
'error',
|
||||||
|
{
|
||||||
selector: 'default',
|
selector: 'default',
|
||||||
format: ['camelCase'],
|
format: ['camelCase'],
|
||||||
}, {
|
leadingUnderscore: 'allowSingleOrDouble',
|
||||||
|
},
|
||||||
|
{
|
||||||
selector: 'variableLike',
|
selector: 'variableLike',
|
||||||
format: ['camelCase', 'PascalCase'],
|
format: ['camelCase', 'PascalCase'],
|
||||||
}, {
|
leadingUnderscore: 'allowSingleOrDouble',
|
||||||
|
},
|
||||||
|
{
|
||||||
selector: 'memberLike',
|
selector: 'memberLike',
|
||||||
format: ['camelCase'],
|
format: ['camelCase'],
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
selector: 'typeLike',
|
selector: 'typeLike',
|
||||||
format: ['PascalCase'],
|
format: ['PascalCase'],
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
selector: 'property',
|
selector: 'property',
|
||||||
format: ['snake_case'],
|
format: ['snake_case'],
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
selector: 'method',
|
selector: 'method',
|
||||||
format: ['camelCase'],
|
format: ['camelCase'],
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
selector: ['enumMember', 'enum'],
|
selector: ['enumMember', 'enum'],
|
||||||
format: ['UPPER_CASE'],
|
format: ['UPPER_CASE'],
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
|
|
||||||
'unicorn/empty-brace-spaces': 'off',
|
'unicorn/empty-brace-spaces': 'off',
|
||||||
'unicorn/expiring-todo-comments': 'off',
|
'unicorn/expiring-todo-comments': 'off',
|
||||||
|
@@ -2,6 +2,7 @@ import gap from './gap/gap';
|
|||||||
import launcher from './launcher/launcher';
|
import launcher from './launcher/launcher';
|
||||||
import workspace from './workspace/workspace';
|
import workspace from './workspace/workspace';
|
||||||
import date from './date/date';
|
import date from './date/date';
|
||||||
|
import systray from './systray/systray';
|
||||||
|
|
||||||
export default (monitor: number) => Widget.Window({
|
export default (monitor: number) => Widget.Window({
|
||||||
monitor,
|
monitor,
|
||||||
@@ -11,26 +12,28 @@ export default (monitor: number) => Widget.Window({
|
|||||||
anchor: ['top', 'right', 'left'],
|
anchor: ['top', 'right', 'left'],
|
||||||
child: Widget.CenterBox({
|
child: Widget.CenterBox({
|
||||||
class_name: 'widgets',
|
class_name: 'widgets',
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
start_widget: Widget.Box({
|
||||||
startWidget: Widget.Box({
|
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
|
hpack: 'start',
|
||||||
children: [
|
children: [
|
||||||
launcher(),
|
launcher(),
|
||||||
gap(),
|
gap(),
|
||||||
workspace(),
|
workspace(),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
center_widget: Widget.Box({
|
||||||
centerWidget: Widget.Box({
|
hexpand: true,
|
||||||
hpack: 'center',
|
hpack: 'center',
|
||||||
children: [
|
children: [
|
||||||
date(),
|
date(),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
end_widget: Widget.Box({
|
||||||
endWidget: Widget.Box({
|
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
children: [],
|
hpack: 'end',
|
||||||
|
children: [
|
||||||
|
systray(),
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
const icon = () => Widget.Icon({
|
const icon = () => Widget.Icon({
|
||||||
class_name: 'icon',
|
class_name: 'icon',
|
||||||
icon: "edit-paste-symbolic",
|
icon: 'edit-paste-symbolic',
|
||||||
});
|
});
|
||||||
|
|
||||||
export default () => Widget.EventBox({
|
export default () => Widget.EventBox({
|
||||||
class_name: 'clipboard',
|
class_name: 'clipboard',
|
||||||
on_primary_click: () => Utils.execAsync('bash -c "cliphist list | rofi -cache-dir $XDG_CACHE_HOME/rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"'),
|
|
||||||
child: icon(),
|
child: icon(),
|
||||||
|
onPrimaryClick: () => Utils.execAsync('bash -c "cliphist list | rofi -cache-dir $XDG_CACHE_HOME/rofi -dmenu -display-columns 2 | cliphist decode | wl-copy"'),
|
||||||
});
|
});
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
const icon = () => Widget.Icon({
|
const icon = () => Widget.Icon({
|
||||||
class_name: 'icon',
|
class_name: 'icon',
|
||||||
icon: "nix-snowflake-symbolic",
|
icon: 'nix-snowflake-symbolic',
|
||||||
});
|
});
|
||||||
|
|
||||||
export default () => Widget.EventBox({
|
export default () => Widget.EventBox({
|
||||||
class_name: 'launcher',
|
class_name: 'launcher',
|
||||||
on_primary_click: () => Utils.execAsync('bash -c "rofi -cache-dir $XDG_CACHE_HOME/rofi -show drun"'),
|
|
||||||
child: icon(),
|
child: icon(),
|
||||||
|
onPrimaryClick: () => Utils.execAsync('bash -c "rofi -cache-dir $XDG_CACHE_HOME/rofi -show drun"'),
|
||||||
});
|
});
|
||||||
|
16
users/configs/ags/config/src/widgets/bar/systray/systray.ts
Normal file
16
users/configs/ags/config/src/widgets/bar/systray/systray.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import gdk from 'gi://Gdk';
|
||||||
|
|
||||||
|
const systemtray = await Service.import('systemtray');
|
||||||
|
|
||||||
|
const systrayItem = item => Widget.EventBox({
|
||||||
|
class_name: 'item',
|
||||||
|
tooltip_markup: item.bind('tooltip_markup'),
|
||||||
|
child: Widget.Icon({ class_name: 'icon' }).bind('icon', item, 'icon'),
|
||||||
|
onPrimaryClick: (_, event: gdk.Event) => item.activate(event),
|
||||||
|
onSecondaryClick: (_, event: gdk.Event) => item.openMenu(event),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default () => Widget.Box({
|
||||||
|
class_name: 'systray',
|
||||||
|
children: systemtray.bind('items').as(i => i.map(systrayItem))
|
||||||
|
});
|
@@ -6,7 +6,7 @@ const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
|
|||||||
const workspaceButton = (i: number) => Widget.Label({
|
const workspaceButton = (i: number) => Widget.Label({
|
||||||
class_name: 'button',
|
class_name: 'button',
|
||||||
attribute: i,
|
attribute: i,
|
||||||
vpack: "center",
|
vpack: 'center',
|
||||||
setup: self => self.hook(hyprland, () => {
|
setup: self => self.hook(hyprland, () => {
|
||||||
self.toggleClassName('active', hyprland.active.workspace.id === i);
|
self.toggleClassName('active', hyprland.active.workspace.id === i);
|
||||||
self.toggleClassName('occupied', (hyprland.getWorkspace(i)?.windows || 0) > 0);
|
self.toggleClassName('occupied', (hyprland.getWorkspace(i)?.windows || 0) > 0);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{ user ? throw "user argument is required" }: { config, lib, pkgs, ... }:
|
{ user ? throw "user argument is required" }: { config, lib, pkgs, inputs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
hmConfig = config.home-manager.users.${user.name};
|
hmConfig = config.home-manager.users.${user.name};
|
||||||
@@ -6,7 +6,9 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
home-manager.users.${user.name} = {
|
home-manager.users.${user.name} = {
|
||||||
home.packages = with pkgs; [ ags ];
|
imports = [ inputs.ags.homeManagerModules.default ];
|
||||||
|
|
||||||
|
programs.ags.enable = true;
|
||||||
|
|
||||||
xdg.configFile.ags = {
|
xdg.configFile.ags = {
|
||||||
source = "${agsConfig}/share/config.js";
|
source = "${agsConfig}/share/config.js";
|
||||||
@@ -21,13 +23,14 @@ in
|
|||||||
wayland.windowManager.hyprland.initExtraConfig = "${lib.meta.getExe (pkgs.writeShellApplication {
|
wayland.windowManager.hyprland.initExtraConfig = "${lib.meta.getExe (pkgs.writeShellApplication {
|
||||||
name = "init-ags";
|
name = "init-ags";
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
ags
|
inputs.ags.packages.${stdenv.hostPlatform.system}.default
|
||||||
sassc
|
sassc
|
||||||
hyprland
|
hyprland
|
||||||
nixos-icons
|
nixos-icons
|
||||||
rofi-wayland
|
rofi-wayland
|
||||||
wl-clipboard
|
wl-clipboard
|
||||||
cliphist
|
cliphist
|
||||||
|
libdbusmenu-gtk3
|
||||||
];
|
];
|
||||||
text = "ags &> /tmp/ags.log";
|
text = "ags &> /tmp/ags.log";
|
||||||
})} &";
|
})} &";
|
||||||
|
@@ -63,3 +63,12 @@
|
|||||||
font-family: {{custom.font_sans_serif_all}}
|
font-family: {{custom.font_sans_serif_all}}
|
||||||
font-weight: 500
|
font-weight: 500
|
||||||
margin: 0 .5 * {{custom.padding}}pt
|
margin: 0 .5 * {{custom.padding}}pt
|
||||||
|
|
||||||
|
.systray
|
||||||
|
.item
|
||||||
|
@include interactive
|
||||||
|
|
||||||
|
.icon
|
||||||
|
font-size: {{custom.font_size}}pt
|
||||||
|
padding: 0 .3 * {{custom.padding}}pt
|
||||||
|
color: {{colors.on_surface.default.hex}}
|
||||||
|
Reference in New Issue
Block a user