This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Mini Car Test | |
--@author Name | |
--@server | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
------------------------------------------- | |
local custom_forces = true -- Set this to `true` to workaround a physics jitter bug | |
local size = Vector(32, 20, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local gui = require "gui" | |
local bind = require "bind" | |
local agent = require "agent" | |
local theme = require "theme" | |
local awful = require "awful" | |
------------------------------------------- | |
local tooltip = awful.tooltip({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Replace `alsa_output.pci-0000_2d_00.4.analog-stereo` with your device name (`pactl list sinks short`) | |
-- Script location: $XDG_CONFIG_HOME/wireplumber/main.lua.d/60-disable-speaker-suspend.lua | |
local rule = { | |
matches = { | |
{ | |
{ "node.name", "equals", "alsa_output.pci-0000_2d_00.4.analog-stereo" }, | |
} | |
}, | |
apply_properties = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Focus different client | |
-- The input is passed to the client before switching focus *(just like in `unfocus_client.lua)* | |
client.connect_signal("request::default_mousebindings", function() | |
awful.mouse.append_client_mousebindings { | |
awful.button({ "Mod4" }, 4, function(c) | |
for _, other in ipairs(client.get()) do | |
if other ~= c then | |
client.focus = other | |
break | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Generic | |
--@author Name | |
local track_seats = {} | |
local track_drivers = {} | |
local empty_func = function(...) end | |
------------------------------------------- | |
local Pod = class("Pod") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Solution #1: Add `set_value_direct` only for the specified slider instance | |
local slider = wibox.widget.slider() -- ...or any other valid way to create the slider object | |
function slider:set_value_direct(value) | |
value = math.min(math.max(value, self:get_minimum()), self:get_maximum()) | |
if value ~= self._private.value then | |
self._private.value = value | |
self:emit_signal("property::value", value, true) -- Pass an additional `true` value to the callback | |
self:emit_signal("widget::redraw_needed") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if SERVER then | |
local function spawn_ent(pos) | |
local ent = ents.Create("prop_physics") | |
ent:SetModel("models/hunter/blocks/cube05x05x05.mdl") | |
ent:SetPos(pos) | |
ent:Spawn() | |
-- Make use of the `PhysicsCollide` callback to know when entity collides | |
ent:AddCallback("PhysicsCollide", function(self, data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Link Chair via Wire Example | |
--@author Name | |
--@server | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
-- Just a simple function that will set a "random" color to the provided entity | |
local function set_random_color(ent) | |
local color = Color(math.random(0, 360), 1, 1):hsvToRGB() | |
ent:setColor(color) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Find Closest Chair in Area Example | |
--@author Name | |
--@server | |
local owner, client, chip, world = owner(), player(), chip(), entity(0) | |
local origin = chip:getPos() -- Origin of the search | |
local distance = 200^2 -- Maximum distance of the chair (still 200, but square it so it's faster to compare later on) | |
-- Find all chairs and disregard those that are not owned by us or are farther than the specified distance |
NewerOlder