From 60a5e7aab5927725abc21d503240527cdcab627f Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Tue, 30 Apr 2024 20:08:04 +0800 Subject: [PATCH 01/18] Fix unhandled promise rejection --- .config/ags/modules/sideleft/apis/waifu.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/ags/modules/sideleft/apis/waifu.js b/.config/ags/modules/sideleft/apis/waifu.js index 733b79559..9bed5e688 100644 --- a/.config/ags/modules/sideleft/apis/waifu.js +++ b/.config/ags/modules/sideleft/apis/waifu.js @@ -19,7 +19,8 @@ async function getImageViewerApp(preferredApp) { .then((output) => { if (output != '') return preferredApp; else return 'xdg-open'; - }); + }) + .catch(print); } const IMAGE_REVEAL_DELAY = 13; // Some wait for inits n other weird stuff @@ -408,4 +409,4 @@ export const sendMessage = (text) => { } else WaifuService.fetch(text); -} \ No newline at end of file +} From a2547cfe43e6af0d6a58f4b71cc3fea7943c1282 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 30 Apr 2024 23:14:09 +0700 Subject: [PATCH 02/18] bring back terminal scheme monochrome --- .../templates/terminal/scheme-monochrome.json | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .config/ags/scripts/templates/terminal/scheme-monochrome.json diff --git a/.config/ags/scripts/templates/terminal/scheme-monochrome.json b/.config/ags/scripts/templates/terminal/scheme-monochrome.json new file mode 100644 index 000000000..5807a26e4 --- /dev/null +++ b/.config/ags/scripts/templates/terminal/scheme-monochrome.json @@ -0,0 +1,36 @@ +{ + "dark": { + "term0": "#000000", + "term1": "#FFFFFF", + "term2": "#CCCCCC", + "term3": "#8f8f8f", + "term4": "#FFFFFF", + "term5": "#111111", + "term6": "#CCCCCC", + "term7": "#FFFFFF", + "term8": "#404040", + "term9": "#CCCCCC", + "term10": "#FFFFFF", + "term11": "#909090", + "term12": "#CCCCCC", + "term13": "#808080", + "term14": "#CCCCCC", + "term15": "#FFFFFF" + }, + "light": { + "term0": "#EAE9EA", + "term1": "#777777", + "term2": "#000000", + "term3": "#000000", + "term4": "#000000", + "term5": "#000000", + "term6": "#000000", + "term7": "#202020", + "term8": "#000000", + "term9": "#000000", + "term10": "#CCCCCC", + "term11": "#808080", + "term12": "#CCCCCC", + "term13": "#FFFFFF" + } +} From 90bac2672fca7ef49c90a5a16ea57f4f14e4f0a0 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 09:16:55 +0700 Subject: [PATCH 03/18] Update issue templates --- .github/ISSUE_TEMPLATE/1-issue.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1-issue.md b/.github/ISSUE_TEMPLATE/1-issue.md index f66d8ba10..040a827fd 100644 --- a/.github/ISSUE_TEMPLATE/1-issue.md +++ b/.github/ISSUE_TEMPLATE/1-issue.md @@ -7,8 +7,7 @@ assignees: '' --- -- **(For usage) I have read the [wiki](https://end-4.github.io/dots-hyprland-wiki/en/i-i/02usage)** -- **(For troubleshooting) I have read the [wiki](https://end-4.github.io/dots-hyprland-wiki/en/i-i/03troubleshooting)** +- **I have read the [Usage](https://end-4.github.io/dots-hyprland-wiki/en/i-i/02usage) and the [Troubleshooting](https://end-4.github.io/dots-hyprland-wiki/en/i-i/03troubleshooting) pages of the wiki** - **I have made sure that both my config and system packages are up to date** - Linux distro: From c27b7f450510225520a2409e80eaf836ca3f9d5a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 10:19:20 +0700 Subject: [PATCH 04/18] re enable hyprland layer fade in --- .config/hypr/hyprland/general.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/hypr/hyprland/general.conf b/.config/hypr/hyprland/general.conf index 264dc15c7..5a6c9389b 100644 --- a/.config/hypr/hyprland/general.conf +++ b/.config/hypr/hyprland/general.conf @@ -126,7 +126,7 @@ animations { # animation = layers, 1, 2, md3_decel, slide animation = layersIn, 1, 3, menu_decel, slide animation = layersOut, 1, 1.6, menu_accel - animation = fadeLayersIn, 0, 2, menu_decel + animation = fadeLayersIn, 1, 2, menu_decel animation = fadeLayersOut, 1, 4.5, menu_accel animation = workspaces, 1, 7, menu_decel, slide # animation = workspaces, 1, 2.5, softAcDecel, slide From 7d45e9dc1bbe48b80667d2ca4256429bf551d0ab Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Wed, 1 May 2024 15:23:30 +0800 Subject: [PATCH 05/18] ags: implement per-monitor brightness control --- .../modules/.configuration/user_options.js | 5 +- .config/ags/modules/bar/main.js | 2 +- .config/ags/modules/bar/normal/spaceleft.js | 8 +- .../ags/modules/indicators/indicatorvalues.js | 12 +-- .config/ags/modules/indicators/main.js | 3 +- .config/ags/services/brightness.js | 77 ++++++++++++++++--- 6 files changed, 81 insertions(+), 26 deletions(-) diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index fcc7ee6c5..1aa791def 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -38,6 +38,9 @@ let configOptions = { 'warnTitles': ["Low battery", "Very low battery", 'Critical Battery'], 'warnMessages': ["Plug in the charger", "You there?", 'PLUG THE CHARGER ALREADY'], }, + 'brightness': { + 'controller': "brightnessctl", + }, 'music': { 'preferredPlayer': "plasma-browser-integration", }, @@ -159,4 +162,4 @@ function overrideConfigRecursive(userOverrides, configOptions = {}) { overrideConfigRecursive(userOverrides, configOptions); globalThis['userOptions'] = configOptions; -export default configOptions; \ No newline at end of file +export default configOptions; diff --git a/.config/ags/modules/bar/main.js b/.config/ags/modules/bar/main.js index 7f74c541a..0a0d8f42e 100644 --- a/.config/ags/modules/bar/main.js +++ b/.config/ags/modules/bar/main.js @@ -46,7 +46,7 @@ export const Bar = async (monitor = 0) => { const minHeight = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL); // execAsync(['bash', '-c', `hyprctl keyword monitor ,addreserved,${minHeight},0,0,0`]).catch(print); }, - startWidget: (await WindowTitle()), + startWidget: (await WindowTitle(monitor)), centerWidget: Widget.Box({ className: 'spacing-h-4', children: [ diff --git a/.config/ags/modules/bar/normal/spaceleft.js b/.config/ags/modules/bar/normal/spaceleft.js index 6fbe5d394..b3d796b63 100644 --- a/.config/ags/modules/bar/normal/spaceleft.js +++ b/.config/ags/modules/bar/normal/spaceleft.js @@ -39,16 +39,16 @@ const WindowTitle = async () => { } -export default async () => { +export default async (monitor = 0) => { const optionalWindowTitleInstance = await WindowTitle(); return Widget.EventBox({ onScrollUp: () => { Indicator.popup(1); // Since the brightness and speaker are both on the same window - Brightness.screen_value += 0.05; + Brightness[monitor].screen_value += 0.05; }, onScrollDown: () => { Indicator.popup(1); // Since the brightness and speaker are both on the same window - Brightness.screen_value -= 0.05; + Brightness[monitor].screen_value -= 0.05; }, onPrimaryClick: () => { App.toggleWindow('sideleft'); @@ -75,4 +75,4 @@ export default async () => { ] }) }); -} \ No newline at end of file +} diff --git a/.config/ags/modules/indicators/indicatorvalues.js b/.config/ags/modules/indicators/indicatorvalues.js index 18f228626..755d63e8b 100644 --- a/.config/ags/modules/indicators/indicatorvalues.js +++ b/.config/ags/modules/indicators/indicatorvalues.js @@ -49,16 +49,16 @@ const OsdValue = ({ }); } -export default () => { +export default (monitor = 0) => { const brightnessIndicator = OsdValue({ name: 'Brightness', extraClassName: 'osd-brightness', extraProgressClassName: 'osd-brightness-progress', - labelSetup: (self) => self.hook(Brightness, self => { - self.label = `${Math.round(Brightness.screen_value * 100)}`; + labelSetup: (self) => self.hook(Brightness[monitor], self => { + self.label = `${Math.round(Brightness[monitor].screen_value * 100)}`; }, 'notify::screen-value'), - progressSetup: (self) => self.hook(Brightness, (progress) => { - const updateValue = Brightness.screen_value; + progressSetup: (self) => self.hook(Brightness[monitor], (progress) => { + const updateValue = Brightness[monitor].screen_value; progress.value = updateValue; }, 'notify::screen-value'), }); @@ -109,4 +109,4 @@ export default () => { ] }) }); -} \ No newline at end of file +} diff --git a/.config/ags/modules/indicators/main.js b/.config/ags/modules/indicators/main.js index db3fc4c8c..16741937f 100644 --- a/.config/ags/modules/indicators/main.js +++ b/.config/ags/modules/indicators/main.js @@ -22,7 +22,7 @@ export default (monitor = 0) => Widget.Window({ className: 'osd-window', css: 'min-height: 2px;', children: [ - IndicatorValues(), + IndicatorValues(monitor), MusicControls(), NotificationPopups(), ColorScheme(), @@ -30,4 +30,3 @@ export default (monitor = 0) => Widget.Window({ }) }), }); - diff --git a/.config/ags/services/brightness.js b/.config/ags/services/brightness.js index 89bfbac10..778f44ef2 100644 --- a/.config/ags/services/brightness.js +++ b/.config/ags/services/brightness.js @@ -1,10 +1,11 @@ +import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Service from 'resource:///com/github/Aylur/ags/service.js'; import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'; const { exec, execAsync } = Utils; import { clamp } from '../modules/.miscutils/mathfuncs.js'; -class BrightnessService extends Service { +class BrightnessServiceBase extends Service { static { Service.register( this, @@ -23,7 +24,7 @@ class BrightnessService extends Service { percent = clamp(percent, 0, 1); this._screenValue = percent; - Utils.execAsync(`brightnessctl s ${percent * 100}% -q`) + Utils.execAsync(this.setBrightnessCmd(percent)) .then(() => { // signals has to be explicity emitted this.emit('screen-changed', percent); @@ -35,13 +36,6 @@ class BrightnessService extends Service { .catch(print); } - constructor() { - super(); - const current = Number(exec('brightnessctl g')); - const max = Number(exec('brightnessctl m')); - this._screenValue = current / max; - } - // overwriting connectWidget method, lets you // change the default event that widgets connect to connectWidget(widget, callback, event = 'screen-changed') { @@ -49,11 +43,70 @@ class BrightnessService extends Service { } } +class BrightnessCtlService extends BrightnessServiceBase { + static { + Service.register(this); + } + + constructor() { + super(); + const current = Number(exec('brightnessctl g')); + const max = Number(exec('brightnessctl m')); + this._screenValue = current / max; + } + + setBrightnessCmd(percent) { + return `brightnessctl s ${percent * 100}% -q`; + } +} + +class BrightnessDdcService extends BrightnessServiceBase { + static { + Service.register(this); + } + + constructor(monitor = 0) { + super(); + // don't use Hyprland.getMonitor(id), Hyprland monitor id isn't consistent + // with Gdk, but the Array ordering is (magically) + this._sn = Hyprland.monitors[monitor].serial; + Utils.execAsync(`ddcutil --sn ${this._sn} getvcp 10 --brief`) + .then((out) => { + // only the last line is useful + out = out.split('\n'); + out = out[out.length - 1]; + + out = out.split(' '); + const current = Number(out[3]); + const max = Number(out[4]); + this._screenValue = current / max; + }) + .catch(print); + } + + setBrightnessCmd(percent) { + return `ddcutil --sn ${this._sn} setvcp 10 ${Math.round(percent * 100)}`; + } +} + // the singleton instance -const service = new BrightnessService(); +const numMonitors = Hyprland.monitors.length; +const service = Array(numMonitors); +switch (userOptions.brightness.controller) { + case "brightnessctl": + service.fill(new BrightnessCtlService()); + break; + case "ddcutil": + for (let i = 0; i < numMonitors; i++) { + service[i] = new BrightnessDdcService(i); + } + break; + default: + throw new Error(`Unknown brightness controller ${userOptions.brightness.controller}`); +} // make it global for easy use with cli -globalThis.brightness = service; +globalThis.brightness = service[0]; // export to use in other modules -export default service; \ No newline at end of file +export default service; From 409a6d508ae375129ca948f95d0c1b9179c38309 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Wed, 1 May 2024 16:01:29 +0800 Subject: [PATCH 06/18] Add ddcutil to installer --- install.sh | 4 ++-- scriptdata/dependencies.conf | 5 ++++- uninstall.sh | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 392837512..c4ed16da7 100755 --- a/install.sh +++ b/install.sh @@ -136,7 +136,8 @@ case $SKIP_PLASMAINTG in ;; esac -v sudo usermod -aG video,input "$(whoami)" +v sudo usermod -aG video,i2c,input "$(whoami)" +v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" v systemctl --user enable ydotool --now ##################################################################################### @@ -306,4 +307,3 @@ case $existed_hypr_conf in printf "\e[33mPlease use \"~/.config/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n" printf "\e[33mIf this is your first time installation, you must overwrite \"~/.config/hypr/hyprland.conf\" with \"~/.config/hypr/hyprland.conf.new\".\e[0m\n" ;;esac - diff --git a/scriptdata/dependencies.conf b/scriptdata/dependencies.conf index 9fe10337d..9c7bcd95d 100644 --- a/scriptdata/dependencies.conf +++ b/scriptdata/dependencies.conf @@ -26,7 +26,10 @@ pavucontrol wireplumber libdbusmenu-gtk3 playerctl swww webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upower yad ydotool ### Gnome -polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager brightnessctl wlsunset gnome-bluetooth-3.0 +polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager wlsunset gnome-bluetooth-3.0 + +### Backlight +brightnessctl ddcutil ### Widgets python-pywayland python-psutil hypridle-git hyprlock-git wlogout wl-clipboard hyprpicker-git anyrun-git diff --git a/uninstall.sh b/uninstall.sh index 4c2dc6a72..174958eae 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -35,16 +35,18 @@ v rm -rf "$HOME/.local/bin/fuzzel-emoji" ############################################################################################################################## -# Undo Step 1: Remove added user from video and input groups and remove yay packages -printf '\e[36mRemoving user from video and input groups and removing packages...\n\e[97m' +# Undo Step 1: Remove added user from video, i2c, and input groups and remove yay packages +printf '\e[36mRemoving user from video, i2c, and input groups and removing packages...\n\e[97m' user=$(whoami) v sudo deluser "$user" video +v sudo deluser "$user" i2c v sudo deluser "$user" input +v sudo rm /etc/modules-load.d/i2c-dev.conf ############################################################################################################################## read -p "Do you want to uninstall packages used by the dotfiles?\nCtrl+C to exit, or press Enter to proceed" # Removing installed yay packages and dependencies -v yay -Rns adw-gtk3-git brightnessctl cava foot fuzzel gjs gojq gradience-git grim gtk-layer-shell hyprland-git lexend-fonts-git libdbusmenu-gtk3 plasma-browser-integration playerctl python-build python-material-color-utilities python-poetry python-pywal ripgrep sassc swww slurp starship swayidle hyprlock-git tesseract ttf-jetbrains-mono-nerd ttf-material-symbols-variable-git ttf-space-mono-nerd typescript webp-pixbuf-loader wl-clipboard wlogout yad ydotool +v yay -Rns adw-gtk3-git brightnessctl cava ddcutil foot fuzzel gjs gojq gradience-git grim gtk-layer-shell hyprland-git lexend-fonts-git libdbusmenu-gtk3 plasma-browser-integration playerctl python-build python-material-color-utilities python-poetry python-pywal ripgrep sassc swww slurp starship swayidle hyprlock-git tesseract ttf-jetbrains-mono-nerd ttf-material-symbols-variable-git ttf-space-mono-nerd typescript webp-pixbuf-loader wl-clipboard wlogout yad ydotool printf '\e[36mUninstall Complete.\n\e[97m' From 95d585a8be320fb0b3ebe3a88fc6f137a7eb0753 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 15:29:42 +0700 Subject: [PATCH 07/18] adjust colors when transparency enabled --- .config/ags/scss/_colors.scss | 2 +- .config/ags/scss/_osd.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/ags/scss/_colors.scss b/.config/ags/scss/_colors.scss index c89954719..fe82a9074 100644 --- a/.config/ags/scss/_colors.scss +++ b/.config/ags/scss/_colors.scss @@ -1,5 +1,5 @@ $rootTransparency: 0.31; // Transparency = 1 - opacity -$transparency: 0.8; +$transparency: 0.75; // Transparent versions @if $transparent == True { diff --git a/.config/ags/scss/_osd.scss b/.config/ags/scss/_osd.scss index a3d284796..ef21f435c 100644 --- a/.config/ags/scss/_osd.scss +++ b/.config/ags/scss/_osd.scss @@ -83,7 +83,7 @@ } .osd-colorscheme-settings { - background-color: $layer0; + background-color: $layer1; padding: 0.313rem 0.626rem; @include small-rounding; } From 72762f583352d6a6bb398bec7a403435590c0dc6 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 21:21:11 +0700 Subject: [PATCH 08/18] add keybind for screenshot to clipboard and save (#454) --- .config/ags/modules/cheatsheet/data_keybinds.js | 1 + .config/hypr/hyprland/keybinds.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/.config/ags/modules/cheatsheet/data_keybinds.js b/.config/ags/modules/cheatsheet/data_keybinds.js index 1dbcd0eb9..b64156797 100644 --- a/.config/ags/modules/cheatsheet/data_keybinds.js +++ b/.config/ags/modules/cheatsheet/data_keybinds.js @@ -71,6 +71,7 @@ export const keybindList = [[ "name": "Utilities", "binds": [ { "keys": ["PrtSc"], "action": "Screenshot >> clipboard" }, + { "keys": ["Ctrl", "PrtSc"], "action": "Screenshot >> file + clipboard" }, { "keys": ["󰖳", "Shift", "+", "S"], "action": "Screen snip >> clipboard" }, { "keys": ["󰖳", "Shift", "+", "T"], "action": "Image to text >> clipboard" }, { "keys": ["󰖳", "Shift", "+", "C"], "action": "Color picker" }, diff --git a/.config/hypr/hyprland/keybinds.conf b/.config/hypr/hyprland/keybinds.conf index dc79b59eb..1817634c5 100644 --- a/.config/hypr/hyprland/keybinds.conf +++ b/.config/hypr/hyprland/keybinds.conf @@ -41,6 +41,7 @@ bind = Control+Shift+Alt+Super, Delete, exec, systemctl poweroff || loginctl pow # Screenshot, Record, OCR, Color picker, Clipboard history bind = Super+Shift+Alt, S, exec, grim -g "$(slurp)" - | swappy -f - bindl=,Print,exec,grim - | wl-copy +bindl= Control,Print, exec, mkdir -p ~/Pictures/Screenshots && ~/.config/ags/scripts/grimblast.sh copysave screen ~/Pictures/Screenshots/Screenshot_"$(date '+%Y-%m-%d_%H.%M.%S')".png bind = Super+Shift, S, exec, ~/.config/ags/scripts/grimblast.sh --freeze copy area bind = Super+Alt, R, exec, ~/.config/ags/scripts/record-script.sh bind = Control+Alt, R, exec, ~/.config/ags/scripts/record-script.sh --fullscreen From bac84208b76b2bedae5008c8e0f3f2b23db986f3 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 21:21:31 +0700 Subject: [PATCH 09/18] adjust screen recording file name --- .config/ags/scripts/record-script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ags/scripts/record-script.sh b/.config/ags/scripts/record-script.sh index 1509c1689..5c9183e60 100755 --- a/.config/ags/scripts/record-script.sh +++ b/.config/ags/scripts/record-script.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash getdate() { - date '+%Y%m%d_%H-%M-%S' + date '+%Y-%m-%d_%H.%M.%S' } getaudiooutput() { pactl list sources | grep 'Name' | grep 'monitor' | cut -d ' ' -f2 From c68de4707f125a89e995104be5b13e659a2cf29e Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Wed, 1 May 2024 22:32:20 +0800 Subject: [PATCH 10/18] ags: fix systray icon warning take code snippet from ags wiki to fix: ``` (com.github.Aylur.ags:748022): Gjs-Console-WARNING **: 21:42:04.733: Error: can't assign "[object instance wrapper GIName:GdkPixbuf.Pixbuf jsobj@0x37f2745abd08 native@0x62e804712490]" as icon, it is not a file nor a named icon ``` --- .config/ags/modules/bar/normal/tray.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.config/ags/modules/bar/normal/tray.js b/.config/ags/modules/bar/normal/tray.js index 71ca062ca..727c28bbf 100644 --- a/.config/ags/modules/bar/normal/tray.js +++ b/.config/ags/modules/bar/normal/tray.js @@ -5,11 +5,7 @@ const { Gravity } = imports.gi.Gdk; const SysTrayItem = (item) => Button({ className: 'bar-systray-item', - child: Icon({ - hpack: 'center', - icon: `${item.icon}`, - setup: (self) => self.hook(item, (self) => self.icon = item.icon), - }), + child: Icon({hpack: 'center'}).bind('icon', item, 'icon'), setup: (self) => self .hook(item, (self) => self.tooltipMarkup = item['tooltip-markup']) , From 40d7ceaae9e030a66cc7910c0c744557e8805cf2 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 21:39:41 +0700 Subject: [PATCH 11/18] remove unnecessary comments --- .config/ags/scripts/color_generation/colorgen.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.config/ags/scripts/color_generation/colorgen.sh b/.config/ags/scripts/color_generation/colorgen.sh index 4194e377a..0010496ac 100755 --- a/.config/ags/scripts/color_generation/colorgen.sh +++ b/.config/ags/scripts/color_generation/colorgen.sh @@ -11,8 +11,6 @@ lightdark="dark" transparency="opaque" materialscheme="vibrant" terminalscheme="$HOME/.config/ags/scripts/templates/terminal/scheme-base.json" -# terminalscheme="$HOME/.config/ags/scripts/templates/terminal/scheme-catppuccin.json" -# terminalscheme="$HOME/.config/ags/scripts/templates/terminal/scheme-vscode.json" if [ ! -f $colormodefile ]; then echo "dark" > $colormodefile From aa9a38cf5f3b9fd6f6822c8a049a0cfe7efd3e32 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 22:12:27 +0700 Subject: [PATCH 12/18] comment possible brightness controllers --- .config/ags/modules/.configuration/user_options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index 1aa791def..36aa53ca6 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -39,7 +39,7 @@ let configOptions = { 'warnMessages': ["Plug in the charger", "You there?", 'PLUG THE CHARGER ALREADY'], }, 'brightness': { - 'controller': "brightnessctl", + 'controller': "brightnessctl", // "brightnessctl" or "ddcutil" }, 'music': { 'preferredPlayer': "plasma-browser-integration", From b598dfac1d26dd305e4b213d808445b2254da2c7 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 22:32:04 +0700 Subject: [PATCH 13/18] brightness controller: per-name config; add "auto" --- .../modules/.configuration/user_options.js | 9 ++++- .config/ags/services/brightness.js | 35 +++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index 36aa53ca6..5b22c66ce 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -39,7 +39,14 @@ let configOptions = { 'warnMessages': ["Plug in the charger", "You there?", 'PLUG THE CHARGER ALREADY'], }, 'brightness': { - 'controller': "brightnessctl", // "brightnessctl" or "ddcutil" + // Object of controller names for each monitor, either "brightnessctl" or "ddcutil" or "auto" + // "default" will be used if unspecified + // Examples + // 'eDP-1': "brightnessctl", + // 'DP-1': "ddcutil", + 'controllers': { + 'default': "auto", + }, }, 'music': { 'preferredPlayer': "plasma-browser-integration", diff --git a/.config/ags/services/brightness.js b/.config/ags/services/brightness.js index 778f44ef2..6bffd5554 100644 --- a/.config/ags/services/brightness.js +++ b/.config/ags/services/brightness.js @@ -89,20 +89,33 @@ class BrightnessDdcService extends BrightnessServiceBase { } } -// the singleton instance +// Service instance const numMonitors = Hyprland.monitors.length; const service = Array(numMonitors); -switch (userOptions.brightness.controller) { - case "brightnessctl": - service.fill(new BrightnessCtlService()); - break; - case "ddcutil": - for (let i = 0; i < numMonitors; i++) { - service[i] = new BrightnessDdcService(i); +for (let i = 0; i < service.length; i++) { + const monitorName = Hyprland.monitors[i].name; + const preferredController = userOptions.brightness.controllers[monitorName] + || userOptions.brightness.controllers.default || "auto"; + if (preferredController) { + switch (preferredController) { + case "brightnessctl": + service[i] = new BrightnessCtlService(); + break; + case "ddcutil": + service[i] = new BrightnessDdcService(i); + break; + case "auto": + if (monitorName.startsWith("eDP-")) + service[i] = new BrightnessCtlService(); + else if (monitorName.startsWith("DP-")) + service[i] = new BrightnessDdcService(i); + else + service[i] = new BrightnessCtlService(); + break; + default: + throw new Error(`Unknown brightness controller ${preferredController}`); } - break; - default: - throw new Error(`Unknown brightness controller ${userOptions.brightness.controller}`); + } } // make it global for easy use with cli From be6fe404b3bfb3f7db8d6d405676329266674773 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 1 May 2024 22:38:16 +0700 Subject: [PATCH 14/18] make brightness controller comment: less misleading --- .config/ags/modules/.configuration/user_options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index 5b22c66ce..aef4724f9 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -40,7 +40,7 @@ let configOptions = { }, 'brightness': { // Object of controller names for each monitor, either "brightnessctl" or "ddcutil" or "auto" - // "default" will be used if unspecified + // 'default' one will be used if unspecified // Examples // 'eDP-1': "brightnessctl", // 'DP-1': "ddcutil", From 668927a153a6d75c61c918e084ddfcffddd96ac1 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Thu, 2 May 2024 11:38:37 +0800 Subject: [PATCH 15/18] detect ddcci support via ddcutil --- .config/ags/services/brightness.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.config/ags/services/brightness.js b/.config/ags/services/brightness.js index 6bffd5554..4b8229163 100644 --- a/.config/ags/services/brightness.js +++ b/.config/ags/services/brightness.js @@ -89,11 +89,32 @@ class BrightnessDdcService extends BrightnessServiceBase { } } +async function listDdcMonitorsSn() { + let ddcSn = []; + try { + const out = await Utils.execAsync('ddcutil detect --brief'); + const displays = out.split('\n\n'); + displays.forEach(display => { + const reg = /^Display \d+/; + if (!reg.test(display)) + return; + const lines = display.split('\n'); + const sn = lines[3].split(':')[3]; + ddcSn.push(sn); + }); + } catch (err) { + print(err); + } + return ddcSn; +} + // Service instance const numMonitors = Hyprland.monitors.length; const service = Array(numMonitors); +const ddcSn = await listDdcMonitorsSn(); for (let i = 0; i < service.length; i++) { const monitorName = Hyprland.monitors[i].name; + const monitorSn = Hyprland.monitors[i].serial; const preferredController = userOptions.brightness.controllers[monitorName] || userOptions.brightness.controllers.default || "auto"; if (preferredController) { @@ -105,9 +126,7 @@ for (let i = 0; i < service.length; i++) { service[i] = new BrightnessDdcService(i); break; case "auto": - if (monitorName.startsWith("eDP-")) - service[i] = new BrightnessCtlService(); - else if (monitorName.startsWith("DP-")) + if (ddcSn.includes(monitorSn)) service[i] = new BrightnessDdcService(i); else service[i] = new BrightnessCtlService(); From 7996fca302798522e6b5ba36e0de9dfc659f6ede Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Thu, 2 May 2024 11:56:24 +0800 Subject: [PATCH 16/18] use the more efficient i2c bus number to control ddcci backlight --- .config/ags/services/brightness.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.config/ags/services/brightness.js b/.config/ags/services/brightness.js index 4b8229163..04fccd0ca 100644 --- a/.config/ags/services/brightness.js +++ b/.config/ags/services/brightness.js @@ -65,12 +65,10 @@ class BrightnessDdcService extends BrightnessServiceBase { Service.register(this); } - constructor(monitor = 0) { + constructor(busNum) { super(); - // don't use Hyprland.getMonitor(id), Hyprland monitor id isn't consistent - // with Gdk, but the Array ordering is (magically) - this._sn = Hyprland.monitors[monitor].serial; - Utils.execAsync(`ddcutil --sn ${this._sn} getvcp 10 --brief`) + this._busNum = busNum; + Utils.execAsync(`ddcutil -b ${this._busNum} getvcp 10 --brief`) .then((out) => { // only the last line is useful out = out.split('\n'); @@ -85,12 +83,12 @@ class BrightnessDdcService extends BrightnessServiceBase { } setBrightnessCmd(percent) { - return `ddcutil --sn ${this._sn} setvcp 10 ${Math.round(percent * 100)}`; + return `ddcutil -b ${this._busNum} setvcp 10 ${Math.round(percent * 100)}`; } } -async function listDdcMonitorsSn() { - let ddcSn = []; +async function listDdcMonitorsSnBus() { + let ddcSnBus = {}; try { const out = await Utils.execAsync('ddcutil detect --brief'); const displays = out.split('\n\n'); @@ -100,18 +98,19 @@ async function listDdcMonitorsSn() { return; const lines = display.split('\n'); const sn = lines[3].split(':')[3]; - ddcSn.push(sn); + const busNum = lines[1].split('/dev/i2c-')[1]; + ddcSnBus[sn] = busNum; }); } catch (err) { print(err); } - return ddcSn; + return ddcSnBus; } // Service instance const numMonitors = Hyprland.monitors.length; const service = Array(numMonitors); -const ddcSn = await listDdcMonitorsSn(); +const ddcSnBus = await listDdcMonitorsSnBus(); for (let i = 0; i < service.length; i++) { const monitorName = Hyprland.monitors[i].name; const monitorSn = Hyprland.monitors[i].serial; @@ -123,11 +122,11 @@ for (let i = 0; i < service.length; i++) { service[i] = new BrightnessCtlService(); break; case "ddcutil": - service[i] = new BrightnessDdcService(i); + service[i] = new BrightnessDdcService(ddcSnBus[monitorSn]); break; case "auto": - if (ddcSn.includes(monitorSn)) - service[i] = new BrightnessDdcService(i); + if (monitorSn in ddcSnBus) + service[i] = new BrightnessDdcService(ddcSnBus[monitorSn]); else service[i] = new BrightnessCtlService(); break; From 06674786405cdaa9018d70e1dbfece35b85b7510 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 2 May 2024 20:18:33 +0700 Subject: [PATCH 17/18] bring back dart sass to install script (#464, #465) --- scriptdata/dependencies.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scriptdata/dependencies.conf b/scriptdata/dependencies.conf index 9fe10337d..d37302f60 100644 --- a/scriptdata/dependencies.conf +++ b/scriptdata/dependencies.conf @@ -3,7 +3,7 @@ ### Ones which need cleanbuild (see install.sh): # hyprland-git -# python-materialyoucolor-git gradience-git dart-sass python-material-color-utilities +# python-materialyoucolor-git gradience-git python-material-color-utilities ### Basic coreutils cliphist cmake curl fuzzel rsync wget ripgrep gojq npm meson typescript gjs axel @@ -29,7 +29,7 @@ webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upo polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager brightnessctl wlsunset gnome-bluetooth-3.0 ### Widgets -python-pywayland python-psutil hypridle-git hyprlock-git wlogout wl-clipboard hyprpicker-git anyrun-git +dart-sass python-pywayland python-psutil hypridle-git hyprlock-git wlogout wl-clipboard hyprpicker-git anyrun-git ### Fonts and Themes adw-gtk3-git qt5ct qt5-wayland fontconfig ttf-readex-pro ttf-jetbrains-mono-nerd ttf-material-symbols-variable-git ttf-space-mono-nerd fish foot starship From e6269b919ba49276c804cd868fdcb5e366cff5f0 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Thu, 2 May 2024 21:04:48 +0700 Subject: [PATCH 18/18] fix annoying ass kb focus, i think --- .config/ags/modules/cheatsheet/main.js | 2 +- .config/ags/modules/overview/main.js | 2 +- .config/ags/modules/session/main.js | 2 +- .config/ags/modules/sideleft/main.js | 2 +- .config/ags/modules/sideleft/sideleft.js | 2 +- .config/ags/modules/sideright/main.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/ags/modules/cheatsheet/main.js b/.config/ags/modules/cheatsheet/main.js index 21644e7cd..4b7b67bc6 100644 --- a/.config/ags/modules/cheatsheet/main.js +++ b/.config/ags/modules/cheatsheet/main.js @@ -86,7 +86,7 @@ export const sheetContent = ExpandingIconTabContainer({ export default (id) => PopupWindow({ name: `cheatsheet${id}`, layer: 'overlay', - keymode: 'exclusive', + keymode: 'on-demand', visible: false, child: Widget.Box({ vertical: true, diff --git a/.config/ags/modules/overview/main.js b/.config/ags/modules/overview/main.js index 185c6010c..2b664ebd4 100644 --- a/.config/ags/modules/overview/main.js +++ b/.config/ags/modules/overview/main.js @@ -5,7 +5,7 @@ import PopupWindow from '../.widgethacks/popupwindow.js'; export default (id = '') => PopupWindow({ name: `overview${id}`, // exclusivity: 'ignore', - keymode: 'exclusive', + keymode: 'on-demand', visible: false, anchor: ['top'], layer: 'overlay', diff --git a/.config/ags/modules/session/main.js b/.config/ags/modules/session/main.js index cf4f8010f..32640f1bf 100644 --- a/.config/ags/modules/session/main.js +++ b/.config/ags/modules/session/main.js @@ -5,7 +5,7 @@ import PopupWindow from '../.widgethacks/popupwindow.js'; export default (id = 0) => PopupWindow({ // On-screen keyboard name: `session${id}`, visible: false, - keymode: 'exclusive', + keymode: 'on-demand', layer: 'overlay', exclusivity: 'ignore', anchor: ['top', 'bottom', 'left', 'right'], diff --git a/.config/ags/modules/sideleft/main.js b/.config/ags/modules/sideleft/main.js index 994d17752..a9ddf2232 100644 --- a/.config/ags/modules/sideleft/main.js +++ b/.config/ags/modules/sideleft/main.js @@ -2,7 +2,7 @@ import PopupWindow from '../.widgethacks/popupwindow.js'; import SidebarLeft from "./sideleft.js"; export default () => PopupWindow({ - keymode: 'exclusive', + keymode: 'on-demand', anchor: ['left', 'top', 'bottom'], name: 'sideleft', layer: 'overlay', diff --git a/.config/ags/modules/sideleft/sideleft.js b/.config/ags/modules/sideleft/sideleft.js index 1869d0b85..d27ad1876 100644 --- a/.config/ags/modules/sideleft/sideleft.js +++ b/.config/ags/modules/sideleft/sideleft.js @@ -40,7 +40,7 @@ const pinButton = Button({ sideleftContent.toggleClassName('sidebar-pinned', self.attribute.enabled); if (self.attribute.enabled) { - sideleftWindow.exclusivity = 'exclusive'; + sideleftWindow.exclusivity = 'on-demad'; } else { sideleftWindow.exclusivity = 'normal'; diff --git a/.config/ags/modules/sideright/main.js b/.config/ags/modules/sideright/main.js index 5abe8b03a..e961cbb0a 100644 --- a/.config/ags/modules/sideright/main.js +++ b/.config/ags/modules/sideright/main.js @@ -2,7 +2,7 @@ import PopupWindow from '../.widgethacks/popupwindow.js'; import SidebarRight from "./sideright.js"; export default () => PopupWindow({ - keymode: 'exclusive', + keymode: 'on-demand', anchor: ['right', 'top', 'bottom'], name: 'sideright', layer: 'overlay',