diff --git a/Makefile b/Makefile index 583c274..28d9d58 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,7 @@ test: build .PHONY: deploy deploy: build - @echo Backing old config up - rm -f backup.tar - tar -cvf backup.tar -C ~/.config awesome - rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --exclude '*' ./ ~/.config/awesome/ + rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' --exclude '*' ./ ~/.config/awesome/ .PHONY: build build: diff --git a/awesome.code-workspace b/awesome.code-workspace index e0c69cc..ea8dc7f 100644 --- a/awesome.code-workspace +++ b/awesome.code-workspace @@ -20,6 +20,11 @@ ], "Lua.workspace.library": [ "/usr/share/awesome/lib" + ], + "makefile.configureOnOpen": true, + "Lua.workspace.ignoreDir": [ + ".vscode", + "/home/mutzi/.config/awesome" ] } } \ No newline at end of file diff --git a/lib/pwcall.cxx b/lib/pwcall.cxx index 01feaba..72a2627 100644 --- a/lib/pwcall.cxx +++ b/lib/pwcall.cxx @@ -1,3 +1,4 @@ +#include #define SOL_ALL_SAFETIES_ON 1 #include #include @@ -21,21 +22,25 @@ static std::tuple get_volume(gpointer api, guint32 id) { GVariant *variant = nullptr; g_signal_emit(api, get_volume_sig, 0, id, &variant); - gdouble volumed; - gboolean mute; - g_variant_lookup(variant, "volume", "d", &volumed); - g_variant_lookup(variant, "mute", "b", &mute); - if (variant) g_variant_unref(variant); + gdouble volumed = 0.5; + gboolean mute = false; + if (variant) { + g_variant_lookup(variant, "volume", "d", &volumed); + g_variant_lookup(variant, "mute", "b", &mute); + g_variant_unref(variant); + } return std::tuple(std::round(volumed * 100.0), mute == 1); } -static void set_volume(gpointer api, guint32 id, guint voli, bool mute) { +static void set_volume(gpointer api, guint32 id, int vol, bool mute) { if (set_volume_sig == 0) set_volume_sig = g_signal_lookup("set-volume", G_TYPE_FROM_INSTANCE(api)); + vol = std::clamp(vol, 0, 150); + g_auto(GVariantBuilder) b = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE_VARDICT); - g_variant_builder_add(&b, "{sv}", "volume", g_variant_new_double(((gdouble)voli)/100)); + g_variant_builder_add(&b, "{sv}", "volume", g_variant_new_double(((gdouble)vol)/100)); g_variant_builder_add(&b, "{sv}", "mute", g_variant_new_boolean(mute ? TRUE : FALSE)); GVariant *variant = g_variant_builder_end(&b); diff --git a/rc.lua b/rc.lua index 9d2c108..daaffbd 100644 --- a/rc.lua +++ b/rc.lua @@ -47,3 +47,4 @@ end) local on_screen_connect = require('src.theme.wibar') require('awful').screen.connect_for_each_screen(function(s) on_screen_connect(s) end) +require('awful').spawn.with_shell('xset s 0 0; xset dpms 0 0 0') diff --git a/rofi/kaomoji.sh b/rofi/kaomoji.sh index ad1b488..2e23431 100755 --- a/rofi/kaomoji.sh +++ b/rofi/kaomoji.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash current_wid=$(xdo id) -selection=$(rofi -i -dmenu -theme-str 'listview{columns: 6; lines: 11;}' -theme-str 'window {fullscreen: true;}' $@ < $(dirname $0)/kaomoji.txt) +selection=$(rofi -i -dmenu -theme-str 'listview{columns: 6; lines: 11;}' -theme-str 'window {fullscreen: true;}' $@ < $(dirname $0)/kaomoji_data.sh) kaomoji=$(echo $selection | sed "s|$(echo -e "\ufeff").*||") echo -n "$kaomoji" | xclip -selection clipboard diff --git a/rofi/kaomoji.txt b/rofi/kaomoji_data.sh similarity index 100% rename from rofi/kaomoji.txt rename to rofi/kaomoji_data.sh diff --git a/rofi/launcher_launcher.sh b/rofi/launcher_launcher.sh index 30a0666..5d7b10d 100755 --- a/rofi/launcher_launcher.sh +++ b/rofi/launcher_launcher.sh @@ -4,41 +4,48 @@ power="Power menu" ssh="SSH Connect" window="Window switcher" +drun_actions="DRun with actions" kaomoji="Kaomoji" # Rofi CMD rofi_cmd() { - rofi -dmenu \ - -window-title "Launcher" \ - -i \ - -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \ + rofi -dmenu \ + -window-title "Launcher" \ + -i \ + -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \ -theme-str 'listview {columns: 1;}' } # Pass variables to rofi dmenu run_rofi() { - echo -e "$power\n$ssh\n$window\n$kaomoji" | rofi_cmd + echo -e "$power\n$ssh\n$window\n$drun_actions\n$kaomoji" | rofi_cmd } # Actions chosen="$(run_rofi)" case ${chosen} in $power) - $HOME/.config/awesome/rofi/powermenu.sh + $HOME/.config/awesome/rofi/powermenu.sh ;; $ssh) - rofi \ - -show ssh \ - -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi + rofi \ + -show ssh \ + -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi ;; $window) - rofi \ - -show window \ - -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \ - -theme-str 'listview {columns: 1; lines: 10;}' + rofi \ + -show window \ + -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi \ + -theme-str 'listview {columns: 1; lines: 10;}' + ;; + $drun_actions) + rofi \ + -show drun \ + -theme $HOME/.config/awesome/rofi/launcher.rasi \ + -drun-show-actions ;; $kaomoji) - $HOME/.config/awesome/rofi/kaomoji.sh \ - -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi + $HOME/.config/awesome/rofi/kaomoji.sh \ + -theme $HOME/.config/awesome/rofi/launcher_launcher.rasi ;; esac diff --git a/settings.lua b/settings.lua index 598d3d4..604a226 100644 --- a/settings.lua +++ b/settings.lua @@ -1,6 +1,6 @@ return { wallpaper = 'wall2.png', + systray_screen = 1, - --show_battery = false, - --show_volume = true + show_battery = false } diff --git a/src/client/client_keys.lua b/src/client/client_keys.lua index a9529a0..a94d97a 100644 --- a/src/client/client_keys.lua +++ b/src/client/client_keys.lua @@ -23,7 +23,8 @@ local keys = gears.table.join( local buttons = gears.table.join( awful.button({}, 1, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) end), awful.button({ modkey }, 1, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) awful.mouse.client.move(c) end), - awful.button({ modkey }, 3, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) awful.mouse.client.resize(c) end) + awful.button({ modkey }, 3, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) awful.mouse.client.resize(c) end), + awful.button({ modkey }, 2, function(c) c:kill() end) ) diff --git a/src/client/init.lua b/src/client/init.lua index 5a56db8..df470f7 100644 --- a/src/client/init.lua +++ b/src/client/init.lua @@ -49,3 +49,9 @@ end) client.connect_signal('mouse::enter', function(c) c:emit_signal('request::activate', 'mouse_enter', { raise = false }) end) client.connect_signal('focus', function(c) c.border_color = beautiful.border_focus end) client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end) + +client.connect_signal("property::minimized", function(c) + if c.no_minimize then + c.minimized = false + end +end) diff --git a/src/client/rules.lua b/src/client/rules.lua index 55a0ed2..bfcc17c 100644 --- a/src/client/rules.lua +++ b/src/client/rules.lua @@ -18,8 +18,10 @@ rules.append_rules({ placement = awful.placement.no_overlap + awful.placement.no_offscreen, size_hints_honor = false, no_border = false, - titlebars_enabled = false - } + titlebars_enabled = false, + no_minimize = false, + }, + --callback = function(c) print('name ', c.name, ' class ', c.class) end }, { rule_any = { class = { 'Tor Browser' }, @@ -32,10 +34,10 @@ rules.append_rules({ }, properties = { floating = true } }, { - rule_any = { class = { 'firefox', 'factorio', 'Blender' } }, + rule_any = { class = { 'firefox', 'factorio', 'Blender', 'Godot' } }, properties = { opacity = 1, maximized = false, floating = false }, }, { - rule = { class = 'mpv' }, + rule_any = { class = { 'mpv', 'jellyfinmediaplayer' } }, properties = { fullscreen = true }, }, { rule = { class = 'supcom-fa' }, @@ -47,5 +49,7 @@ rules.append_rules({ no_border = true, } }, + { rule = { class = { 'krusader' } }, properties = { ontop = true } }, { rule_any = { type = { 'normal', 'dialog' } }, properties = { titlebars_enabled = true } }, + --{ rule_any = { name = { 'Counter-Strike 2' }, class = { 'cs2' } }, properties = { no_minimize = true } }, }) diff --git a/src/global_keys.lua b/src/global_keys.lua index ca96529..5727a31 100644 --- a/src/global_keys.lua +++ b/src/global_keys.lua @@ -15,7 +15,7 @@ local quake = lain.util.quake({ followtag = true, overlap = true, - app = globals.terminal, + app = 'alacritty', argname = '-t ' .. quake_terminal_name, name = quake_terminal_name, extra = '--class ' .. quake_terminal_name, diff --git a/src/globals.lua b/src/globals.lua index f4aaaa9..cc6bcb8 100644 --- a/src/globals.lua +++ b/src/globals.lua @@ -1,7 +1,7 @@ return { modkey = 'Mod4', altkey = 'Mod1', - terminal = 'alacritty', + terminal = 'st', cycle_prev = true, - editor = 'nvim', + editor = 'nvim' } diff --git a/src/theme/init.lua b/src/theme/init.lua index 0161556..dd7818c 100644 --- a/src/theme/init.lua +++ b/src/theme/init.lua @@ -3,6 +3,11 @@ local naughty = require('naughty') local confdir = require('src.util.path').conf_dir +---@class Settings +---@field wallpaper? string +---@field systray_screen? integer +---@field show_battery? boolean +---@return Settings local function load_settings() local status, settings = pcall(function() return dofile(confdir .. '/settings.lua') @@ -23,7 +28,7 @@ local settings = load_settings() return { confdir = confdir, - wallpaper = confdir .. '/wallpapers/' .. (settings['wallpaper'] or 'wall.png'), + wallpaper = confdir .. '/wallpapers/' .. (settings.wallpaper or 'wall.png'), font = 'Terminus 8', font_mono = 'Mononoki Nerd Font Mono 10', bg_normal = '#000000', @@ -102,5 +107,6 @@ return { tasklist_bg_minimize = '#4d4d4d', tasklist_plain_task_name = true, tasklist_disable_icon = true, - systray_screen = settings.systray_screen or 1 + systray_screen = settings.systray_screen or 1, + show_battery = settings.show_battery or false } diff --git a/src/util/volume.lua b/src/util/volume.lua index ceeed5c..d50d050 100644 --- a/src/util/volume.lua +++ b/src/util/volume.lua @@ -36,8 +36,11 @@ if _G.volume_control == nil then } function volume_control:get_default_node() self.node_id = volume_control.pw_call.default_node(self.node_api._native) end + ---@param vol number + ---@param m boolean function volume_control:set_volume(vol, m) volume_control.pw_call.set_volume(self.mixer_api._native, self.node_id, vol, m) end function volume_control:toggle_mute() self:set_volume(self.volume, not self.mute) end + ---@param d number function volume_control:volume_delta(d) self:set_volume(self.volume + d, self.mute) end function volume_control:get_volume() self.volume, self.mute = volume_control.pw_call.get_volume(self.mixer_api._native, self.node_id) @@ -98,4 +101,6 @@ return { toggle_mute = function() _G.volume_control:toggle_mute() end, vol_up = function() _G.volume_control:volume_delta(1) end, vol_down = function() _G.volume_control:volume_delta(-1) end, + ---@param delta number + vol_delta = function (delta) _G.volume_control:volume_delta(delta) end } diff --git a/src/widgets/5_vol.lua b/src/widgets/5_vol.lua index 3fe8af7..7749f97 100644 --- a/src/widgets/5_vol.lua +++ b/src/widgets/5_vol.lua @@ -22,7 +22,9 @@ end) local volumebuttons = awful.util.table.join( awful.button({}, 1, volume.toggle_mute), awful.button({}, 4, volume.vol_up), - awful.button({}, 5, volume.vol_down) + awful.button({}, 5, volume.vol_down), + awful.button({ 'Shift' }, 4, function() volume.vol_delta(5) end), + awful.button({ 'Shift' }, 5, function() volume.vol_delta(-5) end) ) volume_widget:buttons(volumebuttons) diff --git a/src/widgets/7_battery.lua b/src/widgets/7_battery.lua new file mode 100644 index 0000000..fdaa661 --- /dev/null +++ b/src/widgets/7_battery.lua @@ -0,0 +1,32 @@ +local theme = require('src.theme') +local lain = require('lain') +local wibox = require('wibox') + +local baticon = wibox.widget.imagebox(nil) +local bat = lain.widget.bat({ + settings = function() + -- luacheck: globals widget bat_now + if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then + baticon:set_image(theme.widget_bat_charge) + elseif bat_now.perc < 5 then + baticon:set_image(theme.widget_bat_empty) + elseif bat_now.perc < 15 then + baticon:set_image(theme.widget_bat_low) + elseif bat_now.perc < 50 then + baticon:set_image(theme.widget_bat_mid) + elseif bat_now.perc < 95 then + baticon:set_image(theme.widget_bat_high) + else + baticon:set_image(theme.widget_bat_full) + end + local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc + + if bat_now.ac_status == 1 then + perc = perc .. ' plug' + end + + widget:set_text(perc) + end +}) + +return { wibox.layout.fixed.horizontal(baticon, bat.widget) } diff --git a/src/widgets/7_mpris.lua b/src/widgets/8_mpris.lua similarity index 98% rename from src/widgets/7_mpris.lua rename to src/widgets/8_mpris.lua index 1d8692f..1bfbff8 100644 --- a/src/widgets/7_mpris.lua +++ b/src/widgets/8_mpris.lua @@ -43,6 +43,12 @@ local function signal_cbk(_conn, _sender, _object_path, _interface_name, _signal local data = variant_strip(params) if type(data) ~= 'table' or type(data[2]) ~= 'table' then return end data = data[2] + if data['Metadata'] then + data = data['Metadata'] + local title = data['xesam:title'] or '' + local artist = (data['xesam:artist'] or {})[1] or '' + mpris_widget.text = artist .. ' -> ' .. title + end if data['PlaybackStatus'] then if data['PlaybackStatus'] == 'Playing' then mpris_icon:set_image(theme.widget_play) @@ -52,11 +58,6 @@ local function signal_cbk(_conn, _sender, _object_path, _interface_name, _signal mpris_icon:set_image(theme.widget_stop) mpris_widget.text = 'Nothing playing' end - elseif data['Metadata'] then - data = data['Metadata'] - local title = data['xesam:title'] or '' - local artist = (data['xesam:artist'] or {})[1] or '' - mpris_widget.text = artist .. ' -> ' .. title end end diff --git a/src/widgets/init.lua b/src/widgets/init.lua index 23b6f24..e70fce9 100644 --- a/src/widgets/init.lua +++ b/src/widgets/init.lua @@ -1,4 +1,5 @@ local gears = require('gears') +local theme = require('src.theme') return gears.table.join( require('src.widgets.1_clock'), @@ -7,5 +8,6 @@ return gears.table.join( require('src.widgets.4_mem'), require('src.widgets.5_vol'), require('src.widgets.6_net'), - require('src.widgets.7_mpris') -) \ No newline at end of file + theme.show_battery and require('src.widgets.7_battery') or {}, + require('src.widgets.8_mpris') +) diff --git a/wallpapers/1626543115985_v1.jpg b/wallpapers/1626543115985_v1.jpg new file mode 100644 index 0000000..2505e0d Binary files /dev/null and b/wallpapers/1626543115985_v1.jpg differ diff --git a/wallpapers/1710892828042072.jpg b/wallpapers/1710892828042072.jpg new file mode 100644 index 0000000..684ea89 Binary files /dev/null and b/wallpapers/1710892828042072.jpg differ diff --git a/wallpapers/wall7.png b/wallpapers/wall7.png new file mode 100644 index 0000000..19b26da Binary files /dev/null and b/wallpapers/wall7.png differ diff --git a/wallpapers/wall8.png b/wallpapers/wall8.png new file mode 100644 index 0000000..f606ad0 Binary files /dev/null and b/wallpapers/wall8.png differ