<commit_before>local gears = require("gears")
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")

local spacers = require("splitwidgets.spacers")
local clock = require("splitwidgets.clock")
local bat_widget = nil
if hostname == "doubleslap" then
     bat_widget = require("splitwidgets.battery")
end
local vol_widget = require("splitwidgets.volume")
local temp_widget = require("splitwidgets.temperature")(
    hostname == "cometpunch" and "thermal_zone2" or "thermal_zone0"
)
local fcitx_widget = require("splitwidgets.fcitx")
local taglist = require("splitwidgets.taglist")
local tasklist = require("splitwidgets.tasklist")

local menu = require("menu")

local function set_wallpaper(s)
    -- Wallpaper
    if beautiful.wallpaper then
        local wallpaper = beautiful.wallpaper
        -- If wallpaper is a function, call it with the screen
        if type(wallpaper) == "function" then
            wallpaper = wallpaper(s)
        end
        gears.wallpaper.maximized(wallpaper, s, true)
    end
end

-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)

local mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                     menu = menu })

-- build right widget table
-- we only want most of these on 1 screen
local function create_right_widgets(screen)
    local right_widgets
    if screen.position == "right" then
        -- for whatever reason the systray has to be told what screen to display on?
        local systray = wibox.widget.systray()
        systray:set_screen(screen)

        right_widgets = {
            layout = wibox.layout.fixed.horizontal,
            spacers.pad_widget,
            systray,
            spacers.div_widget,
            fcitx_widget
        }
        if bat_widget ~= nil then
            gears.table.merge(right_widgets, {
                spacers.div_widget,
                bat_widget
            })
        end
        gears.table.merge(right_widgets, {
            spacers.div_widget,
            temp_widget,
            spacers.div_widget,
            vol_widget,
            spacers.div_widget,
            clock(screen),
            spacers.pad_widget,
            screen.mylayoutbox,
        })
    else
        right_widgets = {
            layout = wibox.layout.fixed.horizontal,
            screen.mylayoutbox,
        }
    end
    return right_widgets
end

awful.screen.connect_for_each_screen(function(s)
    -- shitty hack to determine screen position. should really be somewhere else,
    local next_screen_to_right = s:get_next_in_direction("right")
    if next_screen_to_right then
        s.position = "left"
    else
        s.position = "right"
    end

    -- Wallpaper
    set_wallpaper(s)

    -- Create a promptbox for each screen
    s.mypromptbox = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    s.mylayoutbox = awful.widget.layoutbox(s)
    s.mylayoutbox:buttons(gears.table.join(
        awful.button({ }, 1, function () awful.layout.inc( 1) end),
        awful.button({ }, 3, function () awful.layout.inc(-1) end),
        awful.button({ }, 4, function () awful.layout.inc( 1) end),
        awful.button({ }, 5, function () awful.layout.inc(-1) end)
    ))

    -- Create the ribox
    s.mywibox = awful.wibar({ position = "top", screen = s, height = 20 }) --, bg = beautiful.bg_minimize })<commit_msg>awesomewm: put widgets i only want 1 copy of on the primary, not rightmost, screen<commit_after>local gears = require("gears")
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")

local spacers = require("splitwidgets.spacers")
local clock = require("splitwidgets.clock")
local bat_widget = nil
if hostname == "doubleslap" then
     bat_widget = require("splitwidgets.battery")
end
local vol_widget = require("splitwidgets.volume")
local temp_widget = require("splitwidgets.temperature")(
    hostname == "cometpunch" and "thermal_zone2" or "thermal_zone0"
)
local fcitx_widget = require("splitwidgets.fcitx")
local taglist = require("splitwidgets.taglist")
local tasklist = require("splitwidgets.tasklist")

local menu = require("menu")

local function set_wallpaper(s)
    -- Wallpaper
    if beautiful.wallpaper then
        local wallpaper = beautiful.wallpaper
        -- If wallpaper is a function, call it with the screen
        if type(wallpaper) == "function" then
            wallpaper = wallpaper(s)
        end
        gears.wallpaper.maximized(wallpaper, s, true)
    end
end

-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)

local mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                     menu = menu })

-- build right widget table
-- we only want most of these on the primary screen
local function create_right_widgets(s)
    local right_widgets
    if s == screen.primary then
        -- for whatever reason the systray has to be told what screen to display on?
        local systray = wibox.widget.systray()
        systray:set_screen(s)

        right_widgets = {
            layout = wibox.layout.fixed.horizontal,
            spacers.pad_widget,
            systray,
            spacers.div_widget,
            fcitx_widget
        }
        if bat_widget ~= nil then
            gears.table.merge(right_widgets, {
                spacers.div_widget,
                bat_widget
            })
        end
        gears.table.merge(right_widgets, {
            spacers.div_widget,
            temp_widget,
            spacers.div_widget,
            vol_widget,
            spacers.div_widget,
            clock(s),
            spacers.pad_widget,
            s.mylayoutbox,
        })
    else
        right_widgets = {
            layout = wibox.layout.fixed.horizontal,
            s.mylayoutbox,
        }
    end
    return right_widgets
end

awful.screen.connect_for_each_screen(function(s)
    -- shitty hack to determine screen position. should really be somewhere else,
    local next_screen_to_right = s:get_next_in_direction("right")
    if next_screen_to_right then
        s.position = "left"
    else
        s.position = "right"
    end

    -- Wallpaper
    set_wallpaper(s)

    -- Create a promptbox for each screen
    s.mypromptbox = awful.widget.prompt()
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    s.mylayoutbox = awful.widget.layoutbox(s)
    s.mylayoutbox:buttons(gears.table.join(
        awful.button({ }, 1, function () awful.layout.inc( 1) end),
        awful.button({ }, 3, function () awful.layout.inc(-1) end),
        awful.button({ }, 4, function () awful.layout.inc( 1) end),
        awful.button({ }, 5, function () awful.layout.inc(-1) end)
    ))

    -- Create the ribox
    s.mywibox = awful.wibar({ position = "top", screen = s, height = 20 }) --, bg = beautiful.bg_minimize })
{'fraction_non_alphanumeric': 0.09923664122137404, 'fraction_numerical': 0.0036086051353226927, 'mean_word_length': 2.515121951219512, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6394366', 'n_tokens_mistral': 2171, 'n_tokens_neox': 2106, 'n_words': 551}