From 4ca957e155dda8b67979fcefbfd05de5f3f20844 Mon Sep 17 00:00:00 2001 From: Luca Pattocchio <15154851+Kasui92@users.noreply.github.com> Date: Fri, 17 Apr 2026 16:42:52 +0200 Subject: [PATCH 1/2] Now we can use base step outside installation flow --- install/packaging/base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/packaging/base.sh b/install/packaging/base.sh index d3bd2081c..28579892b 100644 --- a/install/packaging/base.sh +++ b/install/packaging/base.sh @@ -1,5 +1,5 @@ #!/bin/bash # Install all base packages -mapfile -t packages < <(grep -v '^#' "$OMAKUB_INSTALL/omakub-base.packages" | grep -v '^$') +mapfile -t packages < <(grep -v '^#' "$OMAKUB_PATH/install/omakub-base.packages" | grep -v '^$') omakub-pkg-add "${packages[@]}" From d7744b0475356a55b31242d21147307701afd11b Mon Sep 17 00:00:00 2001 From: Luca Pattocchio <15154851+Kasui92@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:21:02 +0200 Subject: [PATCH 2/2] Implement toggle functionality --- bin/omakub-menu | 3 +-- bin/omakub-theme-set-vscode | 11 +++++------ bin/omakub-toggle | 28 ++++++++++++++++++++++++++++ bin/omakub-toggle-enable | 4 ++++ bin/omakub-toggle-nightlight | 17 ++++++++--------- bin/omakub-toggle-suspend | 15 +++++---------- migrations/1776436972.sh | 9 +++++++++ 7 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 bin/omakub-toggle create mode 100644 bin/omakub-toggle-enable create mode 100644 migrations/1776436972.sh diff --git a/bin/omakub-menu b/bin/omakub-menu index 6ed491333..521380592 100755 --- a/bin/omakub-menu +++ b/bin/omakub-menu @@ -122,7 +122,6 @@ show_toggle_menu() { esac } - show_style_menu() { case $(menu "Style" "󰸌 Theme\n Font\n Background") in *Theme*) show_theme_menu ;; @@ -172,7 +171,7 @@ show_setup_menu() { show_setup_system_menu() { local options="" - if [[ -f ~/.local/state/omakub/toggles/suspend-off ]]; then + if omakub-toggle-enable suspend-off; then options="$options󰒲 Enable Suspend" else options="$options󰒲 Disable Suspend" diff --git a/bin/omakub-theme-set-vscode b/bin/omakub-theme-set-vscode index af22583f5..0eacd41ec 100755 --- a/bin/omakub-theme-set-vscode +++ b/bin/omakub-theme-set-vscode @@ -7,9 +7,8 @@ VS_CODE_THEME="$HOME/.config/omakub/current/theme/vscode.json" set_theme() { local editor_cmd="$1" local settings_path="$2" - local skip_flag="$3" - omakub-cmd-present "$editor_cmd" && [[ ! -f $skip_flag ]] || return 0 + omakub-cmd-present "$editor_cmd" || return 0 if [[ -f $VS_CODE_THEME ]]; then theme_name=$(jq -r '.name' "$VS_CODE_THEME") @@ -34,7 +33,7 @@ set_theme() { fi } -set_theme "code" "$HOME/.config/Code/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-vscode-theme-changes" -set_theme "code-insiders" "$HOME/.config/Code - Insiders/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-vscode-insiders-theme-changes" -set_theme "codium" "$HOME/.config/VSCodium/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-codium-theme-changes" -set_theme "cursor" "$HOME/.config/Cursor/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-cursor-theme-changes" \ No newline at end of file +! omakub-toggle-enabled skip-vscode-theme-changes && set_theme "code" "$HOME/.config/Code/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-vscode-theme-changes" +! omakub-toggle-enabled skip-vscode-insiders-theme-changes && set_theme "code-insiders" "$HOME/.config/Code - Insiders/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-vscode-insiders-theme-changes" +! omakub-toggle-enabled skip-codium-theme-changes && set_theme "codium" "$HOME/.config/VSCodium/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-codium-theme-changes" +! omakub-toggle-enabled skip-cursor-theme-changes && set_theme "cursor" "$HOME/.config/Cursor/User/settings.json" "$HOME/.local/state/omakub/toggles/skip-cursor-theme-changes" \ No newline at end of file diff --git a/bin/omakub-toggle b/bin/omakub-toggle new file mode 100644 index 000000000..878120283 --- /dev/null +++ b/bin/omakub-toggle @@ -0,0 +1,28 @@ +#!/bin/bash + +# Toggle Omakub features between enabled and disabled + +ENABLED_NOTIFICATION="" +DISABLED_NOTIFICATION="" +NOTIFICATION_SUMMARY="" + +while [[ $# -gt 1 ]]; do + case $1 in + --notification-summary) NOTIFICATION_SUMMARY="$2"; shift 2 ;; + --enabled-notification) ENABLED_NOTIFICATION="$2"; shift 2 ;; + --disabled-notification) DISABLED_NOTIFICATION="$2"; shift 2 ;; + *) break ;; + esac +done + +FLAG_NAME="$1" +FLAG="$HOME/.local/state/omakub/toggles/$FLAG_NAME" + +if [[ -f $FLAG ]]; then + rm $FLAG + [[ -n $DISABLED_NOTIFICATION ]] && notify-send -u low "$NOTIFICATION_SUMMARY" "$DISABLED_NOTIFICATION" +else + mkdir -p "$(dirname $FLAG)" + touch $FLAG + [[ -n $ENABLED_NOTIFICATION ]] && notify-send -u low "$NOTIFICATION_SUMMARY" "$ENABLED_NOTIFICATION" +fi diff --git a/bin/omakub-toggle-enable b/bin/omakub-toggle-enable new file mode 100644 index 000000000..c75e0ea5e --- /dev/null +++ b/bin/omakub-toggle-enable @@ -0,0 +1,4 @@ +#!/bin/bash + +# Check if a toggle is enabled (flag file exists) +[[ -f "$HOME/.local/state/omakub/toggles/$1" ]] diff --git a/bin/omakub-toggle-nightlight b/bin/omakub-toggle-nightlight index d1d6e3ae7..d73f990f0 100755 --- a/bin/omakub-toggle-nightlight +++ b/bin/omakub-toggle-nightlight @@ -1,14 +1,13 @@ #!/bin/bash -# Toggle night light feature in GNOME -current_state=$(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled) +omakub-toggle \ + --notification-summary "Night Light" \ + --enabled-notification " Nightlight screen temperature" \ + --disabled-notification " Daylight screen temperature" \ + night-light -if [[ $current_state == "true" ]]; then - gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false - sleep 0.5 # Wait for the setting to apply - omakub-notify -u low "Night Light" " Daylight screen temperature" -else +if omakub-toggle-enable night-light; then gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true - sleep 0.5 # Wait for the setting to apply - omakub-notify -u low "Night Light" " Nightlight screen temperature" +else + gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false fi \ No newline at end of file diff --git a/bin/omakub-toggle-suspend b/bin/omakub-toggle-suspend index db47f2458..015866a66 100755 --- a/bin/omakub-toggle-suspend +++ b/bin/omakub-toggle-suspend @@ -1,12 +1,7 @@ #!/bin/bash -STATE_FILE=~/.local/state/omakub/toggles/suspend-off - -if [[ -f $STATE_FILE ]]; then - rm -f $STATE_FILE - omakub-notify -u low "Suspend" "󰒲 Suspend now available in system menu" -else - mkdir -p "$(dirname $STATE_FILE)" - touch $STATE_FILE - omakub-notify -u low "Suspend" "󰒲 Suspend removed from system menu" -fi \ No newline at end of file +omakub-toggle \ + --notification-summary "Suspend" \ + --enabled-notification "󰒲 Suspend removed from system menu" \ + --disabled-notification "󰒲 Suspend now available in system menu" \ + suspend-off \ No newline at end of file diff --git a/migrations/1776436972.sh b/migrations/1776436972.sh new file mode 100644 index 000000000..333d17a6e --- /dev/null +++ b/migrations/1776436972.sh @@ -0,0 +1,9 @@ +echo "Generate current nightlight toggle..." + +CURRENT_STATE=$(gsettings get org.gnome.settings-daemon.plugins.color night-light-enabled) + +if [[ $CURRENT_STATE == "true" ]]; then + touch "$HOME/.local/state/omakub/toggles/night-light" +else + rm -f "$HOME/.local/state/omakub/toggles/night-light" +fi \ No newline at end of file