diff --git a/bin/kutu.rb b/bin/kutu.rb index 8d7a560..02e5635 100755 --- a/bin/kutu.rb +++ b/bin/kutu.rb @@ -1,26 +1,26 @@ #!/usr/bin/env ruby -# Require X-kutu library for all x11 functions +# require x-kutu library for all x11 functions -require_relative "../src/ruby/X-kutu" +require_relative "../src/ruby/x-kutu" -# Require dependencies +# require dependencies require 'json' require 'socket' -# Initialize X +# initialize x -if X.deploy >= 0 - puts "Started kutu WM for X11 successfully! :)" +if x.deploy >= 0 + puts "started kutu wm for x11 successfully! :)" else - raise "Failed to deploy X, try running using xinit or startx." + raise "failed to deploy x, try running using xinit or startx." end -# Require submodules +# require submodules require_relative "../src/ruby/utils" require_relative "../src/ruby/controller" @@ -28,17 +28,19 @@ require_relative "../src/ruby/window" require_relative "../src/ruby/workspace" require_relative "../src/ruby/events" require_relative "../src/ruby/commands" +require_relative "../src/ruby/factory" +require_relative "../src/ruby/config" -# Cleanup on exit +# cleanup on exit at_exit do - X.cleanup - puts "Exited kutu WM, sadly :(" + x.cleanup + puts "exited kutu wm, sadly :(" end -# Globals +# globals $monitors = {} $windows = {} @@ -50,47 +52,42 @@ $mousebind_actions = {} $mouse_data = {} -$root = X.get_root +$root = x.get_root $rect = {} -# Initialize monitors +# initialize monitors load_monitors! -# Run startup script +# load config -run File.join(__dir__, "../src/shell/startup.sh") +load_config! -# Add keybinds +# setup unix socket -load File.join(__dir__, "../src/ruby/bindings.rb") +sock_path = "/tmp/kutu.sock" +file.delete sock_path if file.exist? sock_path + +$socket = socket.new :unix, :dgram +$socket.bind socket.pack_sockaddr_un(sock_path) -# Setup unix socket - -SOCK_PATH = "/tmp/kutu.sock" -File.delete SOCK_PATH if File.exist? SOCK_PATH - -$socket = Socket.new :UNIX, :DGRAM -$socket.bind Socket.pack_sockaddr_un(SOCK_PATH) - - -# Main loop +# main loop loop do sleep 0.001 - if IO.select([$socket], nil, nil, 0) + if io.select([$socket], nil, nil, 0) command, sender = $socket.recvfrom 1024 reply = handle_command command - $socket.send JSON.generate(reply), 0, sender + $socket.send json.generate(reply), 0, sender end - event_pointer = X.next_event - handle_event X.translate_event(event_pointer) if !event_pointer.null? + event_pointer = x.next_event + handle_event x.translate_event(event_pointer) if !event_pointer.null? - X.flush + x.flush end diff --git a/src/ruby/bindings.rb b/src/ruby/bindings.rb deleted file mode 100644 index b447355..0000000 --- a/src/ruby/bindings.rb +++ /dev/null @@ -1,255 +0,0 @@ -PERSISTENCE_PATH = File.join( - ENV["XDG_STATE_HOME"] || File.expand_path("~/.local/state"), - "kutu", - "num.json" -) - -presets = { - normal: [0, X.clk], - mod: [X.mod, X.mod | X.clk] -} - -keybind 23, presets[:mod] do |_event| - run "firefox" -end - -keybind 24, presets[:mod] do |event| - X.kill event[:window] -end - -keybind 25, presets[:mod] do |_event| - run "kitty" -end - -keybind 26, presets[:mod] do |_event| - run File.join(__dir__, "../shell/power.sh") -end - -keybind 123, presets[:normal] do |_event| - run %q( - pactl set-sink-volume @DEFAULT_SINK@ +5%; - vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n1); - dunstify "Volume Adjusted" "" -h int:value:$vol -r 997 - ) -end - -keybind 122, presets[:normal] do |_event| - run %q( - pactl set-sink-volume @DEFAULT_SINK@ -5%; - vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n1); - dunstify "Volume Adjusted" "" -h int:value:$vol -r 997 - ) -end - -keybind 121, presets[:normal] do |_event| - run %q( - pactl set-sink-mute @DEFAULT_SINK@ toggle; - vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\\+%' | head -n1); - dunstify "Volume Adjusted" "" -h int:value:$vol -r 997 - ) -end - -keybind 38, presets[:mod] do |_event| - run %Q( - maim -c 0.3,0.5,1.0,0.8 -s | tee /tmp/screenshot_temp.png | xclip -selection clipboard -t image/png; - if [ -s '/tmp/screenshot_temp.png' ]; then - mv /tmp/screenshot_temp.png ~/screenshots/$(date +%Y-%m-%d_%H:%M:%S).png; - fi - ) -end - -keybind 232, presets[:normal] do |_event| - run %q( - brightnessctl set 5%-; - pct=$(brightnessctl -m | cut -d, -f4 | tr -d ' %'); - dunstify "Brightness" "" -h int:value:$pct -r 998 - ) -end - -keybind 233, presets[:normal] do |_event| - run %q( - brightnessctl set 5%+; - pct=$(brightnessctl -m | cut -d, -f4 | tr -d ' %'); - dunstify "Brightness" "" -h int:value:$pct -r 998 - ) -end - -keybind 54, presets[:mod] do |_event| - run "kitty -e fish -c \"y\"" -end - -keybind 53, presets[:mod] do |_event| - run "kitty -e fish -c \"editor\"" -end - -keybind 41, presets[:mod] do |_event| - run "kitty -e fish -c \"btop\"" -end - -keybind 40, presets[:mod] do |_event| - run File.join(__dir__, "../shell/run.sh") -end - -keybind 33, presets[:mod] do |_event| - run "~/.config/polybar/launch.sh" -end - -keybind 45, presets[:mod] do |_event| - run File.join(__dir__, "../shell/caffiene.sh") -end - -keybind 56, presets[:mod] do |_event| - monitor = current_monitor - create_workspace monitor - persistence = File.exist?(PERSISTENCE_PATH) ? - JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : - {} - persistence[$monitors.key(monitor)] ||= {} - persistence[$monitors.key(monitor)][:length] = monitor[:workspaces].length - File.write(PERSISTENCE_PATH, JSON.pretty_generate(persistence)) -end - -keybind 57, presets[:mod] do |_event| - monitor = current_monitor - delete_workspace monitor[:workspaces].length - 1, monitor - persistence = File.exist?(PERSISTENCE_PATH) ? - JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : - {} - persistence[$monitors.key(monitor)] ||= {} - persistence[$monitors.key(monitor)][:length] = monitor[:workspaces].length - File.write(PERSISTENCE_PATH, JSON.pretty_generate(persistence)) -end - -keybind 110, presets[:normal] do |_event| - run %q( - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause; - dbus-send --print-reply --dest=$(busctl --user list | grep -oP 'org.mpris.MediaPlayer2.firefox.instance_1_\\d+') \ - /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause - ) -end - -keybind 173, presets[:mod] do |_event| - run %q(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous) -end - -keybind 171, presets[:mod] do |_event| - run %q(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next) -end - -keybind 89, presets[:mod] do |_event| - monitor = current_monitor - persistence = File.exist?(PERSISTENCE_PATH) ? - JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : - {} - if monitor[:selected_workspace] == 0 - select_workspace persistence[$monitors.key(monitor)]&.[](:saved) || 1, monitor - else - persistence[$monitors.key(monitor)] ||= {} - persistence[$monitors.key(monitor)][:saved] = monitor[:selected_workspace] - File.write(PERSISTENCE_PATH, JSON.pretty_generate(persistence)) - select_workspace 0, monitor - end -end - -keybind 81, presets[:mod] do |event| - monitor = current_monitor - persistence = File.exist?(PERSISTENCE_PATH) ? - JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : - {} - ws = monitor[:workspaces][ - monitor[:selected_workspace] == 0 ? - monitor[:workspaces][persistence[$monitors.key(monitor)]&.[](:saved) || 1] : 0 - ] - ws.drop ws.tiled_windows.length, $windows[event[:window]] if $windows[event[:window]] -end - -keybind 118, presets[:normal] do |_event| - run "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" -end - -keybind 86, presets[:normal] do |_event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - next_ws = (monitor[:selected_workspace] % (monitor[:workspaces].length - 1)) + 1 - select_workspace next_ws, monitor -end - -keybind 86, presets[:mod] do |event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - ws = monitor[:workspaces][(monitor[:selected_workspace] % (monitor[:workspaces].length - 1)) + 1] - ws.drop ws.tiled_windows.length, $windows[event[:window]] if $windows[event[:window]] -end - -keybind 82, presets[:normal] do |_event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - next_ws = ((monitor[:selected_workspace] - 2) % (monitor[:workspaces].length - 1)) + 1 - select_workspace next_ws, monitor -end - -keybind 82, presets[:mod] do |event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - ws = monitor[:workspaces][((monitor[:selected_workspace] - 2) % (monitor[:workspaces].length - 1)) + 1] - ws.drop ws.tiled_windows.length, $windows[event[:window]] if $windows[event[:window]] -end - -keybind 10, presets[:mod] do |_event| - run "setxkbmap us" -end - -keybind 11, presets[:mod] do |_event| - run "setxkbmap ara" -end - -keybind 27, presets[:mod] do |_event| - load File.join(__dir__, "./bindings.rb") - load File.join(__dir__, "./events.rb") - monitor = current_monitor - next unless monitor - monitor[:workspaces][monitor[:selected_workspace]].switch_direction -end - -keybind 55, presets[:mod] do |_event| - run %q( - CM_LAUNCHER=rofi clipmenu - ) -end - -keybind 39, presets[:mod] do |event| - window = $windows[event[:window]] - window.toggle_floating if window -end - -mousebind 1, presets[:mod] {|x|} - -mousebind 3, presets[:mod] {|x|} - -mousebind 9, presets[:normal] do |_event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - next_ws = (monitor[:selected_workspace] % (monitor[:workspaces].length - 1)) + 1 - select_workspace next_ws, monitor -end - -mousebind 9, presets[:mod] do |event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - ws = monitor[:workspaces][(monitor[:selected_workspace] % (monitor[:workspaces].length - 1)) + 1] - ws.drop ws.tiled_windows.length, $windows[event[:window]] if $windows[event[:window]] -end - -mousebind 8, presets[:normal] do |_event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - next_ws = ((monitor[:selected_workspace] - 2) % (monitor[:workspaces].length - 1)) + 1 - select_workspace next_ws, monitor -end - -mousebind 8, presets[:mod] do |event| - monitor = current_monitor - next if monitor[:selected_workspace].zero? - ws = monitor[:workspaces][((monitor[:selected_workspace] - 2) % (monitor[:workspaces].length - 1)) + 1] - ws.drop ws.tiled_windows.length, $windows[event[:window]] if $windows[event[:window]] -end diff --git a/src/ruby/config.rb b/src/ruby/config.rb new file mode 100644 index 0000000..8b4f54c --- /dev/null +++ b/src/ruby/config.rb @@ -0,0 +1,24 @@ +def config_path + File.join( + ENV["XDG_CONFIG_HOME"] || File.expand_path("~/.config"), + "kutu", + "config.rb" + ) +end + +def load_config! + path = config_path + + unless File.exist?(path) + load "./defaults.rb" + return + end + + puts "loading kutu config: #{path}" + + load path +rescue Exception => e + warn "failed to load kutu config" + warn "#{e.class}: #{e.message}" + warn e.backtrace.join("\n") +end diff --git a/src/ruby/defaults.rb b/src/ruby/defaults.rb new file mode 100644 index 0000000..95391f6 --- /dev/null +++ b/src/ruby/defaults.rb @@ -0,0 +1,89 @@ +bind_key 23, true, "firefox" +bind_key 24, true, :kill_window +bind_key 25, true, "kitty" +bind_key 26, true, "bash /home/me/dotfiles/scripts/power.sh" + +bind_key 123, false, %q( + pactl set-sink-volume @DEFAULT_SINK@ +5%; + vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n1); + dunstify "Volume Adjusted" "" -h int:value:$vol -r 997 +) + +bind_key 122, false, %q( + pactl set-sink-volume @DEFAULT_SINK@ -5%; + vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n1); + dunstify "Volume Adjusted" "" -h int:value:$vol -r 997 +) + +bind_key 121, false, %q( + pactl set-sink-mute @DEFAULT_SINK@ toggle; + vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n1); + dunstify "Volume Adjusted" "" -h int:value:$vol -r 997 +) + +bind_key 38, true, %Q( + maim -c 0.3,0.5,1.0,0.8 -s | tee /tmp/screenshot_temp.png | xclip -selection clipboard -t image/png; + if [ -s '/tmp/screenshot_temp.png' ]; then + mv /tmp/screenshot_temp.png ~/screenshots/$(date +%Y-%m-%d_%H:%M:%S).png; + fi +) + +bind_key 232, false, %q( + brightnessctl set 5%-; + pct=$(brightnessctl -m | cut -d, -f4 | tr -d ' %'); + dunstify "Brightness" "" -h int:value:$pct -r 998 +) + +bind_key 233, false, %q( + brightnessctl set 5%+; + pct=$(brightnessctl -m | cut -d, -f4 | tr -d ' %'); + dunstify "Brightness" "" -h int:value:$pct -r 998 +) + +bind_key 54, true, 'kitty -e fish -c "y"' +bind_key 53, true, 'kitty -e fish -c "editor"' +bind_key 41, true, 'kitty -e fish -c "btop"' + +bind_key 40, true, "bash /home/me/dotfiles/scripts/run.sh" + +bind_key 56, true, :add_workspace +bind_key 57, true, :delete_workspace + +bind_key 110, false, %q( + dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify \ + /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause; + dbus-send --print-reply --dest=$(busctl --user list | grep -oP 'org.mpris.MediaPlayer2.firefox.instance_1_\d+') \ + /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause +) + +bind_key 173, true, + "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" + +bind_key 171, true, + "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" + +bind_key 89, true, :toggle_scratchpad + +bind_key 81, true, :toggle_move_scratchpad + +bind_key 118, false, + "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" + +bind_key 86, false, :workspace_next +bind_key 86, true, :move_window_next_workspace + +bind_key 82, false, :workspace_previous +bind_key 82, true, :move_window_previous_workspace + +bind_key 10, true, "setxkbmap us" +bind_key 11, true, "setxkbmap ara" + +bind_key 55, true, "CM_LAUNCHER=rofi clipmenu" + +bind_key 39, true, :toggle_floating + +bind_mouse 9, false, :workspace_next +bind_mouse 9, true, :move_window_next_workspace + +bind_mouse 8, false, :workspace_previous +bind_mouse 8, true, :move_window_previous_workspace diff --git a/src/ruby/factory.rb b/src/ruby/factory.rb new file mode 100644 index 0000000..32ebccf --- /dev/null +++ b/src/ruby/factory.rb @@ -0,0 +1,179 @@ +PERSISTENCE_PATH = File.join( + ENV["XDG_STATE_HOME"] || File.expand_path("~/.local/state"), + "kutu", + "num.json" +) + +ACTIONS = {} + +def action(name, &block) + ACTIONS[name] = block +end + +action :kill_window do |event| + X.kill event[:window] +end + +action :toggle_floating do |event| + window = $windows[event[:window]] + window.toggle_floating if window +end + +action :workspace_next do |_event| + monitor = current_monitor + next if monitor[:selected_workspace].zero? + + next_ws = + (monitor[:selected_workspace] % + (monitor[:workspaces].length - 1)) + 1 + + select_workspace next_ws, monitor +end + +action :workspace_previous do |_event| + monitor = current_monitor + next if monitor[:selected_workspace].zero? + + next_ws = + ((monitor[:selected_workspace] - 2) % + (monitor[:workspaces].length - 1)) + 1 + + select_workspace next_ws, monitor +end + +action :move_window_next_workspace do |event| + monitor = current_monitor + next if monitor[:selected_workspace].zero? + + ws = + monitor[:workspaces][ + (monitor[:selected_workspace] % + (monitor[:workspaces].length - 1)) + 1 + ] + + ws.drop ws.tiled_windows.length, + $windows[event[:window]] if $windows[event[:window]] +end + +action :move_window_previous_workspace do |event| + monitor = current_monitor + next if monitor[:selected_workspace].zero? + + ws = + monitor[:workspaces][ + ((monitor[:selected_workspace] - 2) % (monitor[:workspaces].length - 1)) + 1 + ] + + ws.drop ws.tiled_windows.length, + $windows[event[:window]] if $windows[event[:window]] +end + +action :toggle_scratchpad do |_event| + monitor = current_monitor + persistence = File.exist?(PERSISTENCE_PATH) ? + JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : + {} + if monitor[:selected_workspace] == 0 + select_workspace persistence[$monitors.key(monitor)]&.[](:saved) || 1, monitor + else + persistence[$monitors.key(monitor)] ||= {} + persistence[$monitors.key(monitor)][:saved] = monitor[:selected_workspace] + File.write(PERSISTENCE_PATH, JSON.pretty_generate(persistence)) + select_workspace 0, monitor + end +end + +action :toggle_move_scratchpad do |event| + monitor = current_monitor + persistence = File.exist?(PERSISTENCE_PATH) ? + JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : + {} + ws = monitor[:workspaces][ + monitor[:selected_workspace] == 0 ? + monitor[:workspaces][persistence[$monitors.key(monitor)]&.[](:saved) || 1] : 0 + ] + ws.drop ws.tiled_windows.length, $windows[event[:window]] if $windows[event[:window]] +end + +action :add_workspace do |_event| + monitor = current_monitor + create_workspace monitor + persistence = File.exist?(PERSISTENCE_PATH) ? + JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : + {} + persistence[$monitors.key(monitor)] ||= {} + persistence[$monitors.key(monitor)][:length] = monitor[:workspaces].length + File.write(PERSISTENCE_PATH, JSON.pretty_generate(persistence)) +end + +action :delete_workspace do |_event| + monitor = current_monitor + delete_workspace monitor[:workspaces].length - 1, monitor + persistence = File.exist?(PERSISTENCE_PATH) ? + JSON.parse(File.read(PERSISTENCE_PATH), symbolize_names: true) : + {} + persistence[$monitors.key(monitor)] ||= {} + persistence[$monitors.key(monitor)][:length] = monitor[:workspaces].length + File.write(PERSISTENCE_PATH, JSON.pretty_generate(persistence)) +end + +PRESETS = { + normal: [0, X.clk, X.num | X.clk, X.num], + mod: [ + X.mod, + X.mod | X.clk, + X.num | X.clk | X.mod, + X.num | X.mod + ] +} + + +def resolve_action(action, &block) + action ||= block + + case action + when Symbol + ACTIONS.fetch(action) do + raise "Unknown kutu action: #{action}" + end + + when String + proc do |_event| + run action + end + + when Proc + action + + else + raise ArgumentError, + "Expected action Symbol, String, or Block, got #{action.class}" + end +end + +PRESETS[:mod].each do |modifier| + X.add_mousebind 1, modifier +end + +PRESETS[:mod].each do |modifier| + X.add_mousebind 3, modifier +end + +def bind_key(code, mod, action = nil, &block) + callback = resolve_action(action, &block) + + PRESETS[mod ? :mod : :normal].each do |modifier| + X.add_keybind code, modifier + $keybind_actions[[code, modifier]] = callback + end +end + + +def bind_mouse(button, mod, action = nil, &block) + callback = resolve_action(action, &block) + + PRESETS[mod ? :mod : :normal].each do |modifier| + X.add_mousebind button, modifier + $mousebind_actions[[button, modifier]] = callback + end +end diff --git a/src/ruby/utils.rb b/src/ruby/utils.rb index 56e5bb1..631d903 100644 --- a/src/ruby/utils.rb +++ b/src/ruby/utils.rb @@ -4,25 +4,6 @@ PERSISTENCE_PATH = File.join( "num.json" ) -def keybind(key, mod, &block) - if mod.is_a? Array - mod.each { |m| keybind(key, m, &block) } - return - end - X.add_keybind key, mod - $keybind_actions[[key, mod]] = block if block -end - -def mousebind(btn, mod, &block) - if mod.is_a? Array - mod.each { |m| mousebind(btn, m, &block) } - return - end - X.add_mousebind btn, mod - $mousebind_actions[[btn, mod]] = block if block -end - - def run(cmd) pid = spawn "bash", "-c", cmd Process.detach pid diff --git a/src/shell/caffiene.sh b/src/shell/caffiene.sh deleted file mode 100755 index f28916f..0000000 --- a/src/shell/caffiene.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -if [[ "$(xset q | awk '/timeout:/ {print $2}')" == "0" ]]; then - xset s on - xset +dpms -else - xset s off - xset -dpms -fi diff --git a/src/shell/power.sh b/src/shell/power.sh deleted file mode 100755 index c819b02..0000000 --- a/src/shell/power.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -opts=" Lock -󰒲 Suspend - Shutdown -󰜉 Reboot - Hibernate - Stop KutuWM" - -sel=$(printf "%s\n" "$opts" | dmenu -i -p "Select Power Option:" \ - -nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'AgaveNerdFont-16') - -[ -z "$sel" ] && exit 0 - -case "$sel" in -*Shutdown*) - confirm=$(printf "No\nYes" | dmenu -i -p "Are you sure you want to shutdown? :" \ - -nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'AgaveNerdFont-16') - [ "$confirm" = "Yes" ] && exec shutdown -h now - ;; -*Reboot*) - confirm=$(printf "No\nYes" | dmenu -i -p "Are you sure you want to reboot? :" \ - -nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'HurmitNerdFont-16') - [ "$confirm" = "Yes" ] && exec reboot - ;; -*Hibernate*) - confirm=$(printf "No\nYes" | dmenu -i -p "Are you sure you want to hibernate? :" \ - -nf '#e0af68' -nb '#1f2335' -sb '#f7768e' -sf '#1a1b26' -fn 'AgaveNerdFont-16') - [ "$confirm" = "Yes" ] && exec systemctl hibernate - ;; -*Stop\ KutuWM*) - exec kutu-run.rb stop - ;; -*Suspend*) - exec systemctl suspend - ;; -*Lock*) - ~/dotfiles/scripts/lock.sh & - ;; -esac diff --git a/src/shell/run.sh b/src/shell/run.sh deleted file mode 100755 index 4a5a581..0000000 --- a/src/shell/run.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -choice=$( - ( - printf "%s\n" prism - compgen -c - ) | - grep -v -E '^(if|fi|case|esac|for|done|while|until|select|function|return|continue|break|time|exec|source|alias|builtin|read|export|unset|local|set|declare|typeset|:|\.|\[|coproc|l|ll|ls|then|else|elif|do|in|\{|\}|!|\[\[|\]\]|_.*|compgen)$' | - sort | - dmenu -i -p "Enter command  " \ - -nf '#4abaaf' -nb '#1f2335' -sb '#7aa2f7' -sf '#102030' -fn 'AgaveNerdFont-16' -) - -[ -z "$choice" ] && exit 0 - -fish -c "$choice" >/dev/null 2>&1 & -disown diff --git a/src/shell/startup.sh b/src/shell/startup.sh deleted file mode 100755 index 5d8d012..0000000 --- a/src/shell/startup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -picom --config ~/dotfiles/picom/dot-config/picom/picom.conf & -clipmenud & -# xss-lock --transfer-sleep-lock -- ~/dotfiles/scripts/lock.sh & -dunst -config ~/.config/dunst/dunstrc & - -#magick -size 1920x1080 xc:#000000 /tmp/f_bg.png -#feh --bg-fill /tmp/f_bg.png -xsetroot -cursor_name left_ptr - -setxkbmap us - -export XAUTHORITY="$HOME/.Xauthority" - -systemctl --user import-environment DISPLAY XAUTHORITY -dbus-update-activation-environment DISPLAY XAUTHORITY - -systemctl --user restart xdg-desktop-portal -systemctl --user restart xdg-desktop-portal-gtk -