feat: get rid of all random bash scripts
This commit is contained in:
parent
bba90cd8b6
commit
441c06f83d
9 changed files with 101 additions and 100 deletions
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
FILE="$HOME/.config/.heart"
|
|
||||||
|
|
||||||
toggle() {
|
|
||||||
if grep -q "$FILE"; then
|
|
||||||
echo > "$FILE"
|
|
||||||
else
|
|
||||||
echo >> "$FILE"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ "$1" == "toggle" ]] && toggle
|
|
|
@ -1,32 +1,46 @@
|
||||||
import { ProgressBar, Overlay, Box } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, EventBox, Icon, Label, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import Brightness from '../../../services/brightness.js';
|
import Brightness from '../../../services/brightness.js';
|
||||||
import Separator from '../../misc/separator.js';
|
import Separator from '../../misc/separator.js';
|
||||||
import Heart from './heart.js';
|
|
||||||
|
|
||||||
const SPACING = 25;
|
const SPACING = 5;
|
||||||
const BAR_CUTOFF = 0.33;
|
|
||||||
|
|
||||||
|
|
||||||
export default () => Overlay({
|
const BrightnessPercentLabel = (props) => Label({
|
||||||
tooltipText: 'Brightness',
|
...props,
|
||||||
|
connections: [[Brightness, (self) => {
|
||||||
|
self.label = `${Math.round(Brightness.screen * 100)}%`;
|
||||||
|
}, 'screen']],
|
||||||
|
});
|
||||||
|
|
||||||
child: ProgressBar({
|
export default () => {
|
||||||
className: 'toggle-off brightness',
|
const rev = Revealer({
|
||||||
connections: [[Brightness, (self) => {
|
transition: 'slide_right',
|
||||||
self.value = Brightness.screen > BAR_CUTOFF ?
|
child: Box({
|
||||||
Brightness.screen :
|
|
||||||
BAR_CUTOFF;
|
|
||||||
}, 'screen']],
|
|
||||||
}),
|
|
||||||
|
|
||||||
overlays: [
|
|
||||||
Box({
|
|
||||||
css: 'color: #CBA6F7;',
|
|
||||||
children: [
|
children: [
|
||||||
Separator(SPACING),
|
Separator(SPACING),
|
||||||
Heart(),
|
BrightnessPercentLabel(),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
});
|
||||||
});
|
|
||||||
|
const widget = EventBox({
|
||||||
|
onHover: () => {
|
||||||
|
rev.revealChild = true;
|
||||||
|
},
|
||||||
|
onHoverLost: () => {
|
||||||
|
rev.revealChild = false;
|
||||||
|
},
|
||||||
|
child: Box({
|
||||||
|
className: 'brightness',
|
||||||
|
children: [
|
||||||
|
Icon('display-brightness-symbolic'),
|
||||||
|
rev,
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
widget.rev = rev;
|
||||||
|
|
||||||
|
return widget;
|
||||||
|
};
|
||||||
|
|
|
@ -1,31 +1,46 @@
|
||||||
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
import { subprocess, execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
import { execAsync, readFileAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
|
|
||||||
|
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
|
||||||
|
|
||||||
|
const { get_home_dir } = imports.gi.GLib;
|
||||||
|
|
||||||
import EventBox from '../../misc/cursorbox.js';
|
import EventBox from '../../misc/cursorbox.js';
|
||||||
|
|
||||||
|
const HeartState = Variable('');
|
||||||
|
const heartFile = `${get_home_dir()}/.cache/ags/.heart`;
|
||||||
|
|
||||||
export default () => EventBox({
|
const stateCmd = () => ['bash', '-c',
|
||||||
hpack: 'center',
|
`echo ${HeartState.value === ''} > ${heartFile}`];
|
||||||
|
const monitorState = () => {
|
||||||
|
HeartState.connect('changed', () => {
|
||||||
|
execAsync(stateCmd()).catch(print);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
onPrimaryClickRelease: () => {
|
// On launch
|
||||||
execAsync(['bash', '-c', '$AGS_PATH/heart.sh toggle']).catch(print);
|
readFileAsync(heartFile).then((content) => {
|
||||||
},
|
HeartState.value = JSON.parse(content) ? '' : '';
|
||||||
|
monitorState();
|
||||||
child: Box({
|
}).catch(() => {
|
||||||
className: 'heart-toggle',
|
execAsync(stateCmd()).then(() => {
|
||||||
vertical: false,
|
monitorState();
|
||||||
|
}).catch(print);
|
||||||
child: Label({
|
|
||||||
label: '',
|
|
||||||
|
|
||||||
setup: (self) => {
|
|
||||||
subprocess(
|
|
||||||
['bash', '-c', 'tail -f /home/matt/.config/.heart'],
|
|
||||||
(output) => {
|
|
||||||
self.label = ` ${output}`;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return EventBox({
|
||||||
|
onPrimaryClickRelease: () => {
|
||||||
|
HeartState.value = HeartState.value === '' ? '' : '';
|
||||||
|
},
|
||||||
|
|
||||||
|
child: Box({
|
||||||
|
className: 'heart-toggle',
|
||||||
|
|
||||||
|
child: Label({
|
||||||
|
binds: [['label', HeartState, 'value']],
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import Audio from './audio.js';
|
import Audio from './audio.js';
|
||||||
import Bluetooth from './bluetooth.js';
|
import Bluetooth from './bluetooth.js';
|
||||||
|
import Brightness from './brightness.js';
|
||||||
import KeyboardLayout from './keyboard-layout.js';
|
import KeyboardLayout from './keyboard-layout.js';
|
||||||
import Network from './network.js';
|
import Network from './network.js';
|
||||||
|
|
||||||
|
@ -34,6 +35,8 @@ export default () => EventBox({
|
||||||
|
|
||||||
KeyboardLayout(),
|
KeyboardLayout(),
|
||||||
|
|
||||||
|
Brightness(),
|
||||||
|
|
||||||
Audio(),
|
Audio(),
|
||||||
|
|
||||||
Bluetooth(),
|
Bluetooth(),
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { Window, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.
|
||||||
import Separator from '../misc/separator.js';
|
import Separator from '../misc/separator.js';
|
||||||
|
|
||||||
import Battery from './buttons/battery.js';
|
import Battery from './buttons/battery.js';
|
||||||
import Brightness from './buttons/brightness.js';
|
|
||||||
import Clock from './buttons/clock.js';
|
import Clock from './buttons/clock.js';
|
||||||
import CurrentWindow from './buttons/current-window.js';
|
import CurrentWindow from './buttons/current-window.js';
|
||||||
|
import Heart from './buttons/heart.js';
|
||||||
import NotifButton from './buttons/notif-button.js';
|
import NotifButton from './buttons/notif-button.js';
|
||||||
import OskToggle from './buttons/osk-toggle.js';
|
import OskToggle from './buttons/osk-toggle.js';
|
||||||
import QsToggle from './buttons/quick-settings.js';
|
import QsToggle from './buttons/quick-settings.js';
|
||||||
|
@ -64,7 +64,7 @@ export default () => Window({
|
||||||
endWidget: Box({
|
endWidget: Box({
|
||||||
hpack: 'end',
|
hpack: 'end',
|
||||||
children: [
|
children: [
|
||||||
Brightness(),
|
Heart(),
|
||||||
|
|
||||||
Separator(SPACING),
|
Separator(SPACING),
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
||||||
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
||||||
import { execAsync, readFileAsync, timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
import { execAsync, readFileAsync, timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
|
|
||||||
|
const { get_home_dir } = imports.gi.GLib;
|
||||||
|
|
||||||
import Brightness from '../services/brightness.js';
|
import Brightness from '../services/brightness.js';
|
||||||
import Pointers from '../services/pointers.js';
|
import Pointers from '../services/pointers.js';
|
||||||
import Tablet from '../services/tablet.js';
|
import Tablet from '../services/tablet.js';
|
||||||
|
@ -17,9 +19,9 @@ export default () => {
|
||||||
globalThis.closeAll = closeAll;
|
globalThis.closeAll = closeAll;
|
||||||
|
|
||||||
// Persist Bluetooth state
|
// Persist Bluetooth state
|
||||||
const bluetoothStateFile = '/home/matt/.cache/ags/.bluetooth';
|
const bluetoothFile = `${get_home_dir()}/.cache/ags/.bluetooth`;
|
||||||
const stateCmd = () => ['bash', '-c',
|
const stateCmd = () => ['bash', '-c',
|
||||||
`echo ${Bluetooth.enabled} > ${bluetoothStateFile}`];
|
`echo ${Bluetooth.enabled} > ${bluetoothFile}`];
|
||||||
const monitorState = () => {
|
const monitorState = () => {
|
||||||
Bluetooth.connect('notify::enabled', () => {
|
Bluetooth.connect('notify::enabled', () => {
|
||||||
execAsync(stateCmd()).catch(print);
|
execAsync(stateCmd()).catch(print);
|
||||||
|
@ -27,20 +29,16 @@ export default () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// On launch
|
// On launch
|
||||||
readFileAsync(bluetoothStateFile)
|
readFileAsync(bluetoothFile).then((content) => {
|
||||||
.then((content) => {
|
Bluetooth.enabled = JSON.parse(content);
|
||||||
Bluetooth.enabled = JSON.parse(content);
|
timeout(1000, () => {
|
||||||
timeout(1000, () => {
|
monitorState();
|
||||||
monitorState();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
execAsync(stateCmd())
|
|
||||||
.then(() => {
|
|
||||||
monitorState();
|
|
||||||
})
|
|
||||||
.catch(print);
|
|
||||||
});
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
execAsync(stateCmd()).then(() => {
|
||||||
|
monitorState();
|
||||||
|
}).catch(print);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
TouchGestures.addGesture({
|
TouchGestures.addGesture({
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
min-width: 53px;
|
min-width: 53px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.heart-toggle {
|
||||||
|
font-size: 28px;
|
||||||
|
min-height: 40px;
|
||||||
|
color: #CBA6F7;
|
||||||
|
}
|
||||||
|
|
||||||
.notif-panel {
|
.notif-panel {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
min-height: 37px;
|
min-height: 37px;
|
||||||
|
@ -54,7 +60,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio,
|
.audio,
|
||||||
.bluetooth {
|
.bluetooth,
|
||||||
|
.brightness {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin-right: -10px;
|
margin-right: -10px;
|
||||||
|
@ -103,20 +110,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.brightness {
|
|
||||||
trough {
|
|
||||||
margin-right: -50px;
|
|
||||||
|
|
||||||
progress {
|
|
||||||
margin-right: 50px;
|
|
||||||
margin-top: -30px;
|
|
||||||
border-radius: 80px;
|
|
||||||
min-height: 36px;
|
|
||||||
background: rgba(#5e497c, 0.8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tooltip {
|
tooltip {
|
||||||
background: rgba(0,0,0, 0.6);
|
background: rgba(0,0,0, 0.6);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
|
@ -2,15 +2,6 @@
|
||||||
configDir = config.vars.configDir;
|
configDir = config.vars.configDir;
|
||||||
symlink = config.lib.file.mkOutOfStoreSymlink;
|
symlink = config.lib.file.mkOutOfStoreSymlink;
|
||||||
in {
|
in {
|
||||||
wayland.windowManager.hyprland = {
|
|
||||||
settings = {
|
|
||||||
env = [
|
|
||||||
"AGS_PATH, ${configDir}/ags/bin"
|
|
||||||
"HYPR_PATH, ${configDir}/hypr/scripts"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
"dolphinrc".source = symlink "${configDir}/dolphinrc";
|
"dolphinrc".source = symlink "${configDir}/dolphinrc";
|
||||||
"kdeglobals".source = symlink "${configDir}/kdeglobals";
|
"kdeglobals".source = symlink "${configDir}/kdeglobals";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
home.packages =
|
home.packages =
|
||||||
(with pkgs.python311Packages; [
|
(with pkgs.python311Packages; [
|
||||||
python
|
python
|
||||||
pyclip
|
pyclip # For Waydroid?
|
||||||
])
|
])
|
||||||
++ (with pkgs; [
|
++ (with pkgs; [
|
||||||
# Misc CLI
|
# Misc CLI
|
||||||
|
|
Loading…
Reference in a new issue