Skip to content

Commit

Permalink
Merge branch 'AnotherMontorAttempt' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
LycanDarko666 committed Oct 3, 2023
2 parents 111aaf5 + f018baf commit 8d192e7
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 57 deletions.
49 changes: 0 additions & 49 deletions rabbithole/components/wiboxes/bars/mini-bar.lua.bak

This file was deleted.

12 changes: 12 additions & 0 deletions rabbithole/components/widgets/taglist/init.lua
Expand Up @@ -135,8 +135,20 @@ function TaglistController:create_tag_callback(tag_template, tag, index, objects
tag:connect_signal('property::selected', function()
if tag.selected then
animation.target = 1
-- Highlight the tag on its own screen
for _, screen in ipairs(tag.screen.outputs) do
if screen == self.screen then
tag_template.bg = self.colors.blend_colors(beautiful.bg_normal, beautiful.bg_focus, 1)
end
end
else
animation.target = 0
-- Reset the tag color on its own screen
for _, screen in ipairs(tag.screen.outputs) do
if screen == self.screen then
tag_template.bg = self.colors.blend_colors(beautiful.bg_normal, beautiful.bg_focus, 0)
end
end
end
end)

Expand Down
3 changes: 2 additions & 1 deletion rabbithole/environment.lua
Expand Up @@ -7,7 +7,8 @@ function Environment.new(
rabbithole__ui__default,
rabbithole__services__global,
rabbithole__services__sloppy___focus,
rabbithole__services__auto___focus
rabbithole__services__auto___focus,
rabbithole__services__detect___monitors
)
local self = setmetatable({}, Environment)

Expand Down
63 changes: 63 additions & 0 deletions rabbithole/services/detect-monitors.lua
@@ -0,0 +1,63 @@
--[[ detect-monitors.lua
This is the magical service that listens to udev events for detecting monitors, then
automatically configures them and sstores the configuration on the local machine via autorandr.
If LxQt can do it, Lycan can do it.
]]


local awful = require("awful")
local naughty = require("naughty")
local gears = require("gears")

local DetectMonitor = {}
DetectMonitor.__index = DetectMonitor


function DetectMonitor.new()
return setmetatable({}, DetectMonitor)
end

function DetectMonitor.setup_screens()
awful.spawn.easy_async_with_shell("xrandr -q | grep ' connected'", function(stdout)
local screens = gears.string.split(stdout, "\n")
for _, line in pairs(screens) do
local screen_name = line:match("^(.-) connected")
if screen_name then
-- finds and sets the highest available resolution for the connected screen
local max_res = line:match("%d+x%d+")
awful.spawn.easy_async_with_shell("xrandr --output " .. screen_name .. " --mode " .. max_res, function()
-- save the screen config w/ autorandr
awful.spawn.easy_async_with_shell("autorandr --save " .. screen_name, function()
naughty.notify({ title = "Monitor Configuration", text = "Applied and saved configuration for " .. screen_name })
end)
end)
end
end
end)
end

-- Debouncing timer to prevent multiple calls to setup_screens and multiple notifications
local debounce_timer = nil
local debounce_time = 2 -- in seconds

-- Listen to udev events for monitor changes
awful.spawn.with_line_callback("stdbuf -oL udevadm monitor --property --subsystem-match=drm", {
stdout = function(line)
if line:match("ACTION=change") then
if debounce_timer then
debounce_timer:stop()
debounce_timer = nil
end

debounce_timer = gears.timer.start_new(debounce_time, function()
DetectMonitor.setup_screens()
end)
end
end,
stderr = function(line)
naughty.notify({ title = "Monitor Error", text = line, preset = naughty.config.presets.critical })
end
})

return DetectMonitor
5 changes: 1 addition & 4 deletions rabbithole/services/notificationCenter/baloon.lua
Expand Up @@ -4,19 +4,16 @@ local NotificationBalloon = {}
NotificationBalloon.__index = NotificationBalloon


function NotificationBalloon.new()
function NotificationBalloon.new(NotificationService)
local self = {}

function self.show(notification)
print("Showing notification balloon:", notification)
-- Implement your own logic to display the notification balloon (e.g., using an external library or widget)

-- Simulate clicking on the balloon to open client
self.onClick(notification)
end

function self.onClick(notification)
-- Handle the click event to open the urgent client
NotificationService.openClient(notification)
end

Expand Down
1 change: 0 additions & 1 deletion rabbithole/ui/default/center.lua
@@ -1,5 +1,4 @@
local wibox = require("wibox")
local layoutlist_widget = require("rabbithole.components.widgets.layout_list")

return setmetatable({}, {
__constructor = function(
Expand Down
4 changes: 2 additions & 2 deletions rabbithole/ui/default/init.lua
Expand Up @@ -3,7 +3,6 @@ local beautiful = require("beautiful")
local bling = require("sub.bling")
local dropdown = require("rabbithole.services.dropdown")


local UserInterface = {}
UserInterface.__index = UserInterface

Expand All @@ -16,7 +15,8 @@ function UserInterface.new(
--rabbithole__ui__default__titlebar -- Using nice as titlebars for now, but standard titlebars are still available if desired
)
awful.screen.connect_for_each_screen(function(s)

-- set auto dpi detection for each screen for consistent UserInterface
--s:set_auto_dpi_enabled(true)
workspaceManagerService:assignWorkspaceTagsToScreens()

-- initialize left and right bars for first screen only, and taglist widget for all screens
Expand Down
11 changes: 11 additions & 0 deletions scripts/scrocr.sh
Expand Up @@ -17,4 +17,15 @@ mogrify -modulate 100,0 -resize 400% "$SCR_IMG".png # postprocess to prepare for

tesseract -l "$LANG" "$SCR_IMG".png stdout | xsel -bi

# Send D-Bus message to notify the user
dbus-send --type=method_call --dest=org.freedesktop.Notifications \
/org/freedesktop/Notifications \
org.freedesktop.Notifications.Notify \
string:"ScrOCR" uint32:1 \
string:"" \
string:"OCR Completed" \
string:"Selected area has been converted to text by OCR and dumped to your clipboard." \
array:string:"" \
dict:string:string:"","" int32:5000

exit

0 comments on commit 8d192e7

Please sign in to comment.