forked from Shinonome/dots-hyprland
Merge branch 'main' into ii-qs
This commit is contained in:
@@ -145,7 +145,6 @@
|
||||
"Options": "Options",
|
||||
"Dark Mode": "Dark Mode",
|
||||
"Ya should go to sleep!": "Ya should go to sleep!",
|
||||
"Use Gradience": "Use Gradience",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)",
|
||||
"Scheme styles": "Scheme styles",
|
||||
"Vibrant": "Vibrant",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "گزینهها",
|
||||
"Dark Mode": "حالت تاریک",
|
||||
"Ya should go to sleep!": "پاشو برو بخواب!",
|
||||
"Use Gradience": "بکارگیری رنگ شیب دار(Gradience)",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "برنامههای GTK را با بکارگیری رنگ تأکید پوسته گذاری کنید\n(معایب: تغییر حالت تاریک/روشن نیاز به باز راهاندازی دارد)",
|
||||
"Scheme styles": "سبکهای طرح",
|
||||
"Vibrant": "زنده",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "Options",
|
||||
"Dark Mode": "Mode sombre",
|
||||
"Ya should go to sleep!": "Tu devrais aller dormir !",
|
||||
"Use Gradience": "Utiliser Gradience",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Thématiser les applications GTK avec la couleur d'accent\n(inconvénient : le changement de mode sombre/clair nécessite un redémarrage)",
|
||||
"Scheme styles": "Styles de schéma",
|
||||
"Vibrant": "Vibrant",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "Opzioni",
|
||||
"Dark Mode": "Modalità scura",
|
||||
"Ya should go to sleep!": "Dovresti andare a dormire!",
|
||||
"Use Gradience": "Usa Gradience",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Tema le app GTK usando il colore di accento\n(svantaggio: il passaggio tra modalità scura/chiara richiede un riavvio)",
|
||||
"Scheme styles": "Stili dello schema",
|
||||
"Vibrant": "Vivace",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "选项",
|
||||
"Dark Mode": "深色模式",
|
||||
"Ya should go to sleep!": "你应该去睡觉!",
|
||||
"Use Gradience": "GTK 主题",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "使用强调色对 GTK 应用程序进行主题化\n(缺点:深色/浅色模式切换需要重启)",
|
||||
"Scheme styles": "样式方案",
|
||||
"Vibrant": "鲜艳",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const { GLib } = imports.gi;
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
const { execAsync, exec } = Utils;
|
||||
|
||||
@@ -5,7 +6,7 @@ import { getNestedProperty, updateNestedProperty } from "../.miscutils/objects.j
|
||||
import { ConfigSpinButton, ConfigToggle } from "./configwidgets.js";
|
||||
|
||||
const AGS_CONFIG_FILE = `${App.configDir}/user_options.jsonc`;
|
||||
const HYPRLAND_CONFIG_FILE = `\${XDG_CONFIG_HOME:-$HOME/.config}/hypr/custom/general.conf`;
|
||||
const HYPRLAND_CONFIG_FILE = `${GLib.get_user_config_dir()}/hypr/custom/general.conf`;
|
||||
|
||||
export const AgsToggle = ({
|
||||
icon, name, desc = null,
|
||||
|
||||
@@ -38,17 +38,13 @@ function guessMessageType(summary) {
|
||||
return 'chat';
|
||||
}
|
||||
|
||||
function exists(widget) {
|
||||
return widget !== null;
|
||||
}
|
||||
|
||||
function processNotificationBody(body, appEntry) {
|
||||
// Only process Chrome/Chromium notifications
|
||||
let processedBody = body;
|
||||
if (appEntry?.toLowerCase().includes('chrome')) {
|
||||
// Remove the first line
|
||||
return body.split('\n\n').slice(1).join('\n\n');
|
||||
processedBody = body.split('\n\n').slice(1).join('\n\n');
|
||||
}
|
||||
return body;
|
||||
processedBody = processedBody.replace(/<[^>]*>/g, '');
|
||||
return processedBody;
|
||||
}
|
||||
|
||||
const getFriendlyNotifTimeString = (timeObject) => {
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
"firefox",
|
||||
"org.gnome.Nautilus"
|
||||
],
|
||||
"ignoredAppsRegex": [],
|
||||
"layer": "top",
|
||||
"monitorExclusivity": true, // Dock will move to other monitor along with focus if enabled
|
||||
"searchPinnedAppIcons": false, // Try to search for the correct icon if the app class isn't an icon name
|
||||
@@ -241,6 +242,7 @@
|
||||
"wps": "wps-office2019-kprometheus",
|
||||
"wpsoffice": "wps-office2019-kprometheus",
|
||||
"footclient": "foot",
|
||||
"zen": "zen-browser",
|
||||
"": "image-missing"
|
||||
},
|
||||
"regexSubstitutions": [
|
||||
|
||||
@@ -2,7 +2,7 @@ const { GLib } = imports.gi;
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
|
||||
const { Box, Button, EventBox, Label, Overlay, Revealer, Scrollable } = Widget;
|
||||
const { Box, Button, EventBox, Label, Overlay, Revealer } = Widget;
|
||||
const { execAsync, exec } = Utils;
|
||||
import { AnimatedCircProg } from "../../.commonwidgets/cairo_circularprogress.js";
|
||||
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
|
||||
@@ -136,8 +136,8 @@ export default () => {
|
||||
setup: (self) => self.hook(Mpris, label => {
|
||||
const mpris = Mpris.getPlayer('');
|
||||
if (!mpris) return;
|
||||
label.toggleClassName('bar-music-playstate-playing', mpris !== null && mpris.playBackStatus == 'Playing');
|
||||
label.toggleClassName('bar-music-playstate', mpris !== null || mpris.playBackStatus == 'Paused');
|
||||
label.toggleClassName('bar-music-playstate-playing', mpris.playBackStatus == 'Playing');
|
||||
label.toggleClassName('bar-music-playstate', mpris.playBackStatus == 'Paused');
|
||||
}),
|
||||
}),
|
||||
overlays: [
|
||||
@@ -210,7 +210,7 @@ export default () => {
|
||||
}),
|
||||
setup: (self) => self.hook(Mpris, label => {
|
||||
const mpris = Mpris.getPlayer('');
|
||||
self.revealChild = (!mpris || userOptions.bar.alwaysShowFullResources);
|
||||
self.revealChild = (!mpris || mpris.playBackStatus !== 'Playing' || userOptions.bar.alwaysShowFullResources);
|
||||
}),
|
||||
})
|
||||
],
|
||||
|
||||
@@ -29,9 +29,14 @@ const WindowTitle = async () => {
|
||||
truncate: 'end',
|
||||
maxWidthChars: 1, // Doesn't matter, just needs to be non negative
|
||||
className: 'txt-smallie bar-wintitle-txt',
|
||||
setup: (self) => self.hook(Hyprland.active.client, label => { // Hyprland.active.client
|
||||
label.label = Hyprland.active.client.title.length === 0 ? `Workspace ${Hyprland.active.workspace.id}` : Hyprland.active.client.title;
|
||||
}),
|
||||
setup: (self) => {
|
||||
self.hook(Hyprland.active.client, label => { // Hyprland.active.client
|
||||
label.label = Hyprland.active.client.title.length === 0 ? `Workspace ${Hyprland.active.workspace.id}` : Hyprland.active.client.title;
|
||||
});
|
||||
self.hook(Hyprland.active.workspace, label => { // Hyprland.active.client
|
||||
label.label = Hyprland.active.client.title.length === 0 ? `Workspace ${Hyprland.active.workspace.id}` : Hyprland.active.client.title;
|
||||
});
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
@@ -62,7 +62,7 @@ export const periodicTable = [
|
||||
{ name: 'Argon', symbol: 'Ar', number: 18, weight: 39.95, type: 'noblegas' },
|
||||
],
|
||||
[
|
||||
{ name: 'Kalium', symbol: 'K', number: 19, weight: 39.098, type: 'metal' },
|
||||
{ name: 'Potassium', symbol: 'K', number: 19, weight: 39.098, type: 'metal' },
|
||||
{ name: 'Calcium', symbol: 'Ca', number: 20, weight: 40.078, type: 'metal' },
|
||||
{ name: 'Scandium', symbol: 'Sc', number: 21, weight: 44.956, type: 'metal' },
|
||||
{ name: 'Titanium', symbol: 'Ti', number: 22, weight: 47.87, type: 'metal' },
|
||||
|
||||
@@ -119,6 +119,21 @@ const Taskbar = (monitor) => Widget.Box({
|
||||
const client = Hyprland.clients[i];
|
||||
if (client["pid"] == -1) return;
|
||||
const appClass = substitute(client.class);
|
||||
const ignoredAppsRegex = userOptions.dock.ignoredAppsRegex || [];
|
||||
let isIgnored = false;
|
||||
|
||||
for (const regex of ignoredAppsRegex) {
|
||||
try {
|
||||
const pattern = new RegExp(regex);
|
||||
if (pattern.test(appClass)) {
|
||||
isIgnored = true;
|
||||
break;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (isIgnored) continue;
|
||||
|
||||
// for (const appName of userOptions.dock.pinnedApps) {
|
||||
// if (appClass.includes(appName.toLowerCase()))
|
||||
// return null;
|
||||
|
||||
@@ -142,34 +142,6 @@ const ColorSchemeSettings = () => Widget.Box({
|
||||
.catch(print);
|
||||
},
|
||||
}),
|
||||
Widget.Box({
|
||||
tooltipText: getString('Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)'),
|
||||
className: 'txt spacing-h-5 configtoggle-box',
|
||||
children: [
|
||||
MaterialIcon('imagesearch_roller', 'norm'),
|
||||
Widget.Label({
|
||||
className: 'txt txt-small',
|
||||
label: getString('Use Gradience'),
|
||||
}),
|
||||
Widget.Box({ hexpand: true }),
|
||||
ConfigMulipleSelection({
|
||||
hpack: 'center',
|
||||
vpack: 'center',
|
||||
optionsArr: [
|
||||
[{ name: 'Off', value: 0 }, { name: 'On', value: 1 }],
|
||||
],
|
||||
initIndex: [-1, -1],
|
||||
onChange: (value, name) => {
|
||||
const ADWAITA_BLUE = "#3584E4";
|
||||
if (value) execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh - --yes-gradience`, `&`])
|
||||
.catch(print);
|
||||
else execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh "${ADWAITA_BLUE}" --no-gradience`, `&`])
|
||||
.catch(print);
|
||||
|
||||
},
|
||||
}),
|
||||
]
|
||||
}),
|
||||
]
|
||||
}),
|
||||
Widget.Box({
|
||||
|
||||
@@ -5,9 +5,10 @@ const { Box, Label, ProgressBar } = Widget;
|
||||
import { MarginRevealer } from '../.widgethacks/advancedrevealers.js';
|
||||
import Brightness from '../../services/brightness.js';
|
||||
import Indicator from '../../services/indicator.js';
|
||||
import { MaterialIcon } from '../.commonwidgets/materialicon.js';
|
||||
|
||||
const OsdValue = ({
|
||||
name, nameSetup = undefined, labelSetup, progressSetup,
|
||||
name, icon, nameSetup = undefined, labelSetup, progressSetup,
|
||||
extraClassName = '', extraProgressClassName = '',
|
||||
...rest
|
||||
}) => {
|
||||
@@ -22,27 +23,33 @@ const OsdValue = ({
|
||||
setup: labelSetup,
|
||||
});
|
||||
return Box({ // Volume
|
||||
vertical: true,
|
||||
hexpand: true,
|
||||
className: `osd-bg osd-value ${extraClassName}`,
|
||||
className: `osd-bg osd-value ${extraClassName} spacing-h-5`,
|
||||
attribute: {
|
||||
'disable': () => {
|
||||
valueNumber.label = '';
|
||||
}
|
||||
},
|
||||
children: [
|
||||
MaterialIcon(icon, 'hugeass', {vpack: 'center'}),
|
||||
Box({
|
||||
vexpand: true,
|
||||
vertical: true,
|
||||
className: 'spacing-v-5',
|
||||
vpack: 'center',
|
||||
children: [
|
||||
valueName,
|
||||
valueNumber,
|
||||
Box({
|
||||
children: [
|
||||
valueName,
|
||||
valueNumber,
|
||||
]
|
||||
}),
|
||||
ProgressBar({
|
||||
className: `osd-progress ${extraProgressClassName}`,
|
||||
hexpand: true,
|
||||
vertical: false,
|
||||
setup: progressSetup,
|
||||
})
|
||||
]
|
||||
}),
|
||||
ProgressBar({
|
||||
className: `osd-progress ${extraProgressClassName}`,
|
||||
hexpand: true,
|
||||
vertical: false,
|
||||
setup: progressSetup,
|
||||
})
|
||||
],
|
||||
...rest,
|
||||
@@ -52,6 +59,7 @@ const OsdValue = ({
|
||||
export default (monitor = 0) => {
|
||||
const brightnessIndicator = OsdValue({
|
||||
name: 'Brightness',
|
||||
icon: 'light_mode',
|
||||
extraClassName: 'osd-brightness',
|
||||
extraProgressClassName: 'osd-brightness-progress',
|
||||
labelSetup: (self) => self.hook(Brightness[monitor], self => {
|
||||
@@ -66,6 +74,7 @@ export default (monitor = 0) => {
|
||||
|
||||
const volumeIndicator = OsdValue({
|
||||
name: 'Volume',
|
||||
icon: 'volume_up',
|
||||
extraClassName: 'osd-volume',
|
||||
extraProgressClassName: 'osd-volume-progress',
|
||||
attribute: { headphones: undefined , device: undefined},
|
||||
|
||||
@@ -210,7 +210,6 @@ const CoverArt = ({ player, ...rest }) => {
|
||||
`${App.configDir}/scripts/color_generation/generate_colors_material.py --path '${coverPath}' --mode ${darkMode.value ? 'dark' : 'light'} > ${GLib.get_user_state_dir()}/ags/scss/_musicmaterial.scss`])
|
||||
.then(() => {
|
||||
const dominantColor = `#${Utils.exec(`sh -c "magick '${coverPath}' -scale 1x1\\! -format '%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]' info: | sed 's/,/\\n/g' | xargs -L 1 printf '%02x' ; echo"`)}`
|
||||
console.log(dominantColor);
|
||||
// exec(`${App.configDir}/scripts/color_generation/pywal.sh -i "${player.coverPath}" -n -t -s -e -q ${darkMode.value ? '' : '-l'}`)
|
||||
// exec(`cp ${GLib.get_user_cache_dir()}/wal/colors.scss ${GLib.get_user_state_dir()}/ags/scss/_musicwal.scss`);
|
||||
exec(`cp '${App.configDir}/scripts/templates/wal/_musicwal.scss' '${GLib.get_user_state_dir()}/ags/scss/_musicwal.scss'`);
|
||||
|
||||
@@ -44,29 +44,11 @@ export function launchCustomCommand(command) {
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>adw' || args[0] == '>adwaita') {
|
||||
const ADWAITA_BLUE = "#3584E4";
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh "${ADWAITA_BLUE}" --no-gradience`, `&`])
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>grad' || args[0] == '>gradience') {
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh - --yes-gradience`, `&`])
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>nograd' || args[0] == '>nogradience') {
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh - --no-gradience`, `&`])
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>material') { // Use material colors
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && echo "material" > ${GLib.get_user_state_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchwall.sh --noswitch`]).catch(print))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>pywal') { // Use Pywal (ik it looks shit but I'm not removing)
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && echo "pywal" > ${GLib.get_user_state_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchwall.sh --noswitch`]).catch(print))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>todo') { // Todo
|
||||
Todo.add(args.slice(1).join(' '));
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import WaifuService from '../../../services/waifus.js';
|
||||
import { darkMode } from '../../.miscutils/system.js';
|
||||
|
||||
async function getImageViewerApp(preferredApp) {
|
||||
Utils.execAsync(['bash', '-c', `command -v ${preferredApp}`])
|
||||
return Utils.execAsync(['bash', '-c', `command -v ${preferredApp}`])
|
||||
.then((output) => {
|
||||
if (output != '') return preferredApp;
|
||||
else return 'xdg-open';
|
||||
|
||||
@@ -56,9 +56,13 @@ const BluetoothDevice = (device) => {
|
||||
onChange: (self, newValue) => {
|
||||
device.setConnection(newValue);
|
||||
},
|
||||
extraSetup: (self) => self.hook(device, (self) => {
|
||||
Utils.timeout(200, () => self.enabled.value = device.connected);
|
||||
}),
|
||||
extraSetup: (self) => {
|
||||
self.hook(device, () => {
|
||||
const enabledState = self.attribute.enabled;
|
||||
if (enabledState.value !== device.connected)
|
||||
enabledState.value = device.connected;
|
||||
});
|
||||
},
|
||||
})
|
||||
const deviceRemoveButton = Button({
|
||||
vpack: 'center',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env -S\_/bin/sh\_-xc\_"source\_\$(eval\_echo\_\$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"\$0"\_"\$@""
|
||||
#!/usr/bin/env -S\_/bin/sh\_-c\_"source\_\$(eval\_echo\_\$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"\$0"\_"\$@""
|
||||
import argparse
|
||||
import re
|
||||
import os
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* GTK Colors
|
||||
*/
|
||||
|
||||
@define-color accent_color {{ $primary }};
|
||||
@define-color accent_fg_color {{ $onPrimary }};
|
||||
@define-color accent_bg_color {{ $primary }};
|
||||
@define-color window_bg_color {{ $background }};
|
||||
@define-color window_fg_color {{ $onBackground }};
|
||||
@define-color headerbar_bg_color {{ $surfaceDim }};
|
||||
@define-color headerbar_fg_color {{ $onSurface }};
|
||||
@define-color popover_bg_color {{ $surfaceDim }};
|
||||
@define-color popover_fg_color {{ $onSurface }};
|
||||
@define-color view_bg_color {{ $surface }};
|
||||
@define-color view_fg_color {{ $onSurface }};
|
||||
@define-color card_bg_color {{ $surface }};
|
||||
@define-color card_fg_color {{ $onSurface }};
|
||||
@define-color sidebar_bg_color @window_bg_color;
|
||||
@define-color sidebar_fg_color @window_fg_color;
|
||||
@define-color sidebar_border_color @window_bg_color;
|
||||
@define-color sidebar_backdrop_color @window_bg_color;
|
||||
@@ -30,6 +30,17 @@ input-field {
|
||||
valign = center
|
||||
}
|
||||
|
||||
label { # Caps Lock Warning
|
||||
monitor =
|
||||
text = cmd[update:250] ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/hyprlock/check-capslock.sh
|
||||
color = $text_color
|
||||
font_size = 13
|
||||
font_family = $font_family
|
||||
position = 0, -25
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
label { # Clock
|
||||
monitor =
|
||||
text = $TIME
|
||||
|
||||
+10
-13
@@ -4,28 +4,27 @@
|
||||
|
||||
.osd-bg {
|
||||
min-width: 8.864rem;
|
||||
min-height: 3.409rem;
|
||||
}
|
||||
|
||||
.osd-value {
|
||||
@include elevation-border;
|
||||
@include elevation2;
|
||||
@include full-rounding;
|
||||
background-color: $layer0;
|
||||
border-radius: 1.023rem;
|
||||
padding: 0.625rem 1.023rem;
|
||||
padding-top: 0.313rem;
|
||||
padding: 0.341rem 1.023rem 0.341rem 0.682rem;
|
||||
min-width: 9.545rem;
|
||||
}
|
||||
|
||||
.osd-progress {
|
||||
min-height: 0.955rem;
|
||||
min-width: 0.068rem;
|
||||
min-height: 0.682rem;
|
||||
min-width: 8.182rem;
|
||||
padding: 0rem;
|
||||
border-radius: 10rem;
|
||||
@include fluent_decel;
|
||||
|
||||
trough {
|
||||
min-height: 0.954rem;
|
||||
min-width: 0.068rem;
|
||||
min-height: 0.682rem;
|
||||
min-width: 8.182rem;
|
||||
border-radius: 10rem;
|
||||
background-color: $layer2;
|
||||
// border: 0.068rem solid $onSecondaryContainer;
|
||||
@@ -33,8 +32,8 @@
|
||||
|
||||
progress {
|
||||
@include fluent_decel;
|
||||
min-height: 0.680rem;
|
||||
min-width: 0.680rem;
|
||||
min-height: 0.409rem;
|
||||
min-width: 0.409rem;
|
||||
margin: 0rem 0.137rem;
|
||||
border-radius: 10rem;
|
||||
background-color: $onLayer2;
|
||||
@@ -44,12 +43,10 @@
|
||||
.osd-label {
|
||||
font-size: 1.023rem;
|
||||
font-weight: 500;
|
||||
margin-top: 0.341rem;
|
||||
}
|
||||
|
||||
.osd-value-txt {
|
||||
@include titlefont;
|
||||
font-size: 1.688rem;
|
||||
font-size: 1.023rem;
|
||||
font-weight: 500;
|
||||
color: $onLayer0;
|
||||
}
|
||||
|
||||
@@ -90,27 +90,44 @@ class BrightnessDdcService extends BrightnessServiceBase {
|
||||
async function listDdcMonitorsSnBus() {
|
||||
let ddcSnBus = {};
|
||||
try {
|
||||
const out = await Utils.execAsync('ddcutil detect --brief');
|
||||
// Its' better not to use --brief. This way if a serial number is not
|
||||
// found we can still use the binary serial number as an alternative
|
||||
const out = await Utils.execAsync('ddcutil detect');
|
||||
const displays = out.split('\n\n');
|
||||
displays.forEach(display => {
|
||||
const reg = /^Display \d+/;
|
||||
if (!reg.test(display))
|
||||
const reg = /[Dd]isplay/;
|
||||
if (!reg.test(display)) {
|
||||
return;
|
||||
}
|
||||
const lines = display.split('\n');
|
||||
let sn, busNum;
|
||||
let unresponsive = false;
|
||||
for (let line of lines) {
|
||||
line = line.trim()
|
||||
if (line.startsWith('Monitor:')) {
|
||||
sn = line.split(':')[3];
|
||||
|
||||
// Sometimes ddcutils will report a DP monitor twice, one of the
|
||||
// two copies of the monitor will "not support DDC/CI". Just ignore it
|
||||
// See https://www.ddcutil.com/faq/#duplicate_displayport
|
||||
if (line.includes('unresponsive')) {
|
||||
unresponsive = true;
|
||||
}
|
||||
if (line.startsWith('Serial')) {
|
||||
sn = line.split(':')[1].trim();
|
||||
// Sometimes sn can be empty. In this cases let's relay on binary sn
|
||||
} else if (line.startsWith('Binary') && !sn) {
|
||||
// Make the serial number upper case except for the leading '0x' since Hyprland
|
||||
// seems to use upper case for the rest of the string and ddcutil uses
|
||||
// lower case for all the binary sn
|
||||
sn = '0x'+line.split('(')[1].slice(2,-1).toUpperCase();
|
||||
} else if (line.startsWith('I2C bus:')) {
|
||||
busNum = line.split('/dev/i2c-')[1];
|
||||
}
|
||||
}
|
||||
if (sn && busNum)
|
||||
if (sn && busNum && !unresponsive){
|
||||
ddcSnBus[sn] = busNum;
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
print(err);
|
||||
}
|
||||
return ddcSnBus;
|
||||
}
|
||||
@@ -133,10 +150,12 @@ for (let i = 0; i < service.length; i++) {
|
||||
service[i] = new BrightnessDdcService(ddcSnBus[monitorSn]);
|
||||
break;
|
||||
case "auto":
|
||||
if (monitorSn in ddcSnBus && !!exec(`bash -c 'command -v ddcutil'`))
|
||||
if (monitorSn in ddcSnBus && !!exec(`bash -c 'command -v ddcutil'`)){
|
||||
service[i] = new BrightnessDdcService(ddcSnBus[monitorSn]);
|
||||
else
|
||||
}
|
||||
else {
|
||||
service[i] = new BrightnessCtlService();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown brightness controller ${preferredController}`);
|
||||
|
||||
+48
-27
@@ -44,16 +44,6 @@ const PROVIDERS = Object.assign({
|
||||
"key_file": "openrouter_key.txt",
|
||||
"model": "meta-llama/llama-3-70b-instruct",
|
||||
},
|
||||
"openai": {
|
||||
"name": "OpenAI - GPT-3.5",
|
||||
"logo_name": "openai-symbolic",
|
||||
"description": getString('Official OpenAI API.\nPricing: Free for the first $5 or 3 months, whichever is less.'),
|
||||
"base_url": "https://api.openai.com/v1/chat/completions",
|
||||
"key_get_url": "https://platform.openai.com/api-keys",
|
||||
"requires_key": true,
|
||||
"key_file": "openai_key.txt",
|
||||
"model": "gpt-3.5-turbo",
|
||||
},
|
||||
}, userOptions.ai.extraGptModels)
|
||||
|
||||
const installedOllamaModels = JSON.parse(
|
||||
@@ -76,7 +66,7 @@ installedOllamaModels.forEach(model => {
|
||||
// Custom prompt
|
||||
const initMessages =
|
||||
[
|
||||
{ role: "user", content: getString("You are an assistant on a sidebar of a Wayland Linux desktop. Please always use a casual tone when answering your questions, unless requested otherwise or making writing suggestions. These are the steps you should take to respond to the user's queries:\n1. If it's a writing- or grammar-related question or a sentence in quotation marks, Please point out errors and correct when necessary using underlines, and make the writing more natural where appropriate without making too major changes. If you're given a sentence in quotes but is grammatically correct, explain briefly concepts that are uncommon.\n2. If it's a question about system tasks, give a bash command in a code block with brief explanation.\n3. Otherwise, when asked to summarize information or explaining concepts, you are should use bullet points and headings. For mathematics expressions, you *have to* use LaTeX within a code block with the language set as \"latex\". \nNote: Use casual language, be short, while ensuring the factual correctness of your response. If you are unsure or don’t have enough information to provide a confident answer, simply say “I don’t know” or “I’m not sure.”. \nThanks!"), },
|
||||
{ role: "user", content: getString("You are an assistant on a sidebar of a Wayland Linux desktop. Please always use a casual tone when answering your questions, unless requested otherwise or making writing suggestions. These are the steps you should take to respond to the user's queries:\n1. If it's a writing- or grammar-related question or a sentence in quotation marks, Please point out errors and correct when necessary using underlines, and make the writing more natural where appropriate without making too major changes. If you're given a sentence in quotes but is grammatically correct, explain briefly concepts that are uncommon.\n2. If it's a question about system tasks, give a bash command in a code block with brief explanation.\n3. Otherwise, when asked to summarize information or explaining concepts, you are should use bullet points and headings. For mathematics expressions, you *have to* use LaTeX within a code block with the language set as \"latex\". \nNote: Use casual language, be short, while ensuring the factual correctness of your response. If you are unsure or don't have enough information to provide a confident answer, simply say \"I don't know\" or \"I'm not sure.\". \nThanks!") },
|
||||
{ role: "assistant", content: "- Got it!", },
|
||||
{ role: "user", content: "\"He rushed to where the event was supposed to be hold, he didn't know it got canceled\"", },
|
||||
{ role: "assistant", content: "## Grammar correction\nErrors:\n\"He rushed to where the event was supposed to be __hold____,__ he didn't know it got canceled\"\nCorrection + minor improvements:\n\"He rushed to the place where the event was supposed to be __held____, but__ he didn't know that it got canceled\"", },
|
||||
@@ -105,6 +95,8 @@ class GPTMessage extends Service {
|
||||
|
||||
_role = '';
|
||||
_content = '';
|
||||
_hasReasoningContent = false;
|
||||
_parsedReasoningContent = false;
|
||||
_lastContentLength = 0;
|
||||
_thinking;
|
||||
_done = false;
|
||||
@@ -112,6 +104,8 @@ class GPTMessage extends Service {
|
||||
constructor(role, content, thinking = true, done = false) {
|
||||
super();
|
||||
this._role = role;
|
||||
this._hasReasoningContent = false;
|
||||
this._parsedReasoningContent = false;
|
||||
this._content = content;
|
||||
this._thinking = thinking;
|
||||
this._done = done;
|
||||
@@ -123,6 +117,18 @@ class GPTMessage extends Service {
|
||||
get role() { return this._role }
|
||||
set role(role) { this._role = role; this.emit('changed') }
|
||||
|
||||
get hasReasoningContent() { return this._hasReasoningContent }
|
||||
set hasReasoningContent(value) {
|
||||
this._hasReasoningContent = value;
|
||||
this.emit('changed')
|
||||
}
|
||||
|
||||
get parsedReasoningContent() { return this._parsedReasoningContent }
|
||||
set parsedReasoningContent(value) {
|
||||
this._parsedReasoningContent = value;
|
||||
this.emit('changed')
|
||||
}
|
||||
|
||||
get content() { return this._content }
|
||||
set content(content) {
|
||||
this._content = content;
|
||||
@@ -143,6 +149,7 @@ class GPTMessage extends Service {
|
||||
}
|
||||
|
||||
addDelta(delta) {
|
||||
if (delta == null) return;
|
||||
if (this.thinking) {
|
||||
this.thinking = false;
|
||||
this.content = delta;
|
||||
@@ -242,16 +249,43 @@ class GPTService extends Service {
|
||||
const [bytes] = stream.read_line_finish(res);
|
||||
const line = this._decoder.decode(bytes);
|
||||
if (line && line != '') {
|
||||
|
||||
// Ignore SSE comments (lines starting with ":")
|
||||
if (line.startsWith(':')) {
|
||||
this.readResponse(stream, aiResponse);
|
||||
return;
|
||||
}
|
||||
|
||||
let data = line.substr(6);
|
||||
if (data == '[DONE]') return;
|
||||
try {
|
||||
const result = JSON.parse(data);
|
||||
if (result.choices[0].finish_reason === 'stop') {
|
||||
// If the stop payload has content, add it to the response
|
||||
if (result.choices[0].delta.content) {
|
||||
aiResponse.addDelta(result.choices[0].delta.content);
|
||||
}
|
||||
aiResponse.done = true;
|
||||
return;
|
||||
}
|
||||
aiResponse.addDelta(result.choices[0].delta.content);
|
||||
// print(result.choices[0])
|
||||
|
||||
// aiResponse.addDelta(result.choices[0].delta.content);
|
||||
if (!result.choices[0].delta.content && result.choices[0].delta.reasoning_content) {
|
||||
if (!aiResponse.hasReasoningContent) {
|
||||
aiResponse.hasReasoningContent = true;
|
||||
aiResponse.addDelta(`<think>\n${result.choices[0].delta.reasoning_content}`);
|
||||
}
|
||||
else {
|
||||
aiResponse.addDelta(`${result.choices[0].delta.reasoning_content}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (aiResponse.hasReasoningContent) {
|
||||
aiResponse.parsedReasoningContent = true;
|
||||
aiResponse.addDelta(`\n</think>\n`);
|
||||
}
|
||||
aiResponse.addDelta(result.choices[0].delta.content);
|
||||
}
|
||||
}
|
||||
catch {
|
||||
aiResponse.addDelta(line + '\n');
|
||||
@@ -300,17 +334,4 @@ class GPTService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
export default new GPTService();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default new GPTService();
|
||||
@@ -2,7 +2,7 @@
|
||||
// ~/.config/ags/modules/.configuration/default_options.jsonc
|
||||
//
|
||||
// vscode: ctrl+click this: file://./modules/.configuration/default_options.jsonc
|
||||
// vim : `:vsp` to split window, move cursor to the path, press `gf`.
|
||||
// vim: `:vsp` to split window, move cursor to the path, press `gf`.
|
||||
// `Ctrl-w` twice to switch between the files
|
||||
//
|
||||
// Limitations of this file:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
# The content of this script will be generated by switchwall.sh - Don't modify it by yourself.
|
||||
@@ -18,4 +18,3 @@ source=~/.config/hypr/custom/execs.conf
|
||||
source=~/.config/hypr/custom/general.conf
|
||||
source=~/.config/hypr/custom/rules.conf
|
||||
source=~/.config/hypr/custom/keybinds.conf
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Bar, wallpaper
|
||||
exec-once = swww-daemon --format xrgb
|
||||
exec-once = bash ~/.config/hypr/custom/scripts/__restore_video_wallpaper.sh
|
||||
exec-once = /usr/lib/geoclue-2.0/demos/agent & gammastep
|
||||
exec-once = qs &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user