diff --git a/config/awesome/config/bar.lua b/config/awesome/config/bar.lua index bf5d4d2..ea17b1f 100644 --- a/config/awesome/config/bar.lua +++ b/config/awesome/config/bar.lua @@ -77,6 +77,38 @@ function M.setup() } } end) + + -- Overlay for rofi launchers + local dim_overlay = wibox({ + visible = false, + ontop = true, + type = "splash", + bg = "#00000099", + }) + dim_overlay.name = "awesome_dim_overlay" + + awful.screen.connect_for_each_screen(function(s) + dim_overlay.screen = s -- adjust if you want it per-screen vs spanning all + end) + + -- span the primary screen's geometry (or loop over all screens if you use a multi-monitor dim) + local function update_dim_geometry() + local geo = screen.primary.geometry + dim_overlay:geometry(geo) + end + update_dim_geometry() + screen.connect_signal("property::geometry", update_dim_geometry) + + -- expose functions over awesome-client + _G.show_dim = function() dim_overlay.visible = true end + _G.hide_dim = function() dim_overlay.visible = false end + + -- Prime the window so X/picom register its type before first real use, + -- avoiding a one-time grow animation on the very first show_dim() call + dim_overlay.visible = true + gears.timer.delayed_call(function() + dim_overlay.visible = false + end) end return M diff --git a/config/awesome/config/keys.lua b/config/awesome/config/keys.lua index bc79227..6955dc7 100644 --- a/config/awesome/config/keys.lua +++ b/config/awesome/config/keys.lua @@ -5,13 +5,6 @@ local menubar = require("menubar") local M = {} --- Prefer rofi, fall back to built-in menubar -local function launcher() - awful.spawn.easy_async_with_shell("command -v rofi", function(out) - if out and out:match("%S") then awful.spawn("rofi -show drun") else menubar.show() end - end) -end - M.globalkeys = gears.table.join( awful.key({ modkey }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }), @@ -33,9 +26,8 @@ M.globalkeys = gears.table.join( -- Launching / layout awful.key({ modkey }, "Return", function() awful.spawn(terminal) end, { description = "open a terminal", group = "launcher" }), - awful.key({ modkey }, "space", launcher, { description = "application launcher", group = "launcher" }), awful.key({ modkey }, "e", function() awful.spawn("thunar") end, { description = "Filemanager", group = "system" }), - awful.key({ modkey }, "b", function() awful.spawn("chromium") end, { description = "Browser", group = "internet" }), + awful.key({ modkey }, "w", function() awful.spawn("chromium") end, { description = "Browser", group = "internet" }), awful.key({ modkey }, "t", function() awful.layout.inc(1) end, { description = "next layout", group = "layout" }), awful.key({ modkey }, "p", function() awful.spawn("xfce4-screenshooter") end, { description = "screenshot", group = "system" }), @@ -48,11 +40,14 @@ M.globalkeys = gears.table.join( awful.key({ }, "XF86AudioMute", function() awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']]) end, { description = "toggle mute", group = "media" }), -- rofi menus - awful.key({ modkey }, "a", function() awful.spawn("/home/jason/.local/bin/audioswitch") end, { description = "audio output", group = "system" }), + awful.key({ modkey }, "space", function() awful.spawn("/home/jason/.local/bin/runrofi") end, { description = "application launcher", group = "launcher" }), awful.key({ modkey }, "`", function() awful.spawn("/home/jason/.local/bin/powermenu") end, { description = "power menu", group = "system" }), + awful.key({ modkey }, "a", function() awful.spawn("/home/jason/.local/bin/audioswitch") end, { description = "audio output", group = "system" }), + awful.key({ modkey }, "b", function () awful.spawn("/home/jason/.local/bin/bookmarks") end, {description = "bookmarks", group = "internet"}), -- Awesome control awful.key({ modkey, "Shift" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }) + ) -- Workspace keys 1..5: Alt+N view, Alt+Shift+N move client to tag diff --git a/config/awesome/config/widgets.lua b/config/awesome/config/widgets.lua index 7f4231f..dcb9f55 100644 --- a/config/awesome/config/widgets.lua +++ b/config/awesome/config/widgets.lua @@ -71,8 +71,8 @@ function M.make_vol() end w:buttons(gears.table.join( - awful.button({ }, 1, function() awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']], function() refresh() end) end), - awful.button({ }, 3, function() awful.spawn("/home/jason/.local/bin/audioswitch") end), + awful.button({ }, 1, function() awful.spawn("/home/jason/.local/bin/audioswitch") end), + awful.button({ }, 3, function() awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-mute "$(pactl get-default-sink)" toggle']], function() refresh() end) end), awful.button({ }, 4, function() awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-volume "$(pactl get-default-sink)" +2%']], function() refresh() end) end), awful.button({ }, 5, function() awful.spawn.easy_async_with_shell([[sh -c 'pactl set-sink-volume "$(pactl get-default-sink)" -2%']], function() refresh() end) end) )) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index f6f3b89..3933283 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -50,3 +50,4 @@ bling.module.wallpaper.setup { position = "fit", background = "#181818", } + diff --git a/config/picom/picom.conf b/config/picom/picom.conf index a1fb482..793334c 100644 --- a/config/picom/picom.conf +++ b/config/picom/picom.conf @@ -274,5 +274,12 @@ rules: ( }, ); }, + { + match = "window_type = 'splash' && name = 'awesome_dim_overlay'"; + animations = (); + shadow = false; + corner-radius = 0; + fade = false; + }, ) diff --git a/scripts/bin/audioswitch b/scripts/bin/audioswitch index 4dc1faf..dc3614a 100755 --- a/scripts/bin/audioswitch +++ b/scripts/bin/audioswitch @@ -3,6 +3,9 @@ set -euo pipefail +awesome-client 'show_dim()' >/dev/null 2>&1 +trap 'awesome-client "hide_dim()" >/dev/null 2>&1' EXIT + # Get list of sinks: index, name, description mapfile -t sinks < <(pactl list sinks | awk -F': ' ' /^Sink #/ { idx=$2 } diff --git a/scripts/bin/bookmarks b/scripts/bin/bookmarks new file mode 100755 index 0000000..4e70a47 --- /dev/null +++ b/scripts/bin/bookmarks @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# rofi-bookmarks: pick a Chromium bookmark and open it (new tab or new window) + +set -euo pipefail +awesome-client 'show_dim()' >/dev/null 2>&1 +trap 'awesome-client "hide_dim()" >/dev/null 2>&1' EXIT + +BOOKMARKS_FILE="$HOME/.config/chromium/Default/Bookmarks" + +if [ ! -f "$BOOKMARKS_FILE" ]; then + notify-send "Bookmarks" "Chromium bookmarks file not found" + exit 1 +fi + +# Recursively walk the bookmark tree (roots -> bookmark_bar / other / synced) +# and emit "title\turl" for every leaf ("type": "url"), skipping folders. +list=$(jq -r ' + def walk_nodes: + if .type == "url" then + "\(.name)\t\(.url)" + elif .children then + .children[] | walk_nodes + else + empty + end; + .roots | to_entries[] | .value | walk_nodes +' "$BOOKMARKS_FILE") + +if [ -z "$list" ]; then + notify-send "Bookmarks" "No bookmarks found" + exit 0 +fi + +chosen=$(echo "$list" | awk -F'\t' '{print $1}' | rofi -dmenu -i -p "Bookmarks" \ + -theme-str 'listview { lines: 5; }' \ + -theme-str 'window { width: 21%; }' \ + -theme-str 'window { height: 400px; }') + +[ -z "$chosen" ] && exit 0 + +url=$(echo "$list" | awk -F'\t' -v title="$chosen" '$1 == title { print $2; exit }') + +[ -z "$url" ] && exit 0 + +# Open in a new tab of the existing Chromium window if one's running, +# otherwise this also launches Chromium fresh with that tab. +chromium --new-tab "$url" diff --git a/scripts/bin/powermenu b/scripts/bin/powermenu index 36a0b18..fb1fa44 100755 --- a/scripts/bin/powermenu +++ b/scripts/bin/powermenu @@ -3,6 +3,9 @@ set -euo pipefail +awesome-client 'show_dim()' >/dev/null 2>&1 +trap 'awesome-client "hide_dim()" >/dev/null 2>&1' EXIT + options=" Logout\n Restart\n Shutdown" chosen=$(echo -e "$options" | rofi -dmenu -i -p "Power" -markup-rows \ @@ -13,7 +16,7 @@ chosen=$(echo -e "$options" | rofi -dmenu -i -p "Power" -markup-rows \ case "$chosen" in *Logout*) - awesome-client "awesome.quit()" 2>/dev/null || echo "awesome.quit()" | awesome-client + loginctl terminate-session ${XDG_SESSION_ID-} ;; *Restart*) loginctl reboot diff --git a/scripts/bin/runrofi b/scripts/bin/runrofi new file mode 100755 index 0000000..7038376 --- /dev/null +++ b/scripts/bin/runrofi @@ -0,0 +1,4 @@ +#!/bin/sh +awesome-client 'show_dim()' +rofi -show drun "$@" +awesome-client 'hide_dim()'