Jelajahi Sumber

add light/dark mode toggle switch for hyprland and wezterm + disable touchpad while typing

Noah Vogt 1 hari lalu
induk
melakukan
4f545e327f

+ 2 - 0
dot-config/hypr/hyprland.conf

@@ -186,6 +186,7 @@ input {
 
     touchpad {
         natural_scroll = true
+        disable_while_typing = true
     }
 }
 
@@ -218,6 +219,7 @@ bind = $mainMod, V, togglefloating,
 bind = $mainMod, R, exec, $menu
 bind = $mainMod, P, pseudo, # dwindle
 # bind = $mainMod, J, layoutmsg, togglesplit # dwindle
+bind = $mainMod SHIFT, T, exec, ~/.config/hypr/scripts/toggle-theme.sh
 
 bind = $mainMod ALT, Space, togglefloating,
 

+ 165 - 0
dot-config/hypr/keybind.conf

@@ -0,0 +1,165 @@
+# ################### It just works™ keybinds ###################
+# Volume
+bindl = ,XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle
+bindle=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
+bindle=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
+
+# Brightness
+# bindle=, XF86MonBrightnessUp, exec, light -A 5
+# bindle=, XF86MonBrightnessDown, exec, light -U 5
+bindle=, XF86MonBrightnessUp, exec, ags run-js 'brightness.screen_value += 0.05;'
+bindle=, XF86MonBrightnessDown, exec, ags run-js 'brightness.screen_value -= 0.05;'
+
+# ####################################### Applications ########################################
+# Apps: just normal apps
+bind = Super, Return, exec, $terminal
+bind = Super, E, exec, nautilus --new-window
+bind = Super, V, exec, chromium
+# bind = ControlSuperAlt, E, exec, /usr/bin/microsoft-edge-stable --password-store=gnome --enable-features=UseOzonePlatform --ozone-platform=wayland --gtk-version=4
+# bind = Super, Z, exec, kitty -e neomutt
+
+# Apps: Settings and config
+bind = Super, A, exec, pavucontrol
+
+# Actions
+bind = Super, Period, exec, fuzzelunicode
+bind = SuperShift, Period, exec, fuzzelnerd
+bind = Super, G, exec, fuzzel-greek-letters-prompt
+bind = Super, O, exec, open-stream
+bind = Super, Q, killactive,
+bind = SuperAlt, Space, togglefloating,
+bind = SuperShift, T, exec, ~/.config/hypr/scripts/toggle-theme.sh
+# german
+bind = SuperShift Alt, T, exec, grim -g "$(slurp -d -c D1E5F4BB -b 1B232866 -s 00000000)" "tmp.png" && tesseract -l deu "tmp.png" - | wl-copy && rm "tmp.png"
+
+# Media
+# bind = SuperShift, N, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"`
+bindl  = , XF86AudioNext,           exec, ags run-js "Mpris.getPlayer()?.next()"
+# bind = SuperShift, B, exec, playerctl previous
+# bind = SuperShift, P, exec, playerctl play-pause
+
+#Lock screen  |  blur: --effect-blur=20x202
+# bind = Super, L, exec, gtklock
+bind = SuperShift, L, exec, gtklock
+bindl = SuperShift, L, exec, sleep 0.1 && sus
+
+# App launcher
+bind = ControlSuper, Slash, exec, pkill anyrun || anyrun
+
+# ##################################### AGS keybinds #####################################
+bindr = ControlSuper, R, exec, hyprctl reload; killall ags activewin.sh activews.sh gohypr bash ydotool; ags &
+bindir = Super, Super_L, exec, fuzzel
+# bind = Super, O, exec, ags -t 'sideleft'
+# bind = Super, N, exec, ags -t 'sideright'
+# bind = Super, M, exec, ags run-js 'openMusicControls.value = (!Mpris.getPlayer() ? false : !openMusicControls.value);'
+bind = SuperShift, K, exec, ags -t 'osk'
+bind = ControlAlt, Delete, exec, ags -t 'session'
+bindr = Control, Control_R, exec, ags run-js 'indicator.popup(-1);'
+bindr = Control, Control_R, exec, ags run-js 'Notifications.notifications.forEach((notif) => notif.dismiss())'
+bindle = , XF86AudioRaiseVolume, exec, ags run-js 'indicator.popup(1);'
+bindle = , XF86AudioLowerVolume, exec, ags run-js 'indicator.popup(1);'
+bindle = , XF86MonBrightnessUp, exec, ags run-js 'indicator.popup(1);'
+bindle = , XF86MonBrightnessDown, exec, ags run-js 'indicator.popup(1);'
+bindr = Control, Control_R, exec, ags run-js 'App.closeWindow("sideright");'
+bindr = Control, Control_R, exec, ags run-js 'App.closeWindow("cheatsheet");'
+bindr = Control, Control_R, exec, ags run-js 'App.closeWindow("osk");'
+bindr = Control, Control_R, exec, ags run-js 'App.closeWindow("session");'
+bindr = Control, Control_R, exec, ags run-js 'openMusicControls.value = false'
+
+# ##################################### Plugins #########################################
+# bind = ControlSuper, P, exec, hyprctl plugin load '/home/end/.config/hypr/plugins/droidbars.so'
+# bind = ControlSuper, O, exec, hyprctl plugin unload '/home/end/.config/hypr/plugins/droidbars.so'
+
+# # Testing
+bind = SuperAlt, f12, exec, notify-send "Millis since epoch" "$(date +%s%N | cut -b1-13)" -a 'Hyprland keybind'
+bind = SuperAlt, P, exec, notify-send "Urgent notification" "Ah hell no" -u critical -a 'Hyprland keybind'
+
+# ########################### Keybinds for Hyprland ############################
+# Swap windows
+bind = SuperShift, left, movewindow, l
+bind = SuperShift, right, movewindow, r
+bind = SuperShift, up, movewindow, u
+bind = SuperShift, down, movewindow, d
+# Move focus
+bind = Super, left, movefocus, l
+bind = Super, right, movefocus, r
+bind = Super, up, movefocus, u
+bind = Super, down, movefocus, d
+bind = Super, BracketLeft, movefocus, l
+bind = Super, BracketRight, movefocus, r
+
+# Workspace, window, tab switch with keyboard
+bind = ControlSuper, right, workspace, +1
+bind = ControlSuper, left, workspace, -1
+bind = ControlSuper, BracketLeft, workspace, -1
+bind = ControlSuper, BracketRight, workspace, +1
+bind = ControlSuper, up, workspace, -5
+bind = ControlSuper, down, workspace, +5
+bind = Super, Page_Down, workspace, +1
+bind = Super, Page_Up, workspace, -1
+bind = ControlSuper, Page_Down, workspace, +1
+bind = ControlSuper, Page_Up, workspace, -1
+bind = SuperAlt, Page_Down, movetoworkspace, +1
+bind = SuperAlt, Page_Up, movetoworkspace, -1
+bind = SuperShift, Page_Down, movetoworkspace, +1
+bind = SuperShift, Page_Up, movetoworkspace, -1
+bind = ControlSuperShift, Right, movetoworkspace, +1
+bind = ControlSuperShift, Left, movetoworkspace, -1
+bind = SuperShift, mouse_down, movetoworkspace, -1
+bind = SuperShift, mouse_up, movetoworkspace, +1
+bind = SuperAlt, mouse_down, movetoworkspace, -1
+bind = SuperAlt, mouse_up, movetoworkspace, +1
+
+# Window split ratio
+binde = Super, H, layoutmsg, mfact -0.05
+binde = Super, L, layoutmsg, mfact +0.05
+
+# Fullscreen
+bind = Super, F, fullscreen, 0
+# bind = SuperShift, F, fakefullscreen, 0
+
+# Switching
+bind = Super, 1, workspace, 1
+bind = Super, 2, workspace, 2
+bind = Super, 3, workspace, 3
+bind = Super, 4, workspace, 4
+bind = Super, 5, workspace, 5
+bind = Super, 6, workspace, 6
+bind = Super, 7, workspace, 7
+bind = Super, 8, workspace, 8
+bind = Super, 9, workspace, 9
+bind = Super, 0, workspace, 10
+bind = Super, S, togglespecialworkspace,
+
+# Move window to workspace Super + Alt + [0-9]
+bind = Super Shift, 1, movetoworkspacesilent, 1
+bind = Super Shift, 2, movetoworkspacesilent, 2
+bind = Super Shift, 3, movetoworkspacesilent, 3
+bind = Super Shift, 4, movetoworkspacesilent, 4
+bind = Super Shift, 5, movetoworkspacesilent, 5
+bind = Super Shift, 6, movetoworkspacesilent, 6
+bind = Super Shift, 7, movetoworkspacesilent, 7
+bind = Super Shift, 8, movetoworkspacesilent, 8
+bind = Super Shift, 9, movetoworkspacesilent, 9
+bind = Super Shift, 0, movetoworkspacesilent, 10
+bind = ControlShiftSuper, Up, movetoworkspacesilent, special
+bind = SuperAlt, S, movetoworkspacesilent, special
+
+# Scroll through existing workspaces with (Control) + Super + scroll
+bind = Super, mouse_up, workspace, +1
+bind = Super, mouse_down, workspace, -1
+bind = ControlSuper, mouse_up, workspace, +1
+bind = ControlSuper, mouse_down, workspace, -1
+
+# Move/resize windows with Super + LMB/RMB and dragging
+bindm = Super, mouse:272, movewindow
+bindm = Super, mouse:273, resizewindow
+# bindm = Super, mouse:274, movewindow
+bind = ControlSuper, Backslash, resizeactive, exact 640 480
+
+# Master Layout Control
+bind = SuperShift, Return, layoutmsg, swapwithmaster
+bind = Super, J, layoutmsg, cyclenext
+bind = Super, K, layoutmsg, cycleprev
+bind = Super, I, layoutmsg, addmaster
+bind = Super, D, layoutmsg, removemaster

+ 12 - 0
dot-config/hypr/scripts/toggle-theme.sh

@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+# Check current color scheme
+CURRENT_SCHEME=$(gsettings get org.gnome.desktop.interface color-scheme)
+
+if [ "$CURRENT_SCHEME" == "'prefer-dark'" ]; then
+    gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
+    notify-send "Light Mode" -a "System"
+else
+    gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
+    notify-send "Dark Mode" -a "System"
+fi

+ 42 - 35
dot-config/wezterm/wezterm.lua

@@ -5,60 +5,67 @@ if wezterm.config_builder then
 end
 
 config.font = wezterm.font 'JetBrainsMono Nerd Font'
-
 config.enable_tab_bar = false
 
-config.colors = {
+-- Function to determine if the system is in dark mode
+local function is_dark()
+  if wezterm.gui then
+    return wezterm.gui.get_appearance():find 'Dark'
+  end
+  return true
+end
+
+-- Define color schemes
+local dark_colors = {
   foreground = '#e4e1e6',
   background = '#1b1b1f',
-
-  -- Overrides the cell background color when the current cell is occupied by the
-  -- cursor and the cursor style is set to Block
   cursor_bg = '#add8e6',
-  -- Overrides the text color when the current cell is occupied by the cursor
   cursor_fg = 'black',
-  -- Specifies the border color of the cursor when the cursor style is set to Block,
-  -- or the color of the vertical or horizontal bar when the cursor style is set to
-  -- Bar or Underline.
   cursor_border = '#add8e6',
-
-  -- the foreground color of selected text
   selection_fg = 'black',
-  -- the background color of selected text
   selection_bg = '#fffacd',
-
-  -- The color of the scrollbar "thumb"; the portion that represents the current viewport
   scrollbar_thumb = '#222222',
-
-  -- The color of the split lines between panes
   split = '#444444',
-
   ansi = {
-    '#3b4252',
-    '#bf616a',
-    '#a3be8c',
-    '#ebcb8b',
-    '#81a1c1',
-    '#b48ead',
-    '#88c0d0',
-    '#e5e9f0',
+    '#3b4252', '#bf616a', '#a3be8c', '#ebcb8b',
+    '#81a1c1', '#b48ead', '#88c0d0', '#e5e9f0',
   },
   brights = {
-    '#4c566a',
-    '#bf616a',
-    '#a3be8c',
-    '#ebcb8b',
-    '#81a1c1',
-    '#b48ead',
-    '#8fbcbb',
-    '#eceff4',
+    '#4c566a', '#bf616a', '#a3be8c', '#ebcb8b',
+    '#81a1c1', '#b48ead', '#8fbcbb', '#eceff4',
   },
+  indexed = { [136] = '#af8700' },
+}
 
-  -- Arbitrary colors of the palette in the range from 16 to 255
+local light_colors = {
+  foreground = '#2e3440',
+  background = '#eceff4',
+  cursor_bg = '#5e81ac',
+  cursor_fg = 'white',
+  cursor_border = '#5e81ac',
+  selection_fg = '#eceff4',
+  selection_bg = '#4c566a',
+  scrollbar_thumb = '#d8dee9',
+  split = '#d8dee9',
+  ansi = {
+    '#3b4252', '#bf616a', '#a3be8c', '#ebcb8b',
+    '#81a1c1', '#b48ead', '#88c0d0', '#e5e9f0',
+  },
+  brights = {
+    '#4c566a', '#bf616a', '#a3be8c', '#ebcb8b',
+    '#81a1c1', '#b48ead', '#8fbcbb', '#eceff4',
+  },
   indexed = { [136] = '#af8700' },
 }
-config.cursor_blink_rate = 0
 
+-- Apply colors based on appearance
+if is_dark() then
+  config.colors = dark_colors
+else
+  config.colors = light_colors
+end
+
+config.cursor_blink_rate = 0
 config.disable_default_key_bindings = true
 config.keys = {
   {