Initial commit
This commit is contained in:
commit
4269d6b0bc
3
ags/.gitignore
vendored
Normal file
3
ags/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
@girs/
|
||||||
|
styles/colors/index.scss
|
67
ags/app.ts
Normal file
67
ags/app.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import style from "./styles/style.scss"
|
||||||
|
|
||||||
|
import { GLib, monitorFile, exec } from "astal";
|
||||||
|
import { App, Gtk } from "astal/gtk4";
|
||||||
|
import Hyprland from "gi://AstalHyprland";
|
||||||
|
|
||||||
|
import QuickSettings from "widget/quick_settings/quick_settings";
|
||||||
|
import BluetoothWindow from "widget/quick_settings/bluetooth";
|
||||||
|
import Launcher from "widget/launcher/launcher";
|
||||||
|
import BatteryInfo from "@/widget/bar/battery_info";
|
||||||
|
import Bar from "widget/bar/bar";
|
||||||
|
|
||||||
|
const hypr = Hyprland.get_default();
|
||||||
|
const windows = new Map<number, Gtk.Window[]>();
|
||||||
|
const components = [
|
||||||
|
Bar,
|
||||||
|
Launcher,
|
||||||
|
QuickSettings,
|
||||||
|
BluetoothWindow,
|
||||||
|
BatteryInfo
|
||||||
|
];
|
||||||
|
|
||||||
|
const setupBars = async (monitor_id: number) => {
|
||||||
|
const windows = await Promise.all(
|
||||||
|
components.map(item => Promise.resolve(item(monitor_id)) as Promise<Gtk.Window>)
|
||||||
|
);
|
||||||
|
|
||||||
|
return windows;
|
||||||
|
};
|
||||||
|
|
||||||
|
const STYLES = `${GLib.get_user_config_dir()}/ags/styles`;
|
||||||
|
const monitorCSS = () => monitorFile(
|
||||||
|
STYLES + '/colors.scss',
|
||||||
|
() => {
|
||||||
|
exec(`sass ${STYLES}/style.scss /tmp/ags-style.css`);
|
||||||
|
App.apply_css('/tmp/ags-style.css', true);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
App.start({
|
||||||
|
css: style,
|
||||||
|
async main() {
|
||||||
|
App.add_icons(`${GLib.get_user_data_dir()}/icons/Astal`);
|
||||||
|
monitorCSS();
|
||||||
|
|
||||||
|
const monitors = App.get_monitors();
|
||||||
|
for (const monitor of monitors) {
|
||||||
|
const index = monitors.indexOf(monitor);
|
||||||
|
windows.set(index, await setupBars(index));
|
||||||
|
|
||||||
|
hypr.connect("monitor-added", async (_, monitor: Hyprland.Monitor) => {
|
||||||
|
if (!windows.has(monitor.id)) windows.set(monitor.id, await setupBars(monitor.id))
|
||||||
|
});
|
||||||
|
|
||||||
|
hypr.connect("monitor-removed", (_, monitor_id: number) => {
|
||||||
|
const monitorWindows = windows.get(monitor_id)
|
||||||
|
if (monitorWindows) {
|
||||||
|
for (const monitorWindow of monitorWindows) {
|
||||||
|
monitorWindow.destroy();
|
||||||
|
};
|
||||||
|
|
||||||
|
windows.delete(monitor_id);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
21
ags/env.d.ts
vendored
Normal file
21
ags/env.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
declare const SRC: string
|
||||||
|
|
||||||
|
declare module "inline:*" {
|
||||||
|
const content: string
|
||||||
|
export default content
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.scss" {
|
||||||
|
const content: string
|
||||||
|
export default content
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.blp" {
|
||||||
|
const content: string
|
||||||
|
export default content
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.css" {
|
||||||
|
const content: string
|
||||||
|
export default content
|
||||||
|
}
|
17
ags/lib/icons.ts
Normal file
17
ags/lib/icons.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { Binding } from "astal";
|
||||||
|
|
||||||
|
type Substitution = { charging?: string, idle?: string }
|
||||||
|
|
||||||
|
export const getBatteryIcon = (percentage: number, charging: Binding<boolean>) => {
|
||||||
|
const levels = Array.from({ length: 10 }, (_, i) => (i + 1) * 10);
|
||||||
|
const level = levels.find((level) => percentage <= level)!;
|
||||||
|
|
||||||
|
const substitutions: Record<number, Substitution> = {
|
||||||
|
100: { charging: "battery-level-100-charged-symbolic" }
|
||||||
|
};
|
||||||
|
|
||||||
|
return charging.as(c => c
|
||||||
|
? substitutions[level]?.charging || `battery-level-${level}-charging-symbolic`
|
||||||
|
: substitutions[level]?.idle || `battery-level-${level}-symbolic`
|
||||||
|
);
|
||||||
|
};
|
24
ags/lib/utils.ts
Normal file
24
ags/lib/utils.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { Gtk, Gdk } from "astal/gtk4";
|
||||||
|
|
||||||
|
export type If<Condition, Then, Else> = Condition extends true ? Then : Else;
|
||||||
|
export type Belongs<T, U> = {
|
||||||
|
[K in keyof T]: T[K] extends U ? K : never;
|
||||||
|
}[keyof T];
|
||||||
|
|
||||||
|
export const hideWindow = (self: Gtk.Window, keyval: number) => {
|
||||||
|
const keys = ["quick_settings"].includes(self.name)
|
||||||
|
? [Gdk.KEY_Escape]
|
||||||
|
: [
|
||||||
|
Gdk.KEY_Escape,
|
||||||
|
Gdk.KEY_Super_L,
|
||||||
|
Gdk.KEY_Super_R
|
||||||
|
];
|
||||||
|
|
||||||
|
if (keys.some(key => key === keyval)) self.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
export const openOnButton = (event: Gdk.ButtonEvent, keyval: number) => (action: () => void) => {
|
||||||
|
if (event.get_button() !== keyval) return;
|
||||||
|
|
||||||
|
action();
|
||||||
|
}
|
24
ags/lib/widgets/datetime.tsx
Normal file
24
ags/lib/widgets/datetime.tsx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { Variable, GLib } from "astal";
|
||||||
|
import { Widget } from "astal/gtk4";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
format: string,
|
||||||
|
interval?: number
|
||||||
|
} & Widget.LabelProps;
|
||||||
|
|
||||||
|
export default function DateTime({ format, interval, ...props }: Props) {
|
||||||
|
const shouldPoll = typeof interval === "number" && interval >= 1;
|
||||||
|
|
||||||
|
const currentTime = () => {
|
||||||
|
const dateTime = GLib.DateTime.new_now_local();
|
||||||
|
return dateTime.format(format)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldPoll) {
|
||||||
|
const pollTime = new Variable(currentTime()).poll(interval || 1000, currentTime);
|
||||||
|
return <label label={pollTime()} {...props} />
|
||||||
|
} else {
|
||||||
|
const time = new Variable(currentTime())
|
||||||
|
return <label label={time()} {...props} />
|
||||||
|
}
|
||||||
|
}
|
6
ags/package.json
Normal file
6
ags/package.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "astal-shell",
|
||||||
|
"dependencies": {
|
||||||
|
"astal": "/nix/store/52w3zsyjrj7xrwcf3gxi3hv2y9lnc9pv-astal-gjs/share/astal/gjs"
|
||||||
|
}
|
||||||
|
}
|
5
ags/settings.json
Normal file
5
ags/settings.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"SHELL": "fish",
|
||||||
|
"IDLE_INHIBIT_SCRIPT": "$HOME/.config/hypr/scripts/idle-inhibitor.py",
|
||||||
|
"RANDOM_WALLPAPER_SCRIPT": "$HOME/.config/hypr/scripts/random-wallpaper.sh"
|
||||||
|
}
|
2
ags/styles/_variables.scss
Normal file
2
ags/styles/_variables.scss
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$font-family: "SFProText Nerd Font", "SFProDisplay Nerd Font", sans-serif;
|
||||||
|
$font-family-monospace: "JetBrains Mono", monospace;
|
6
ags/styles/classes.scss
Normal file
6
ags/styles/classes.scss
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
@use '_variables' as *;
|
||||||
|
@use 'mixins';
|
||||||
|
|
||||||
|
.material-icon {
|
||||||
|
@include mixins.material-icon;
|
||||||
|
}
|
26
ags/styles/colors.scss
Normal file
26
ags/styles/colors.scss
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// SCSS Variables
|
||||||
|
// Generated by 'wal'
|
||||||
|
$wallpaper: "/home/sadorowo/images/wallpapers/youtube_Sheri_188.jpg";
|
||||||
|
|
||||||
|
// Special
|
||||||
|
$background: #fcf1ed;
|
||||||
|
$foreground: #0E0408;
|
||||||
|
$cursor: #0E0408;
|
||||||
|
|
||||||
|
// Colors
|
||||||
|
$color0: #fcf1ed;
|
||||||
|
$color1: #DB6B5B;
|
||||||
|
$color2: #FA936C;
|
||||||
|
$color3: #FFC17D;
|
||||||
|
$color4: #7B6587;
|
||||||
|
$color5: #9A758D;
|
||||||
|
$color6: #C57D82;
|
||||||
|
$color7: #0E0408;
|
||||||
|
$color8: #8d6254;
|
||||||
|
$color9: #DB6B5B;
|
||||||
|
$color10: #FA936C;
|
||||||
|
$color11: #FFC17D;
|
||||||
|
$color12: #7B6587;
|
||||||
|
$color13: #9A758D;
|
||||||
|
$color14: #C57D82;
|
||||||
|
$color15: #0E0408;
|
32
ags/styles/components/_bar.scss
Normal file
32
ags/styles/components/_bar.scss
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
@use '../colors' as *;
|
||||||
|
|
||||||
|
window.bar {
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
>box {
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
>.inner {
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
background: $color5;
|
||||||
|
padding: 0.25rem 1rem;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
* { color: $color0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.tray .item {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
background: $color5;
|
||||||
|
|
||||||
|
image {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
calendar>header { border: none; }
|
||||||
|
}
|
56
ags/styles/components/_battery_info.scss
Normal file
56
ags/styles/components/_battery_info.scss
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
@use '../colors' as *;
|
||||||
|
|
||||||
|
window.battery_info {
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
>box {
|
||||||
|
border: 1px solid $color0;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
>.inner {
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
background: $color5;
|
||||||
|
padding: 0.75rem 3rem;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
label.percentage {
|
||||||
|
font-size: 300%;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
color: $color0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.battery_info button {
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
background: $color5;
|
||||||
|
border: 2px solid $color0;
|
||||||
|
margin: 5px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $color0;
|
||||||
|
|
||||||
|
* {
|
||||||
|
color: $color5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: $color0;
|
||||||
|
border: 0.5px solid $color5;
|
||||||
|
|
||||||
|
* {
|
||||||
|
color: $color5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
ags/styles/components/_index.scss
Normal file
4
ags/styles/components/_index.scss
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
@forward '_bar';
|
||||||
|
@forward '_launcher';
|
||||||
|
@forward '_battery_info';
|
||||||
|
@forward '_quick_settings';
|
60
ags/styles/components/_launcher.scss
Normal file
60
ags/styles/components/_launcher.scss
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
@use '../colors' as *;
|
||||||
|
|
||||||
|
.launcher {
|
||||||
|
entry {
|
||||||
|
background: $color5;
|
||||||
|
color: $color0;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: none;
|
||||||
|
|
||||||
|
margin-bottom: 6px;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 2px solid $color0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.application {
|
||||||
|
padding: 10px;
|
||||||
|
background: $color5;
|
||||||
|
border-radius: 8px;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $color0;
|
||||||
|
|
||||||
|
box>.name, box>.description {
|
||||||
|
color: $color5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
box {
|
||||||
|
.name {
|
||||||
|
color: $color0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
color: $color0;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-found {
|
||||||
|
background: $color5;
|
||||||
|
color: $color0;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
|
||||||
|
image {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
ags/styles/components/_quick_settings.scss
Normal file
70
ags/styles/components/_quick_settings.scss
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
@use '../colors' as *;
|
||||||
|
|
||||||
|
window.quick_settings {
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
>box {
|
||||||
|
border: 1px solid $color0;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
>.inner {
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
background: $color5;
|
||||||
|
padding: 0.75rem 3rem;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
* {
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
color: $color0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.qs_bluetooth {
|
||||||
|
>.inner {
|
||||||
|
background: $color5;
|
||||||
|
padding: 0.75rem 3rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
* { color: $color0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.device {
|
||||||
|
padding: 1rem 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 0.75rem 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.quick_settings button, window.qs_bluetooth button {
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
background: $color5;
|
||||||
|
border: 2px solid $color0;
|
||||||
|
margin: 5px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $color0;
|
||||||
|
|
||||||
|
* {
|
||||||
|
color: $color5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: $color0;
|
||||||
|
border: 0.5px solid $color5;
|
||||||
|
|
||||||
|
* {
|
||||||
|
color: $color5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
ags/styles/mixins.scss
Normal file
8
ags/styles/mixins.scss
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
@mixin full-rounding {
|
||||||
|
border-radius: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin material-icon {
|
||||||
|
font-family: "Material Symbols Rounded", "MaterialSymbolsRounded", "Material Symbols Outlined",
|
||||||
|
"Material Symbols Sharp";
|
||||||
|
}
|
29
ags/styles/style.scss
Normal file
29
ags/styles/style.scss
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
@use 'variables' as *;
|
||||||
|
@use 'colors' as *;
|
||||||
|
@use 'mixins';
|
||||||
|
@use 'classes';
|
||||||
|
@use 'components';
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-family: $font-family;
|
||||||
|
}
|
||||||
|
|
||||||
|
separator {
|
||||||
|
background: $color0;
|
||||||
|
}
|
||||||
|
|
||||||
|
popover>contents, calendar {
|
||||||
|
background: $color5;
|
||||||
|
}
|
||||||
|
|
||||||
|
button, button:hover {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
popover modelbutton {
|
||||||
|
&:hover, &:focus { background: $color6; }
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
padding: 0 0.25rem;
|
||||||
|
}
|
19
ags/tsconfig.json
Normal file
19
ags/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"strict": true,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"noEmit": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"jsxImportSource": "astal/gtk4",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./*"],
|
||||||
|
"@lib/*": ["lib/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
ags/widget/bar/bar.tsx
Normal file
45
ags/widget/bar/bar.tsx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { App, Astal, Gdk, Gtk } from "astal/gtk4"
|
||||||
|
import { Binding } from "astal"
|
||||||
|
|
||||||
|
import Battery from "gi://AstalBattery";
|
||||||
|
|
||||||
|
import { BatteryInfo } from "./components/battery";
|
||||||
|
import DateTime from "@lib/widgets/datetime";
|
||||||
|
import Workspace from "./workspace";
|
||||||
|
import TrayView from "./tray";
|
||||||
|
|
||||||
|
export default function Bar(monitor_id: number) {
|
||||||
|
const { BOTTOM, LEFT, RIGHT } = Astal.WindowAnchor
|
||||||
|
const CENTER = Gtk.Align.CENTER;
|
||||||
|
|
||||||
|
const battery = Battery.get_default();
|
||||||
|
|
||||||
|
const openQuickSettings = (_self: Gtk.Button, state: Gdk.ButtonEvent) => {
|
||||||
|
if (state.get_button() === Gdk.BUTTON_PRIMARY)
|
||||||
|
App.get_window("quick_settings")?.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
return <window
|
||||||
|
visible
|
||||||
|
name={`bar_${monitor_id}`}
|
||||||
|
monitor={monitor_id}
|
||||||
|
cssClasses={["bar"]}
|
||||||
|
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
||||||
|
anchor={BOTTOM | LEFT | RIGHT}
|
||||||
|
application={App}>
|
||||||
|
<box halign={CENTER} cssClasses={["inner"]}>
|
||||||
|
{[
|
||||||
|
Workspace(),
|
||||||
|
<menubutton hasFrame={false}>
|
||||||
|
<DateTime format="%d.%m.%Y %H:%M:%S" interval={1000} />
|
||||||
|
<popover>
|
||||||
|
<Gtk.Calendar />
|
||||||
|
</popover>
|
||||||
|
</menubutton>,
|
||||||
|
BatteryInfo({ battery }),
|
||||||
|
<button hasFrame={false} iconName={"applications-system-symbolic"} onButtonPressed={openQuickSettings} />,
|
||||||
|
TrayView()
|
||||||
|
]}
|
||||||
|
</box>
|
||||||
|
</window>
|
||||||
|
}
|
53
ags/widget/bar/battery_info.tsx
Normal file
53
ags/widget/bar/battery_info.tsx
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import { App, Astal, Gtk } from "astal/gtk4";
|
||||||
|
import { bind } from "astal";
|
||||||
|
|
||||||
|
import { getBatteryIcon } from "@/lib/icons";
|
||||||
|
import { hideWindow } from "@lib/utils";
|
||||||
|
|
||||||
|
import PowerProfiles from "gi://AstalPowerProfiles?version=0.1";
|
||||||
|
import Battery from "gi://AstalBattery?version=0.1";
|
||||||
|
import Hyprland from "gi://AstalHyprland";
|
||||||
|
|
||||||
|
export default function BatteryInfo(_monitor_id: number) {
|
||||||
|
const { BOTTOM, LEFT, RIGHT } = Astal.WindowAnchor
|
||||||
|
const CENTER = Gtk.Align.CENTER;
|
||||||
|
|
||||||
|
const hypr = Hyprland.get_default();
|
||||||
|
const power = PowerProfiles.get_default();
|
||||||
|
const battery = Battery.get_default();
|
||||||
|
|
||||||
|
const percentage = bind(battery, "percentage").as(p => Math.floor(p * 100));
|
||||||
|
const charging = bind(battery, "charging");
|
||||||
|
|
||||||
|
return <window
|
||||||
|
visible={false}
|
||||||
|
name={"battery_info"}
|
||||||
|
monitor={bind(hypr, "focusedMonitor").as(monitor => monitor.id)}
|
||||||
|
cssClasses={["battery_info"]}
|
||||||
|
keymode={Astal.Keymode.EXCLUSIVE}
|
||||||
|
exclusivity={Astal.Exclusivity.IGNORE}
|
||||||
|
anchor={BOTTOM | LEFT | RIGHT}
|
||||||
|
onKeyPressed={hideWindow}
|
||||||
|
application={App}>
|
||||||
|
<box halign={CENTER} cssClasses={["inner"]} spacing={10}>
|
||||||
|
{percentage.as(p => <>
|
||||||
|
<image
|
||||||
|
iconSize={Gtk.IconSize.LARGE}
|
||||||
|
iconName={getBatteryIcon(p, charging)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<label cssClasses={["percentage"]}>{percentage.as(p => `${p}%`)}</label>
|
||||||
|
</>)}
|
||||||
|
|
||||||
|
{power.get_profiles().map(profile => <button
|
||||||
|
label={profile.profile}
|
||||||
|
cssClasses={bind(power, "active_profile").as(active =>
|
||||||
|
active === profile.profile
|
||||||
|
? ["active"]
|
||||||
|
: []
|
||||||
|
)}
|
||||||
|
onClicked={() => power.set_active_profile(profile.profile)}
|
||||||
|
/>)}
|
||||||
|
</box>
|
||||||
|
</window>
|
||||||
|
}
|
26
ags/widget/bar/components/battery.tsx
Normal file
26
ags/widget/bar/components/battery.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { App, Gdk } from "astal/gtk4";
|
||||||
|
import { bind } from "astal";
|
||||||
|
|
||||||
|
import Battery from "gi://AstalBattery";
|
||||||
|
|
||||||
|
import { getBatteryIcon } from "@/lib/icons";
|
||||||
|
import { openOnButton } from "@/lib/utils";
|
||||||
|
|
||||||
|
export function BatteryInfo({ battery }: { battery: Battery.Device }) {
|
||||||
|
const percentage = bind(battery, "percentage").as(p => Math.floor(p * 100));
|
||||||
|
const charging = bind(battery, "charging");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<box>
|
||||||
|
{percentage.as(p => <button hasFrame={false}>
|
||||||
|
<box onButtonPressed={(_self, event) =>
|
||||||
|
openOnButton(event, Gdk.BUTTON_PRIMARY)
|
||||||
|
(() => App.toggle_window("battery_info"))
|
||||||
|
}>
|
||||||
|
<label>{percentage.as(p => `${p}%`)}</label>
|
||||||
|
<image iconName={getBatteryIcon(p, charging)} />
|
||||||
|
</box>
|
||||||
|
</button>)}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
};
|
30
ags/widget/bar/tray.tsx
Normal file
30
ags/widget/bar/tray.tsx
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { hook } from "astal/gtk4";
|
||||||
|
import { bind } from "astal";
|
||||||
|
|
||||||
|
import Tray from "gi://AstalTray";
|
||||||
|
|
||||||
|
export default function TrayView() {
|
||||||
|
const tray = Tray.get_default();
|
||||||
|
const items = bind(tray, "items");
|
||||||
|
|
||||||
|
return <box spacing={items.as(items => items.length)} cssClasses={["tray"]}>
|
||||||
|
{items.as(items => items.map(item => {
|
||||||
|
const button = <menubutton
|
||||||
|
cssClasses={["item"]}
|
||||||
|
tooltipMarkup={bind(item, "tooltipMarkup")}
|
||||||
|
menuModel={bind(item, "menuModel")}
|
||||||
|
hasFrame={false}
|
||||||
|
primary
|
||||||
|
setup={self => self.insert_action_group("dbusmenu", item.actionGroup)}
|
||||||
|
>
|
||||||
|
<image gicon={item.gicon} />
|
||||||
|
</menubutton>;
|
||||||
|
|
||||||
|
hook(button, item, "notify::action-group", self => {
|
||||||
|
self.insert_action_group("dbusmenu", item.actionGroup);
|
||||||
|
});
|
||||||
|
|
||||||
|
return button;
|
||||||
|
}))}
|
||||||
|
</box>
|
||||||
|
}
|
18
ags/widget/bar/workspace.tsx
Normal file
18
ags/widget/bar/workspace.tsx
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import Hyprland from "gi://AstalHyprland";
|
||||||
|
import { bind, Variable } from "astal";
|
||||||
|
|
||||||
|
export default function Workspace() {
|
||||||
|
const hypr = Hyprland.get_default();
|
||||||
|
const lastWorkspaceId = Variable(hypr.focusedWorkspace.id);
|
||||||
|
|
||||||
|
return <button hasFrame={false}>
|
||||||
|
{bind(hypr, "focusedWorkspace").as(workspace => {
|
||||||
|
// This is a hack; sometimes when disconnecting monitor
|
||||||
|
// focusedWorkspace is null for a while.
|
||||||
|
// Therefore an error occurs when trying to reference id.
|
||||||
|
if (workspace) lastWorkspaceId.set(workspace.id)
|
||||||
|
|
||||||
|
return `workspace ${workspace?.id ?? lastWorkspaceId.get()}`
|
||||||
|
})}
|
||||||
|
</button>
|
||||||
|
}
|
82
ags/widget/launcher/launcher.tsx
Normal file
82
ags/widget/launcher/launcher.tsx
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { Variable, bind } from "astal";
|
||||||
|
import { App, Astal, Gtk } from "astal/gtk4";
|
||||||
|
import { hideWindow } from "@lib/utils";
|
||||||
|
|
||||||
|
import Hyprland from "gi://AstalHyprland";
|
||||||
|
import Apps from "gi://AstalApps";
|
||||||
|
|
||||||
|
const hide = () => App.get_window("launcher")?.hide();
|
||||||
|
|
||||||
|
function AppButton({ app }: { app: Apps.Application }) {
|
||||||
|
return <button
|
||||||
|
cssClasses={["application"]}
|
||||||
|
onClicked={() => {
|
||||||
|
hide();
|
||||||
|
app.launch();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<box>
|
||||||
|
<image iconName={app.iconName} />
|
||||||
|
<box valign={Gtk.Align.CENTER} vertical>
|
||||||
|
<label
|
||||||
|
cssClasses={["name"]}
|
||||||
|
xalign={0}
|
||||||
|
label={app.name}
|
||||||
|
/>
|
||||||
|
{app.description && <label
|
||||||
|
cssClasses={["description"]}
|
||||||
|
wrap
|
||||||
|
xalign={0}
|
||||||
|
label={app.description}
|
||||||
|
/>}
|
||||||
|
</box>
|
||||||
|
</box>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Launcher(_monitor_id: number) {
|
||||||
|
const { TOP, BOTTOM, LEFT, RIGHT } = Astal.WindowAnchor;
|
||||||
|
|
||||||
|
const hypr = Hyprland.get_default();
|
||||||
|
const apps = new Apps.Apps();
|
||||||
|
|
||||||
|
const query = Variable("")
|
||||||
|
const list = query(text => apps.fuzzy_query(text).slice(0, 10))
|
||||||
|
const onEnter = () => {
|
||||||
|
hide()
|
||||||
|
list.get().at(0)!.launch()
|
||||||
|
}
|
||||||
|
|
||||||
|
return <window
|
||||||
|
visible={false}
|
||||||
|
monitor={bind(hypr, "focusedMonitor").as(monitor => monitor.id)}
|
||||||
|
name={"launcher"}
|
||||||
|
cssClasses={["launcher"]}
|
||||||
|
keymode={Astal.Keymode.EXCLUSIVE}
|
||||||
|
anchor={TOP | BOTTOM | LEFT | RIGHT}
|
||||||
|
onKeyPressed={hideWindow}
|
||||||
|
application={App}>
|
||||||
|
<box hexpand={false} vertical halign={Gtk.Align.CENTER} valign={Gtk.Align.CENTER}>
|
||||||
|
<box cssClasses={["launcher"]} vertical>
|
||||||
|
<entry
|
||||||
|
placeholderText="Search"
|
||||||
|
onChanged={self => query.set(self.text)}
|
||||||
|
onActivate={onEnter}
|
||||||
|
/>
|
||||||
|
<box spacing={6} vertical>
|
||||||
|
{list.as(list => list.map(app => (
|
||||||
|
<AppButton app={app} />
|
||||||
|
)))}
|
||||||
|
</box>
|
||||||
|
<box
|
||||||
|
halign={Gtk.Align.CENTER}
|
||||||
|
cssClasses={["not-found"]}
|
||||||
|
vertical
|
||||||
|
visible={list.as(l => l.length === 0)}>
|
||||||
|
<image iconName="system-search-symbolic" />
|
||||||
|
<label label="No match found" />
|
||||||
|
</box>
|
||||||
|
</box>
|
||||||
|
</box>
|
||||||
|
</window>
|
||||||
|
}
|
71
ags/widget/quick_settings/bluetooth.tsx
Normal file
71
ags/widget/quick_settings/bluetooth.tsx
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import { App, Astal, Gtk } from "astal/gtk4";
|
||||||
|
import { bind, execAsync, Gio } from "astal";
|
||||||
|
|
||||||
|
import { hideWindow } from "@/lib/utils";
|
||||||
|
import Bluetooth from "gi://AstalBluetooth";
|
||||||
|
import Hyprland from "gi://AstalHyprland";
|
||||||
|
|
||||||
|
function DeviceMenu({ device, child }: { device: Bluetooth.Device, child?: JSX.Element }) {
|
||||||
|
const menu = Gio.Menu.new();
|
||||||
|
const copy_mac = Gio.MenuItem.new("Copy MAC address", "bt.copy_mac");
|
||||||
|
const toggle_state = Gio.MenuItem.new(device.get_connected() ? "Disconnect" : "Connect", "bt.toggle_state");
|
||||||
|
|
||||||
|
const action_group = Gio.SimpleActionGroup.new();
|
||||||
|
|
||||||
|
const copy_mac_action = Gio.SimpleAction.new("copy_mac", null);
|
||||||
|
copy_mac_action.connect("activate", () => execAsync(["wl-copy", device.address]));
|
||||||
|
|
||||||
|
const toggle_state_action = Gio.SimpleAction.new("toggle_state", null);
|
||||||
|
toggle_state_action.connect("activate", async () => {
|
||||||
|
if (device.connected)
|
||||||
|
await device.disconnect_device()
|
||||||
|
else
|
||||||
|
await device.connect_device()
|
||||||
|
})
|
||||||
|
|
||||||
|
menu.insert_item(1, copy_mac);
|
||||||
|
menu.insert_item(2, toggle_state);
|
||||||
|
|
||||||
|
action_group.insert(copy_mac_action);
|
||||||
|
action_group.insert(toggle_state_action);
|
||||||
|
|
||||||
|
return <menubutton
|
||||||
|
menuModel={menu}
|
||||||
|
setup={self => self.insert_action_group("bt", action_group)}
|
||||||
|
>
|
||||||
|
{child}
|
||||||
|
<popover>
|
||||||
|
<label label={"Copy MAC address"} />
|
||||||
|
<label label={"Toggle state"} />
|
||||||
|
</popover>
|
||||||
|
</menubutton>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function BluetoothWindow(_monitor_id: number) {
|
||||||
|
const CENTER = Gtk.Align.CENTER;
|
||||||
|
|
||||||
|
const bt = Bluetooth.get_default();
|
||||||
|
const hypr = Hyprland.get_default();
|
||||||
|
const devices = bind(bt, "devices");
|
||||||
|
|
||||||
|
return <window
|
||||||
|
name={"qs_bluetooth"}
|
||||||
|
cssClasses={["qs_bluetooth"]}
|
||||||
|
monitor={bind(hypr, "focusedMonitor").as(monitor => monitor.id)}
|
||||||
|
exclusivity={Astal.Exclusivity.IGNORE}
|
||||||
|
keymode={Astal.Keymode.EXCLUSIVE}
|
||||||
|
application={App}
|
||||||
|
onKeyPressed={hideWindow}
|
||||||
|
>
|
||||||
|
<box vertical halign={CENTER} cssClasses={["inner"]} spacing={5}>
|
||||||
|
{devices.as(devices => devices.map(device =>
|
||||||
|
<DeviceMenu device={device}>
|
||||||
|
<box cssClasses={["device", "small-padding"].concat(device.connected ? ["active"] : [])} spacing={3}>
|
||||||
|
<image iconName={device.icon} />
|
||||||
|
<label>{device.alias}</label>
|
||||||
|
</box>
|
||||||
|
</DeviceMenu>
|
||||||
|
))}
|
||||||
|
</box>
|
||||||
|
</window>
|
||||||
|
}
|
167
ags/widget/quick_settings/quick_settings.tsx
Normal file
167
ags/widget/quick_settings/quick_settings.tsx
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
import { bind, execAsync, Binding, Variable } from "astal";
|
||||||
|
import { App, Astal, Gdk, Gtk } from "astal/gtk4";
|
||||||
|
|
||||||
|
import Bluetooth from "gi://AstalBluetooth";
|
||||||
|
import Hyprland from "gi://AstalHyprland";
|
||||||
|
import Network from "gi://AstalNetwork";
|
||||||
|
|
||||||
|
import { SHELL, IDLE_INHIBIT_SCRIPT, RANDOM_WALLPAPER_SCRIPT } from "@/settings.json";
|
||||||
|
|
||||||
|
import { hideWindow, openOnButton } from "@lib/utils";
|
||||||
|
|
||||||
|
type ButtonProps = {
|
||||||
|
icon: string | Binding<string>,
|
||||||
|
command?: string,
|
||||||
|
label: string | Binding<string>,
|
||||||
|
binding?: Binding<boolean>,
|
||||||
|
bindingMethod?: (binding: boolean) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const isIdleInhibitorEnabled = async () => {
|
||||||
|
try {
|
||||||
|
await execAsync([SHELL, "-c", `pgrep -f ${IDLE_INHIBIT_SCRIPT}`]);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function Preference(props: ButtonProps & JSX.IntrinsicElements["button"]) {
|
||||||
|
const onClicked = () => {
|
||||||
|
if (props.command) execAsync([ SHELL, "-c", props.command ]);
|
||||||
|
else if (typeof props.binding !== 'undefined' && props.bindingMethod)
|
||||||
|
props.bindingMethod(!props.binding.get())
|
||||||
|
}
|
||||||
|
|
||||||
|
return <button
|
||||||
|
{...props}
|
||||||
|
label={undefined}
|
||||||
|
onClicked={onClicked}
|
||||||
|
cssClasses={props.binding?.as(active => active ? ["active"] : [])}
|
||||||
|
>
|
||||||
|
<box orientation={Gtk.Orientation.HORIZONTAL} spacing={4}>
|
||||||
|
<image iconName={props.icon} />
|
||||||
|
<label>{props.label}</label>
|
||||||
|
</box>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleIdleInhibitor(state: Variable<boolean>, enable: boolean) {
|
||||||
|
try {
|
||||||
|
if (enable) {
|
||||||
|
execAsync([SHELL, "-c", IDLE_INHIBIT_SCRIPT]);
|
||||||
|
} else {
|
||||||
|
const pids = await execAsync([SHELL, "-c", `pgrep -f ${IDLE_INHIBIT_SCRIPT}`]);
|
||||||
|
if (pids) {
|
||||||
|
const pidList = pids.trim().split("\n");
|
||||||
|
for (const pid of pidList) {
|
||||||
|
await execAsync(["kill", "-9", pid]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
state.set(!state.get());
|
||||||
|
} catch {
|
||||||
|
console.error("Failed to change state of idle inhibitor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function QuickSettings(_monitor_id: number) {
|
||||||
|
const { BOTTOM, LEFT, RIGHT } = Astal.WindowAnchor
|
||||||
|
const CENTER = Gtk.Align.CENTER;
|
||||||
|
|
||||||
|
const hypr = Hyprland.get_default();
|
||||||
|
const bt = Bluetooth.get_default();
|
||||||
|
const net = Network.get_default();
|
||||||
|
|
||||||
|
const connectedBtDevice = bind(bt, "devices").as(devices => devices.find(device => device.connected));
|
||||||
|
const idleInhibitorEnabled = Variable(await isIdleInhibitorEnabled());
|
||||||
|
|
||||||
|
return <window
|
||||||
|
visible={false}
|
||||||
|
name={"quick_settings"}
|
||||||
|
monitor={bind(hypr, "focusedMonitor").as(monitor => monitor.id)}
|
||||||
|
cssClasses={["quick_settings"]}
|
||||||
|
keymode={Astal.Keymode.EXCLUSIVE}
|
||||||
|
exclusivity={Astal.Exclusivity.IGNORE}
|
||||||
|
anchor={BOTTOM | LEFT | RIGHT}
|
||||||
|
onKeyPressed={hideWindow}
|
||||||
|
application={App}>
|
||||||
|
<box halign={CENTER} cssClasses={["inner"]} vertical>
|
||||||
|
<box orientation={Gtk.Orientation.HORIZONTAL} halign={CENTER}>
|
||||||
|
<Preference
|
||||||
|
icon={"network-wireless-symbolic"}
|
||||||
|
label={bind(Variable.derive([
|
||||||
|
bind(net.wifi, "enabled"),
|
||||||
|
bind(net.wifi, "ssid")
|
||||||
|
], (enabled, ssid) => enabled && ssid ? ssid : "Wi-Fi"))}
|
||||||
|
binding={bind(net.wifi, "enabled")}
|
||||||
|
bindingMethod={enabled => net.wifi.set_enabled(enabled)}
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon={bind(bt, "isConnected").as(c => c
|
||||||
|
? "bluetooth-active-symbolic"
|
||||||
|
: "bluetooth-disabled-symbolic"
|
||||||
|
)}
|
||||||
|
label={connectedBtDevice.as(device => bt.isPowered && device ? device.alias : "Bluetooth")}
|
||||||
|
binding={bind(bt, "isPowered")}
|
||||||
|
bindingMethod={() => bt.toggle()}
|
||||||
|
onButtonPressed={(_self, event) =>
|
||||||
|
openOnButton(event, Gdk.BUTTON_SECONDARY)
|
||||||
|
(() => App.toggle_window("qs_bluetooth"))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon={"uninterruptible-power-supply-symbolic"}
|
||||||
|
label={"Idle inhibitor"}
|
||||||
|
binding={bind(idleInhibitorEnabled)}
|
||||||
|
bindingMethod={toggleIdleInhibitor.bind(null, idleInhibitorEnabled)}
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon="preferences-desktop-wallpaper-symbolic"
|
||||||
|
command={RANDOM_WALLPAPER_SCRIPT}
|
||||||
|
label="Random wallpaper"
|
||||||
|
/>
|
||||||
|
</box>
|
||||||
|
<box orientation={Gtk.Orientation.HORIZONTAL} halign={CENTER}>
|
||||||
|
<Preference
|
||||||
|
icon="system-shutdown-symbolic"
|
||||||
|
command="systemctl poweroff"
|
||||||
|
label="Shutdown"
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon="system-reboot-symbolic"
|
||||||
|
command="systemctl reboot"
|
||||||
|
label="Reboot"
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon="preferences-system-privacy-symbolic"
|
||||||
|
command="systemctl suspend"
|
||||||
|
label="Suspend"
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon="application-exit-symbolic"
|
||||||
|
command="systemctl exit"
|
||||||
|
label="Exit session"
|
||||||
|
/>
|
||||||
|
</box>
|
||||||
|
<box orientation={Gtk.Orientation.HORIZONTAL} halign={CENTER}>
|
||||||
|
<Preference
|
||||||
|
icon="system-lock-screen-symbolic"
|
||||||
|
command="loginctl lock-session"
|
||||||
|
label="Lock Screen"
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon="system-log-out-symbolic"
|
||||||
|
command="loginctl terminate-user $(whoami)"
|
||||||
|
label="Log out"
|
||||||
|
/>
|
||||||
|
<Preference
|
||||||
|
icon="system-reboot-symbolic"
|
||||||
|
command="systemctl reboot --boot-loader-entry=menu"
|
||||||
|
label="Reboot to bootloader"
|
||||||
|
/>
|
||||||
|
</box>
|
||||||
|
</box>
|
||||||
|
</window>
|
||||||
|
}
|
1
hypr/.gitignore
vendored
Normal file
1
hypr/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
hyprland.conf
|
20
hypr/config/animations.conf
Normal file
20
hypr/config/animations.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
animations {
|
||||||
|
enabled = yes
|
||||||
|
|
||||||
|
bezier = menuOpen, 0.1, 1, 0, 1
|
||||||
|
bezier = menuClose, 0.38, 0.04, 1, 0.07
|
||||||
|
|
||||||
|
bezier = bezier, 0.05, 1, 0, 1
|
||||||
|
animation = windows, 1, 3, bezier
|
||||||
|
animation = windowsOut, 1, 7, bezier, popin 80%
|
||||||
|
|
||||||
|
animation = border, 1, 10, default
|
||||||
|
animation = borderangle, 1, 8, default
|
||||||
|
animation = fade, 1, 7, default
|
||||||
|
animation = workspaces, 1, 6, default
|
||||||
|
|
||||||
|
animation = layersIn, 1, 3, menuOpen, slide
|
||||||
|
animation = layersOut, 1, 1.6, menuClose
|
||||||
|
animation = fadeLayersIn, 1, 2, menuOpen
|
||||||
|
animation = fadeLayersOut, 1, 4.5, menuClose
|
||||||
|
}
|
12
hypr/config/autostart.conf
Normal file
12
hypr/config/autostart.conf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
exec-once = $SHELL -c 'hypridle'
|
||||||
|
|
||||||
|
# Wallpaper engine
|
||||||
|
exec-once = swww-daemon &
|
||||||
|
exec-once = ~/.config/hypr/scripts/random-wallpaper.sh
|
||||||
|
|
||||||
|
# Clipboard
|
||||||
|
exec-once = wl-paste --watch cliphist store
|
||||||
|
|
||||||
|
# AGS + Birdtray
|
||||||
|
exec-once = $SHELL -c 'ags run --gtk4 &'
|
||||||
|
exec-once = $SHELL -c 'sleep 10 && birdtray &'
|
78
hypr/config/binds.conf
Normal file
78
hypr/config/binds.conf
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
$mainMod = SUPER
|
||||||
|
|
||||||
|
bindd = $mainMod, Return, Run terminal, exec, $terminal
|
||||||
|
bindd = $mainMod, Q, Kill active window, killactive,
|
||||||
|
bindd = $mainMod + Shift, Q, Exit Hyprland, exit,
|
||||||
|
bindd = $mainMod, E, File manager, exec, $fileManager
|
||||||
|
bindd = $mainMod, B, Browser, exec, $browser
|
||||||
|
bindd = $mainMod, P, Open e-mail client, exec, $email
|
||||||
|
bindd = $mainMod, J, Toggle split, togglesplit,
|
||||||
|
|
||||||
|
bindd = $mainMod + Shift, V, Toggle floating state, togglefloating,
|
||||||
|
bindd = $mainMod, F, Toggle fullscreen, fullscreen,
|
||||||
|
bindd = $mainMod + Shift, F, Toggle fullscreen (bars), fullscreen, 1
|
||||||
|
|
||||||
|
bindd = $mainMod, Left, Move focus left, movefocus, l
|
||||||
|
bindd = $mainMod, Right, Move focus right, movefocus, r
|
||||||
|
bindd = $mainMod, Up, Move focus up, movefocus, u
|
||||||
|
bindd = $mainMod, Down, Move focus down, movefocus, d
|
||||||
|
|
||||||
|
bindd = Alt, Tab, Go to next window, cyclenext
|
||||||
|
bindd = Alt + Shift, Tab, Go to previous window, cyclenext, prev
|
||||||
|
bind = Alt, Tab, bringactivetotop
|
||||||
|
bind = Alt + Shift, Tab, bringactivetotop
|
||||||
|
|
||||||
|
bindd = $mainMod, 1, Switch to workspace 1, workspace, 1
|
||||||
|
bindd = $mainMod, 2, Switch to workspace 2, workspace, 2
|
||||||
|
bindd = $mainMod, 3, Switch to workspace 3, workspace, 3
|
||||||
|
bindd = $mainMod, 4, Switch to workspace 4, workspace, 4
|
||||||
|
bindd = $mainMod, 5, Switch to workspace 5, workspace, 5
|
||||||
|
bindd = $mainMod, 6, Switch to workspace 6, workspace, 6
|
||||||
|
bindd = $mainMod, 7, Switch to workspace 7, workspace, 7
|
||||||
|
bindd = $mainMod, 8, Switch to workspace 8, workspace, 8
|
||||||
|
bindd = $mainMod, 9, Switch to workspace 9, workspace, 9
|
||||||
|
bindd = $mainMod, 0, Switch to workspace 10, workspace, 10
|
||||||
|
|
||||||
|
bindd = $mainMod + Shift, 1, Move to workspace 1, movetoworkspace, 1
|
||||||
|
bindd = $mainMod + Shift, 2, Move to workspace 2, movetoworkspace, 2
|
||||||
|
bindd = $mainMod + Shift, 3, Move to workspace 3, movetoworkspace, 3
|
||||||
|
bindd = $mainMod + Shift, 4, Move to workspace 4, movetoworkspace, 4
|
||||||
|
bindd = $mainMod + Shift, 5, Move to workspace 5, movetoworkspace, 5
|
||||||
|
bindd = $mainMod + Shift, 6, Move to workspace 6, movetoworkspace, 6
|
||||||
|
bindd = $mainMod + Shift, 7, Move to workspace 7, movetoworkspace, 7
|
||||||
|
bindd = $mainMod + Shift, 8, Move to workspace 8, movetoworkspace, 8
|
||||||
|
bindd = $mainMod + Shift, 9, Move to workspace 9, movetoworkspace, 9
|
||||||
|
bindd = $mainMod + Shift, 0, Move to workspace 10, movetoworkspace, 10
|
||||||
|
|
||||||
|
bindd = $mainMod, Tab, Toggle workspace overview, overview:toggle
|
||||||
|
bindd = $mainMod, S, Toggle special workspace, togglespecialworkspace, magic
|
||||||
|
bindd = $mainMod + Shift, S, Move to special workspace, movetoworkspace, special:magic
|
||||||
|
|
||||||
|
bindd = $mainMod, mouse_down, Switch to next workspace, workspace, e+1
|
||||||
|
bindd = $mainMod, mouse_up, Switch to prev workspace, workspace, e-1
|
||||||
|
|
||||||
|
bindmd = $mainMod, mouse:272, Move window, movewindow
|
||||||
|
bindmd = $mainMod, mouse:273, Resize window, resizewindow
|
||||||
|
|
||||||
|
bindd = , PRINT, Take partial screenshot, exec, hyprshot -zm region -o $screenshot_dir
|
||||||
|
bindd = $mainMod, PRINT, Take fullscreen screenshot, exec, hyprshot -zm output -o $screenshot_dir
|
||||||
|
|
||||||
|
bindd = $mainMod, Space, Open app launcher, exec, ags toggle launcher
|
||||||
|
bindd = $mainMod + Shift, T, Toggle bar, exec, ~/.config/hypr/scripts/toggle-bar-visibility.sh
|
||||||
|
bindd = $mainMod, SUPER_L, Open quick settings, exec, ags toggle quick_settings
|
||||||
|
bindd = Ctrl+Shift, R, Reload AGS, exec, ags quit; ags run --gtk4 &
|
||||||
|
|
||||||
|
bindd = , XF86AudioRaiseVolume, Raise volume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
|
||||||
|
bindd = , XF86AudioLowerVolume, Lower volume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
||||||
|
bindd = , XF86AudioMute, Mute audio, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||||
|
bindd = , XF86AudioMicMute, Mute mic, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
||||||
|
bindd = , XF86MonBrightnessUp, Increase brightness, exec, light -A 15
|
||||||
|
bindd = , XF86MonBrightnessDown, Decrease brightness, exec, light -U 15
|
||||||
|
|
||||||
|
bindd = , XF86AudioNext, Next track, exec, playerctl next
|
||||||
|
bindd = , XF86AudioPause, Play/pause track, exec, playerctl play-pause
|
||||||
|
bindd = , XF86AudioPlay, Play/pause track, exec, playerctl play-pause
|
||||||
|
bindd = , XF86AudioPrev, Previous track, exec, playerctl previous
|
||||||
|
|
||||||
|
bindd = , XF86RFKill, Toggle wireless, exec, nmcli radio all toggle
|
||||||
|
bindd = , XF86Bluetooth, Toggle Bluetooth, exec, bluetoothctl power toggle
|
17
hypr/config/io.conf
Normal file
17
hypr/config/io.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
input {
|
||||||
|
kb_layout = pl
|
||||||
|
kb_variant =
|
||||||
|
kb_model =
|
||||||
|
kb_options =
|
||||||
|
kb_rules =
|
||||||
|
|
||||||
|
follow_mouse = 1
|
||||||
|
sensitivity = 0.7
|
||||||
|
|
||||||
|
touchpad {
|
||||||
|
natural_scroll = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor = eDP-1, 3840x2160@60, 0x0, 1
|
||||||
|
#monitor = HDMI-A-2, 1920x1080@60, 0x3840, 1
|
38
hypr/config/misc.conf
Normal file
38
hypr/config/misc.conf
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
general {
|
||||||
|
gaps_in = 5
|
||||||
|
gaps_out = 5
|
||||||
|
|
||||||
|
layout = master
|
||||||
|
}
|
||||||
|
|
||||||
|
decoration {
|
||||||
|
rounding = 10
|
||||||
|
|
||||||
|
active_opacity = 1.0
|
||||||
|
inactive_opacity = 0.8
|
||||||
|
|
||||||
|
shadow {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
blur {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gestures {
|
||||||
|
workspace_swipe = true
|
||||||
|
workspace_swipe_fingers = 3
|
||||||
|
workspace_swipe_create_new = true
|
||||||
|
}
|
||||||
|
|
||||||
|
misc {
|
||||||
|
vfr = true
|
||||||
|
allow_session_lock_restore = true
|
||||||
|
force_default_wallpaper = 0
|
||||||
|
disable_hyprland_logo = true
|
||||||
|
}
|
||||||
|
|
||||||
|
xwayland {
|
||||||
|
force_zero_scaling = true
|
||||||
|
}
|
20
hypr/config/rules.conf
Normal file
20
hypr/config/rules.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
windowrule = center, title:^(Open File)(.*)$
|
||||||
|
windowrule = center, title:^(Select a File)(.*)$
|
||||||
|
windowrule = center, title:^(Choose wallpaper)(.*)$
|
||||||
|
windowrule = center, title:^(Open Folder)(.*)$
|
||||||
|
windowrule = center, title:^(Save As)(.*)$
|
||||||
|
windowrule = center, title:^(Library)(.*)$
|
||||||
|
windowrule = center, title:^(File Upload)(.*)$
|
||||||
|
|
||||||
|
windowrule = float, title:^(Open File)(.*)$
|
||||||
|
windowrule = float, title:^(Select a File)(.*)$
|
||||||
|
windowrule = float, title:^(Choose wallpaper)(.*)$
|
||||||
|
windowrule = float, title:^(Open Folder)(.*)$
|
||||||
|
windowrule = float, title:^(Save As)(.*)$
|
||||||
|
windowrule = float, title:^(Library)(.*)$
|
||||||
|
windowrule = float, title:^(File Upload)(.*)$
|
||||||
|
|
||||||
|
windowrulev2 = size 1280 720, title:(.*)(Mozilla Thunderbird)
|
||||||
|
windowrulev2 = float, initialClass:thunderbird
|
||||||
|
|
||||||
|
layerrule = noanim, selection
|
10
hypr/config/workspaces.conf
Normal file
10
hypr/config/workspaces.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
workspace=1,monitor:eDP-1
|
||||||
|
workspace=2,monitor:eDP-1
|
||||||
|
workspace=3,monitor:eDP-1
|
||||||
|
workspace=4,monitor:eDP-1
|
||||||
|
workspace=5,monitor:eDP-1
|
||||||
|
workspace=6,monitor:HDMI-A-2
|
||||||
|
workspace=7,monitor:HDMI-A-2
|
||||||
|
workspace=8,monitor:HDMI-A-2
|
||||||
|
workspace=9,monitor:HDMI-A-2
|
||||||
|
workspace=10,monitor:HDMI-A-2
|
30
hypr/hypridle.conf
Normal file
30
hypr/hypridle.conf
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
$lock_cmd = pidof hyprlock || hyprlock
|
||||||
|
$suspend_cmd = pidof steam || systemctl suspend || loginctl suspend
|
||||||
|
|
||||||
|
general {
|
||||||
|
lock_cmd = $lock_cmd
|
||||||
|
before_sleep_cmd = loginctl lock-session
|
||||||
|
after_sleep_cmd = hyprctl dispatch dpms on
|
||||||
|
}
|
||||||
|
|
||||||
|
listener {
|
||||||
|
timeout = 180
|
||||||
|
on-timeout = loginctl lock-session
|
||||||
|
}
|
||||||
|
|
||||||
|
listener {
|
||||||
|
timeout = 240
|
||||||
|
on-timeout = light -U 30
|
||||||
|
on-resume = light -A 30
|
||||||
|
}
|
||||||
|
|
||||||
|
listener {
|
||||||
|
timeout = 320
|
||||||
|
on-timeout = hyprctl dispatch dpms off
|
||||||
|
on-resume = hyprctl dispatch dpms on
|
||||||
|
}
|
||||||
|
|
||||||
|
listener {
|
||||||
|
timeout = 540
|
||||||
|
on-timeout = $suspend_cmd
|
||||||
|
}
|
65
hypr/hyprlock.conf
Normal file
65
hypr/hyprlock.conf
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
general {
|
||||||
|
enable_fingerprint = true
|
||||||
|
fingerprint_ready_message = Place your finger on the sensor
|
||||||
|
fingerprint_present_message = Scanning finger
|
||||||
|
}
|
||||||
|
|
||||||
|
background {
|
||||||
|
monitor =
|
||||||
|
path = screenshot
|
||||||
|
blur_passes = 2
|
||||||
|
contrast = 0.8916
|
||||||
|
brightness = 0.7172
|
||||||
|
vibrancy = 0.1696
|
||||||
|
vibrancy_darkness = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
input-field {
|
||||||
|
monitor =
|
||||||
|
size = 250, 50
|
||||||
|
outline_thickness = 2
|
||||||
|
dots_size = 0.1
|
||||||
|
dots_spacing = 0.3
|
||||||
|
font_color = rgb(000000)
|
||||||
|
fade_on_empty = true
|
||||||
|
|
||||||
|
position = 0, 20
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
monitor =
|
||||||
|
text = $TIME
|
||||||
|
color = rgb(FFFFFF)
|
||||||
|
font_size = 85
|
||||||
|
font_family = SF Pro Display Black
|
||||||
|
|
||||||
|
position = 0, 300
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
monitor =
|
||||||
|
text = hello, $USER
|
||||||
|
color = rgb(FFFFFF)
|
||||||
|
font_size = 20
|
||||||
|
font_family = SF Pro Display Bold
|
||||||
|
|
||||||
|
position = 0, 230
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
monitor =
|
||||||
|
text = $FPRINTMESSAGE
|
||||||
|
color = rgb(FFFFFF)
|
||||||
|
font_size = 15
|
||||||
|
|
||||||
|
position = 0, 180
|
||||||
|
halign = center
|
||||||
|
valign = center
|
||||||
|
}
|
81
hypr/scripts/idle-inhibitor.py
Executable file
81
hypr/scripts/idle-inhibitor.py
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from signal import SIGINT, SIGTERM, signal
|
||||||
|
from threading import Event
|
||||||
|
|
||||||
|
from pywayland.client.display import Display
|
||||||
|
from pywayland.protocol.idle_inhibit_unstable_v1.zwp_idle_inhibit_manager_v1 import (
|
||||||
|
ZwpIdleInhibitManagerV1,
|
||||||
|
)
|
||||||
|
from pywayland.protocol.wayland.wl_compositor import WlCompositor
|
||||||
|
from pywayland.protocol.wayland.wl_registry import WlRegistryProxy
|
||||||
|
from pywayland.protocol.wayland.wl_surface import WlSurface
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class GlobalRegistry:
|
||||||
|
surface: WlSurface | None = None
|
||||||
|
inhibit_manager: ZwpIdleInhibitManagerV1 | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def handle_registry_global(
|
||||||
|
wl_registry: WlRegistryProxy, id_num: int, iface_name: str, version: int
|
||||||
|
) -> None:
|
||||||
|
global_registry: GlobalRegistry = wl_registry.user_data or GlobalRegistry()
|
||||||
|
|
||||||
|
if iface_name == "wl_compositor":
|
||||||
|
compositor = wl_registry.bind(id_num, WlCompositor, version)
|
||||||
|
global_registry.surface = compositor.create_surface() # type: ignore
|
||||||
|
elif iface_name == "zwp_idle_inhibit_manager_v1":
|
||||||
|
global_registry.inhibit_manager = wl_registry.bind(
|
||||||
|
id_num, ZwpIdleInhibitManagerV1, version
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
done = Event()
|
||||||
|
signal(SIGINT, lambda _, __: done.set())
|
||||||
|
signal(SIGTERM, lambda _, __: done.set())
|
||||||
|
|
||||||
|
global_registry = GlobalRegistry()
|
||||||
|
|
||||||
|
display = Display()
|
||||||
|
display.connect()
|
||||||
|
|
||||||
|
registry = display.get_registry() # type: ignore
|
||||||
|
registry.user_data = global_registry
|
||||||
|
registry.dispatcher["global"] = handle_registry_global
|
||||||
|
|
||||||
|
def shutdown() -> None:
|
||||||
|
display.dispatch()
|
||||||
|
display.roundtrip()
|
||||||
|
display.disconnect()
|
||||||
|
|
||||||
|
display.dispatch()
|
||||||
|
display.roundtrip()
|
||||||
|
|
||||||
|
if global_registry.surface is None or global_registry.inhibit_manager is None:
|
||||||
|
print("Wayland seems not to support idle_inhibit_unstable_v1 protocol.")
|
||||||
|
shutdown()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
inhibitor = global_registry.inhibit_manager.create_inhibitor( # type: ignore
|
||||||
|
global_registry.surface
|
||||||
|
)
|
||||||
|
|
||||||
|
display.dispatch()
|
||||||
|
display.roundtrip()
|
||||||
|
|
||||||
|
print("Inhibiting idle...")
|
||||||
|
done.wait()
|
||||||
|
print("Shutting down...")
|
||||||
|
|
||||||
|
inhibitor.destroy()
|
||||||
|
|
||||||
|
shutdown()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
31
hypr/scripts/random-wallpaper.sh
Executable file
31
hypr/scripts/random-wallpaper.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env -S bash
|
||||||
|
|
||||||
|
WALLPAPER_DIR="$HOME/images/wallpapers"
|
||||||
|
THEME=$(darkman get)
|
||||||
|
FLAGS=()
|
||||||
|
|
||||||
|
if [ ! -d "$WALLPAPER_DIR" ]; then
|
||||||
|
echo "Wallpaper directory does not exist: $WALLPAPER_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$THEME" == "light" ]]; then
|
||||||
|
FLAGS+=("-l")
|
||||||
|
fi
|
||||||
|
|
||||||
|
WALLPAPER=$(find "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.png" -o -iname "*.jpeg" \) | shuf -n 1)
|
||||||
|
|
||||||
|
swww img "$WALLPAPER" \
|
||||||
|
--transition-type random \
|
||||||
|
--transition-duration 0.8 \
|
||||||
|
--transition-fps 60
|
||||||
|
|
||||||
|
if command -v "wal" &> /dev/null; then
|
||||||
|
wal -i "$WALLPAPER" -n ${FLAGS[@]}
|
||||||
|
cp ~/.cache/wal/colors.scss ~/.config/ags/styles/colors.scss
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v "pywalfox" &> /dev/null; then
|
||||||
|
pywalfox $THEME
|
||||||
|
pywalfox update
|
||||||
|
fi
|
7
hypr/scripts/toggle-bar-visibility.sh
Executable file
7
hypr/scripts/toggle-bar-visibility.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env -S bash
|
||||||
|
|
||||||
|
monitors=$(hyprctl monitors -j | jq -r '.[].id')
|
||||||
|
|
||||||
|
for monitor in $monitors; do
|
||||||
|
ags toggle "bar_$monitor"
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user