fixed rules with single screen

This commit is contained in:
Roland Schneider 2021-08-03 08:09:31 +02:00
parent 33f8e11557
commit f1e8c2b9e8
2 changed files with 95 additions and 27 deletions

View File

@ -14,11 +14,13 @@ run /usr/bin/nm-applet
run /usr/bin/blueman-manager run /usr/bin/blueman-manager
# screenshot utility # screenshot utility
run /usr/bin/shutter run /usr/bin/shutter
# volume control
run /usr/bin/pasystray
# tag 1 # tag 1
run /usr/local/bin/idea run idea
# tag 2 # tag 2
run /opt/google/chrome/chrome run /opt/google/chrome/chrome
# tag 3 # tag 3
run /usr/bin/terminator run /usr/bin/terminator
# tag 4 # tag 4
@ -26,9 +28,9 @@ run /usr/bin/code
# tag 5 # tag 5
run /usr/bin/zoom run /usr/bin/zoom
run /usr/bin/teams run /usr/bin/teams
# tag 6 tag 6
run /usr/bin/rocketchat-desktop run /snap/bin/rocketchat-desktop
run /usr/bin/thunderbird run /usr/bin/thunderbird
# tag 7 # tag 7
run /usr/local/bin/bitwarden run /usr/local/bin/bitwarden
run /usr/bin/keepass2 run /usr/bin/keepassx

110
rc.lua
View File

@ -35,6 +35,43 @@ local tags = {
tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9 tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9
} }
local wibar_font="Deja Vu Sans Mono 14"
-- d_sep = wibox.widget.textbox(" | ")
d_sep = wibox.widget{
markup = '|',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox,
font = wibar_font
}
l_sep = wibox.widget{
markup = '[',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox,
font = wibar_font
}
m_sep = wibox.widget{
markup = '][',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox,
font = wibar_font
}
r_sep = wibox.widget{
markup = ']',
align = 'center',
valign = 'center',
widget = wibox.widget.textbox,
font = wibar_font
}
-- {{{ Error handling -- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) -- another config (This code will only ever execute for the fallback config)
@ -63,7 +100,10 @@ end
-- {{{ Variable definitions -- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers. -- Themes define colours, icons, font and wallpapers.
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
beautiful.font = "DejaVu Sans 12" beautiful.font = wibar_font
beautiful.wibar_bg="#6C3483cc"
beautiful.bg_systray="#6C3483cc"
-- This is used later as the default terminal and editor to run. -- This is used later as the default terminal and editor to run.
terminal = "x-terminal-emulator" terminal = "x-terminal-emulator"
@ -157,7 +197,7 @@ mykeyboardlayout = awful.widget.keyboardlayout()
-- mytextclock = wibox.widget.textclock() -- mytextclock = wibox.widget.textclock()
mytextclock = wibox.widget.textclock("%Y-%m-%d, %a, %H:%M:%S",1) mytextclock = wibox.widget.textclock("%Y-%m-%d, %a, %H:%M:%S",1)
mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC" } mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC", widget_font = wibar_font }
-- Create a wibox for each screen and add it -- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join( local taglist_buttons = gears.table.join(
@ -249,7 +289,7 @@ end
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
-- Create the wibox -- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s }) s.mywibox = awful.wibar({ position = "top", screen = s, height = 34 })
-- Add widgets to the wibox -- Add widgets to the wibox
s.mywibox:setup { s.mywibox:setup {
@ -264,9 +304,14 @@ end
{ -- Right widgets { -- Right widgets
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
mykeyboardlayout, mykeyboardlayout,
d_sep,
wibox.widget.systray(), wibox.widget.systray(),
d_sep,
mytextclock, mytextclock,
l_sep,
mybatterywidget, mybatterywidget,
r_sep,
d_sep,
s.mylayoutbox, s.mylayoutbox,
}, },
} }
@ -549,6 +594,25 @@ clientbuttons = gears.table.join(
root.keys(globalkeys) root.keys(globalkeys)
-- }}} -- }}}
local function getScreenByTagName(tagName)
print("getScreenByTagName 1:" .. tagName)
local tagByName = awful.tag.find_by_name(nil, tagName)
print("getScreenByTagName 2:" .. tostring(tagByName) )
local screenOfTag = tagByName.screen
print("getScreenByTagName 3:" .. tostring(screenOfTag) )
if screenOfTag then
local indexOfScreen = screenOfTag.index
print( "tag " .. tostring(tagName) .. " is on screen " .. tostring(indexOfScreen))
return indexOfScreen
end
return awful.screen.focused().index
end
local function getTagByName(tagName)
return awful.tag.find_by_name(nil, tagName)
end
-- {{{ Rules -- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal). -- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = { awful.rules.rules = {
@ -596,35 +660,37 @@ awful.rules.rules = {
}, properties = { titlebars_enabled = true } }, properties = { titlebars_enabled = true }
}, },
-- jetbrains-idea -> tag 1 -- jetbrains-idea -> tag 1
{ rule = { class = "jetbrains-idea" }, { rule = { instance = "jetbrains-idea" },
properties = { tag = tag1 } }, properties = { screen = function () return getScreenByTagName(tag1) end, tag = tag1 } },
-- chrome -> tag 2 -- chrome -> tag 2
{ rule = { class = "google-chrome" }, { rule = { instance = "google-chrome" },
properties = { tag = tag2 } }, properties = { sreen = function () return getScreenByTagName(tag2) end, tag = tag2 } },
-- terminator-> tag 3 -- terminator-> tag 3
{ rule = { class = "terminator" }, { rule = { instance = "terminator" },
properties = { tag = tag3 } }, properties = { screen = function () return getScreenByTagName(tag3) end, tag = tag3 } },
{ rule = { instance = "x-terminal-emulator" },
properties = { function () return getScreenByTagName(tag7) end, tag = tag3 } },
-- vscode -> tag 4 -- vscode -> tag 4
{ rule = { class = "code" }, { rule = { instance = "code" },
properties = { tag = tag4 } }, properties = { screen = function () return getScreenByTagName(tag4) end, tag = tag4 } },
-- zoom -> tag5 -- zoom -> tag5
{ rule = { class = "zoom" }, { rule = { instance = "zoom" },
properties = { tag = tag5 } }, properties = { screen = function () return getScreenByTagName(tag5) end, tag = tag5 } },
-- microsoft teams - preview -> tag5 -- microsoft teams - preview -> tag5
{ rule = { class = "microsoft teams - preview" }, { rule = { instance = "microsoft teams - preview" },
properties = { tag = tag5 } }, properties = { screen = function () return getScreenByTagName(tag5) end, tag = tag5 } },
-- rocket.chat-> tag6 -- rocket.chat-> tag6
{ rule = { class = "rocket.chat" }, { rule = { instance = "rocket.chat" },
properties = { tag = tag6 } }, properties = { screen = function () return getScreenByTagName(tag6) end, tag = tag6 } },
-- Thunderbird -> tag6 -- Thunderbird -> tag6
{ rule = { class = "Thunderbird" }, { rule = { class = "Thunderbird" },
properties = { tag = tag6 } }, properties = { screen = function () return getScreenByTagName(tag6) end, tag = tag6 } },
-- Bitwarden -> tag7 -- Bitwarden -> tag7
{ rule = { class = "bitwarden" }, { rule = { instance = "bitwarden" },
properties = { tag = tag7 } }, properties = { screen = function () return getScreenByTagName(tag7) end, tag = tag7 } },
-- keepass2 -> tag7 -- keepass2 -> tag7
{ rule = { class = "keepass2" }, { rule = { instance = "keepassx" },
properties = { tag = tag7 } }, properties = { screen = function () return getScreenByTagName(tag7) end, tag = tag7 } },
-- Set Firefox to always map on the tag named "2" on screen 1. -- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" }, -- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } }, -- properties = { screen = 1, tag = "2" } },