summaryrefslogtreecommitdiffstats
path: root/swaylock
diff options
context:
space:
mode:
authorLibravatar crondog <crondog@gmail.com>2016-01-28 11:41:57 +1100
committerLibravatar crondog <crondog@gmail.com>2016-01-28 13:44:18 +1100
commit73ec01d8541a6a05ff253e2b1934d53932e26508 (patch)
tree9d16008b138e8e826f2f1e9e6886d9914dffcaea /swaylock
parentMerge pull request #479 from crondog/font (diff)
downloadsway-73ec01d8541a6a05ff253e2b1934d53932e26508.tar.gz
sway-73ec01d8541a6a05ff253e2b1934d53932e26508.tar.zst
sway-73ec01d8541a6a05ff253e2b1934d53932e26508.zip
swaylock: Allow for transparent color values
There is only a slight issue. When using a transparent color the views are arranged to make room for swaylock which we can now see. I tried removing the arrange call but that just made it worse by putting in an opaque view on the workspace and not making the lockoverlay color. Ill raise an issue if this is not easily solved
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/main.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 020ff036..9b14086d 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -211,12 +211,12 @@ int main(int argc, char **argv) {
211 const char *usage = 211 const char *usage =
212 "Usage: swaylock [options...]\n" 212 "Usage: swaylock [options...]\n"
213 "\n" 213 "\n"
214 " -h, --help Show help message and quit.\n" 214 " -h, --help Show help message and quit.\n"
215 " -c, --color <rrggbb> Turn the screen into the given color instead of white.\n" 215 " -c, --color <rrggbb[aa]> Turn the screen into the given color instead of white.\n"
216 " -s, --scaling Scaling mode: stretch, fill, fit, center, tile.\n" 216 " -s, --scaling Scaling mode: stretch, fill, fit, center, tile.\n"
217 " -t, --tiling Same as --scaling=tile.\n" 217 " -t, --tiling Same as --scaling=tile.\n"
218 " -v, --version Show the version number and quit.\n" 218 " -v, --version Show the version number and quit.\n"
219 " -i, --image <path> Display the given image.\n"; 219 " -i, --image <path> Display the given image.\n";
220 220
221 int c; 221 int c;
222 while (1) { 222 while (1) {
@@ -226,16 +226,22 @@ int main(int argc, char **argv) {
226 break; 226 break;
227 } 227 }
228 switch (c) { 228 switch (c) {
229 case 'c': 229 case 'c':
230 if (strlen(optarg) < 6) { 230 {
231 fprintf(stderr, "color must be specified in 3 byte format, e.g. ff0000\n"); 231 int colorlen = strlen(optarg);
232 if (colorlen < 6 || colorlen == 7 || colorlen > 8) {
233 fprintf(stderr, "color must be specified in 3 or 4 byte format, e.g. ff0000 or ff0000ff\n");
232 exit(EXIT_FAILURE); 234 exit(EXIT_FAILURE);
233 } 235 }
234 color = strtol(optarg, NULL, 16); 236 color = strtol(optarg, NULL, 16);
235 color <<= 8; 237
236 color |= 0xFF; 238 if (colorlen == 6) {
239 color <<= 8;
240 color |= 0xFF;
241 }
237 sway_log(L_DEBUG, "color: 0x%x", color); 242 sway_log(L_DEBUG, "color: 0x%x", color);
238 break; 243 break;
244 }
239 case 'i': 245 case 'i':
240 image_path = optarg; 246 image_path = optarg;
241 break; 247 break;