Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bin/omakub-menu
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ show_toggle_menu() {
esac
}


show_style_menu() {
case $(menu "Style" "󰸌 Theme\n Font\n Background") in
*Theme*) show_theme_menu ;;
Expand Down Expand Up @@ -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"
Expand Down
11 changes: 5 additions & 6 deletions bin/omakub-theme-set-vscode
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
! 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"
28 changes: 28 additions & 0 deletions bin/omakub-toggle
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions bin/omakub-toggle-enable
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Check if a toggle is enabled (flag file exists)
[[ -f "$HOME/.local/state/omakub/toggles/$1" ]]
17 changes: 8 additions & 9 deletions bin/omakub-toggle-nightlight
Original file line number Diff line number Diff line change
@@ -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
15 changes: 5 additions & 10 deletions bin/omakub-toggle-suspend
Original file line number Diff line number Diff line change
@@ -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
omakub-toggle \
--notification-summary "Suspend" \
--enabled-notification "󰒲 Suspend removed from system menu" \
--disabled-notification "󰒲 Suspend now available in system menu" \
suspend-off
2 changes: 1 addition & 1 deletion install/packaging/base.sh
Original file line number Diff line number Diff line change
@@ -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[@]}"
9 changes: 9 additions & 0 deletions migrations/1776436972.sh
Original file line number Diff line number Diff line change
@@ -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