File: look_qt.lua

package info (click to toggle)
notion 3%2B2014010901-1
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 4,940 kB
  • ctags: 6,104
  • sloc: ansic: 46,870; sh: 2,008; makefile: 598; perl: 270
file content (189 lines) | stat: -rw-r--r-- 4,501 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
-- Authors: Johan Kiviniemi
-- License: Unknown
-- Last Changed: Unknown
--
-- Look-qtrc 0.1 for the Ion window manager.
-- Based on look-cleanviolet.
--
-- I am using the QtCurve Gtk+ theme; now Qt, Gtk+ and Ion share the same
-- color theme automatically. :-)
--
-- http://www.kde-look.org/content/show.php?content=5065
--
-- Johan "Ion" Kiviniemi

local xft = false
local basefont
local tabfont
local menufont
--if gr.select_engine("xftde") then
if false then
    xft = true
    basefont = "xft:Bitstream Vera Sans:size=9:weight=bold"
    tabfont = "xft:Bitstream Vera Sans:size=8:weight=bold"
    menufont = "xft:Bitstream Vera Sans:size=10:weight=bold"
elseif gr.select_engine("de") then
    xft = false
    basefont = "-*-bitstream vera sans-bold-r-normal-*-9-*-*-*-*-*-*-*"
    font = "-*-bitstream vera sans-bold-r-normal-*-8-*-*-*-*-*-*-*"
    menufont = "-*-bitstream vera sans-bold-r-normal-*-10-*-*-*-*-*-*-*"
else
    return
end

local qtrcfile = os.getenv("HOME").."/.qt/qtrc"

local palette = {}
-- palette[1] = active, palette[2] = inactive, palette[3] = disabled
for i = 1, 3 do
    palette[i] = {}
    for j = 1, 16 do
        palette[i][j] = "#000000"
    end
end

local inpalette = false
local paletteid = 0
for line in io.lines(qtrcfile) do
    if string.find(line, "^%[") then inpalette = false end
    if string.find(line, "^%[Palette%]") then inpalette = true end
    if inpalette then
        if string.find(line, "^active=") then paletteid = 1
        elseif string.find(line, "^inactive=") then paletteid = 2
        elseif string.find(line, "^disabled=") then paletteid = 3
        else paletteid = 0
        end

        if paletteid > 0 then
            local i = 1
            for v in string.gfind(line, "(#[0-9a-fA-F]+)") do
                palette[paletteid][i] = v
                i = i+1
            end
        end
    end
end

-- Clear existing styles from memory.
de.reset()

-- Base style
de.defstyle("*", {
    highlight_colour = palette[1][4],
    shadow_colour = palette[1][5],
    background_colour = palette[1][2],
    foreground_colour = palette[1][1],

    shadow_pixels = 1,
    highlight_pixels = 1,
    padding_pixels = 1,
    spacing = 0,
    border_style = "elevated",

    font = basefont,
    text_align = "left",
})


de.defstyle("frame", {
    based_on = "*",
    padding_colour = palette[1][2],
    background_colour = palette[1][1],
    transparent_background = false,
})


de.defstyle("frame-ionframe", {
    based_on = "frame",
    shadow_pixels = 0,
    highlight_pixels = 0,
    padding_pixels = 0,
    spacing = 1,
})


de.defstyle("tab", {
    based_on = "*",
    font = tabfont,

    de.substyle("active-selected", {
        highlight_colour = palette[1][13],
        shadow_colour = palette[1][13],
        background_colour = palette[1][13],
        foreground_colour = palette[1][14],
    }),

    de.substyle("inactive-selected", {
        highlight_colour = palette[1][4],
        shadow_colour = palette[1][5],
        background_colour = palette[1][2],
        foreground_colour = palette[1][1],
    }),
})


de.defstyle("tab-frame", {
    based_on = "tab",

    de.substyle("*-*-*-*-activity", {
        -- Red tab
        highlight_colour = "#ffffff",
        shadow_colour = "#ffffff",
        background_colour = "#990000",
        foreground_colour = "#ffffff",
    }),
})


de.defstyle("tab-frame-ionframe", {
    based_on = "tab-frame",
    spacing = 1,
    bar_inside_frame = true,
})


de.defstyle("tab-menuentry", {
    based_on = "tab",
    text_align = "left",
    spacing = 1,
})

de.defstyle("tab-menuentry-pmenu", {
    based_on = "tab-menuentry",
    de.substyle("inactive-selected", {
        highlight_colour = palette[1][13],
        shadow_colour = palette[1][13],
        background_colour = palette[1][13],
        foreground_colour = palette[1][14],
    }),
})

de.defstyle("tab-menuentry-big", {
    based_on = "tab-menuentry",
    font = menufont,
    padding_pixels = 5,
})


de.defstyle("input", {
    based_on = "*",
    text_align = "left",
    spacing = 1,
    highlight_colour = palette[1][4],
    shadow_colour = palette[1][5],
    background_colour = palette[1][2],
    foreground_colour = palette[1][1],

    de.substyle("*-selection", {
        background_colour = "#0000ff",
        foreground_colour = "#00ff00",
    }),

    de.substyle("*-cursor", {
        background_colour = palette[1][1],
        foreground_colour = palette[1][2],
    }),
})

-- Refresh objects' brushes.
gr.refresh()